我们希望通过新的VNet集成(预览版)将Azure应用程序服务与内部部署网络连接,该网络不再需要任何点对点隧道。 我们已经通过Azure门户实现了目标,现在希望通过ARM模板部署或Powershell在DevOps管道中实现此目标。
ARM模板部署: 我们使用新的VNet集成从现有的App Service中生成了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的又一项新功能,仅实现了一半且半可用吗? (是的,它处于预览阶段,但是已经有几个月了……)
答案 0 :(得分:1)
这就是我的工作方式:
{
"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"
}