【问题标题】:Scripting WebApp VNET integration with Azure Powershell编写 WebApp VNET 与 Azure Powershell 集成的脚本
【发布时间】:2016-01-26 11:24:55
【问题描述】:
【问题讨论】:
标签:
azure
azure-web-app-service
azure-powershell
【解决方案1】:
我遇到了同样的问题,但找不到使用 PS 模块的方法。但是,功能现已添加到 azure CLI。所以你可以从脚本中调用它。
az webapp vnet-integration add -g "resource group name" -n "app service name" --vnet "vnet name" --subnet "subnet name"
【解决方案2】:
首先,您需要一个现有的 VNet,并根据我在 http://www.techdiction.com/2016/01/12/creating-a-point-to-site-vpn-connection-on-an-azure-resource-manager-virtual-network/ 的帖子配置 P2S
然后使用下面的 PowerShell 通过 P2S VPN 将 AppService 连接到 VNet:
$subscription_id = "<Subscription_ID>"
$NetworkName = "<Network_Name>"
$location = "<Region>"
$netrgname = "<Resource_Group_VNet_is_in>"
$AppServiceName = "<AppService_Name>"
$props = @{
"vnetResourceId" = "/subscriptions/$subscription_id/resourcegroups/$netrgname/providers/Microsoft.ClassicNetwork/virtualNetworks/$NetworkName";
"certThumbprint"= "<Client_cert_thumbprint>";
"certBlob"= "<Base64_Cert_Data>";
"routes" = $null;
}
New-AzureRMResource -ResourceName "$AppServiceName/$AppServiceName-to-$NetworkName" -Location $location -ResourceGroupName MarcusWebsites -ResourceType Microsoft.Web/sites/virtualNetworkConnections -PropertyObject $props -ApiVersion "2015-08-01" -force
如果需要,您可以通过修改 routes 属性来配置自定义路由。让我知道您的进展情况,如果解决了问题,请将此帖子标记为答案。
马库斯
【解决方案3】:
目前不支持此功能,我们的待办事项列表中有它,不幸的是我现在没有 eta