简体   繁体   中英

Add Azure App Service to new VNet Integration preview

We want to connect an Azure App Service with our On Premise Network via the new VNet Integration (preview), which doesn't need any Point-to-Site Tunnel anymore. We already achieved our goal via Azure Portal and now want to implement this in our DevOps Pipelines via ARM Template Deploy or Powershell.

ARM Template Deploy: We generated the ARM Template from an exisiting App Service with new VNet Integration. Redeploy this Template doesn't add the new VNet Integration, but the old one (very strange):

{
    "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 Deploy: Trying this code will add the old VNet Integration as well:

$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

Is this another new feature from Microsoft which is just half implemented and semi available? (yeah, its in preview, but since several month...)

this is how I got it to work:

{
    "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"
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM