【问题标题】:Scripting WebApp VNET integration with Azure Powershell编写 WebApp VNET 与 Azure Powershell 集成的脚本
【发布时间】:2016-01-26 11:24:55
【问题描述】:

我可以使用 azure 门户将 Web 应用程序添加到虚拟网络,以便在其上托管的各种服务之间进行通信。但是,我在环境中通过 Powershell 编写了所有其他内容,并且也希望自动化 WebApp/VNET 集成。

到目前为止,我已经阅读了以下文章:

https://azure.microsoft.com/en-gb/documentation/articles/web-sites-integrate-with-vnet/

不过,这只是如何通过门户进行。我认为 Set-AzureRMWebApp cmdlet 是正确的使用方法,但我看不到任何可能有帮助的参数。

https://msdn.microsoft.com/en-us/library/mt652487.aspx

【问题讨论】:

    标签: 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

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2020-09-28
          • 2021-05-07
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多