简体   繁体   English

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

[英]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. 我们希望通过新的VNet集成(预览版)将Azure App Service与我们的内部部署网络连接,现在不再需要任何点对点隧道。 We already achieved our goal via Azure Portal and now want to implement this in our DevOps Pipelines via ARM Template Deploy or Powershell. 我们已经通过Azure门户实现了目标,现在希望通过ARM模板部署或Powershell在DevOps管道中实现此目标。

ARM Template Deploy: We generated the ARM Template from an exisiting App Service with new VNet Integration. ARM模板部署:我们使用新的VNet集成从现有的App Service中生成了ARM模板。 Redeploy this Template doesn't add the new VNet Integration, but the old one (very strange): 重新部署此模板不会添加新的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 Deploy: Trying this code will add the old VNet Integration as well: Powershell Deploy:尝试使用此代码还将添加旧的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

Is this another new feature from Microsoft which is just half implemented and semi available? 这是Microsoft的又一项新功能,仅实现了一半且只有一半可用吗? (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"
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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