gpt4 book ai didi

azure - 将 Azure 应用服务添加到新的 VNet 集成预览

转载 作者:行者123 更新时间:2023-12-03 05:44:18 25 4
gpt4 key购买 nike

我们希望通过新的 VNet 集成(预览版)将 Azure 应用服务与我们的本地网络连接起来,这不再需要任何点到站点隧道。我们已经通过 Azure 门户实现了我们的目标,现在希望通过 ARM Template Deploy 或 Powershell 在我们的 DevOps Pipelines 中实现这一目标。

ARM 模板部署:我们通过新的 VNet 集成从现有应用服务生成了 ARM 模板。重新部署此模板不会添加新的 VNet 集成,而是添加旧的(非常奇怪):

{
"type": "Microsoft.Web/sites/virtualNetworkConnections",
"apiVersion": "2016-08-01",
"name": "[concat(parameters('sites_name'), parameters('subnet_name'))]",
"location": "West Europe",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('sites_name'))]"
],
"properties": {
"vnetResourceId": "[concat(parameters('virtualNetworks_externalid'), '/subnets/XXXXXXX')]",
"certThumbprint": null,
"certBlob": null,
"routes": null,
"resyncRequired": false,
"dnsServers": null,
"isSwift": true
}
}

Powershell 部署:尝试此代码也会添加旧的 VNet 集成:

$propertiesObject = @{
"vnetResourceId" = "/subscriptions/$($subscriptionId)/resourceGroups/$($vnet.ResourceGroupName)/providers/Microsoft.Network/virtualNetworks/$($vnet.Name)/subnets/$($subnetNameToAdd)"
}

$virtualNetwork = New-AzureRmResource -Location $location -Properties $PropertiesObject -ResourceName "$($webAppName)/$($vnet.Name)" -ResourceType "Microsoft.Web/sites/virtualNetworkConnections" -ApiVersion 2016-08-01 -ResourceGroupName $resourceGroupName -Force

这是 Microsoft 的另一项新功能,仅实现了一半且半可用吗?(是的,它正在预览中,但已经几个月了......)

最佳答案

这就是我让它工作的方法:

{
"name": "vnet_name/subnet_name",
"type": "Microsoft.Network/virtualNetworks/subnets",
"apiVersion": "2018-08-01",
"location": "[resourceGroup().location]",
"properties": {
"addressPrefix": "10.0.1.0/24",
"delegations": [
{
"name": "delegation",
"properties": {
"servicename": "Microsoft.Web/serverfarms"
}
}
]
}
},
{
"name": "webappname/virtualNetwork",
"properties": {
"subnetResourceId": "[resourceId('Microsoft.Network/virtualNetworks/subnets', 'vnet_name', 'subnet_name')]",
"swiftSupported": true
},
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks/subnets', 'vnet_name', 'subnet_name')]"
],
"type": "Microsoft.Web/sites/config",
"location": "[resourceGroup().location]",
"apiVersion": "2018-02-01"
}

关于azure - 将 Azure 应用服务添加到新的 VNet 集成预览,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56003427/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com