【问题标题】:Getting vnet integration infos from a service plan从服务计划中获取 vnet 集成信息
【发布时间】:2020-12-23 17:31:38
【问题描述】:

上下文

部署带有 vnet 集成的 Azure 函数时,代码如下:

$properties = @{
            subnetResourceId = $subnet.Id
        }

$vNetParams = @{
                ResourceName      = "$webapp/VirtualNetwork"
                Location          = $Location
                ResourceGroupName = $ResourceGroupName
                ResourceType      = "Microsoft.Web/sites/networkConfig"
                PropertyObject    = $properties
}

$result = New-AzResource @vNetParams -Force
                           

这很好用。

项目通过在辐条 VNET 中查找可用子网来获得 $subnet。 因此,当 VNET 集成已经存在时,我不想运行之前的代码。

我需要什么

一种了解函数是否已集成 VNET 的方法

我测试了什么

Get-AzFunctionApp  -ResourceGroupName $ResourceGroupName -Name $webapp 

Get-AzFunctionAppPlan -ResourceGroupName $ResourceGroupName -Name $servicePlan 

Get-AzAppServicePlan -ResourceGroupName $ResourceGroupName -Name $servicePlan 

不返回任何 vnet 信息

Get-AzResource doesn't work with this resource: "$webapp/VirtualNetwork"  (not found)

【问题讨论】:

    标签: azure powershell azure-functions


    【解决方案1】:

    要检查函数应用是否已经集成了 vnet,只需使用以下命令。

    $VnetName = (Get-AzFunctionApp -ResourceGroupName <groupname> -Name <functionappname>).SiteConfig.VnetName
    if($VnetName){
        Write-Output "already intergration"
    }
    

    【讨论】:

      【解决方案2】:

      有一种方法可以在门户中解决这个问题。

      1. 导航到 Azure 门户
      2. 选择对应的Web App或Function App
      3. 导航到“诊断和解决问题”并搜索“VNet 集成信息”
      4. 这将加载一个刀片,其中将包含该应用服务计划中的 Web 应用的详细信息

      这就是 UI 的样子

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-05-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-03-22
        • 2018-06-17
        相关资源
        最近更新 更多