Skip to content

[Feature]: Please include VirtualNetworkSubnetId when Get-AzWebApp #18042

@o-l-a-v

Description

@o-l-a-v

Description of the new feature

Currently, Get-AzWebApp (for one given App Service or Function App to get all details, instead of list), does not include VNet integration info. There is an attribute VirtualNetworkSubnetId, but it's null.

Please include this info, or add a cmdlet to get network configuration info for App Service and Function Apps.

Ways to achieve this now

Undocumented API endpoints

For now I got the info I neeeded by using Invoke-AzRestMethod like so:

Click to expand
$FunctionAppsAsAzResource = [array](Get-AzResource -ResourceType 'Microsoft.Web/sites' | Where-Object -Property 'Kind' -like 'functionapp*' | Sort-Object -Property 'ResourceGroupName','Name')
$FunctionApps = [array](
    $FunctionAppsAsAzResource.ForEach{
        Write-Information -MessageData (
            '{0} / {1} "{2} \ {3}"' -f (
                (1+$FunctionAppsAsAzResource.IndexOf($_)).ToString('0'*$FunctionAppsAsAzResource.'Count'.ToString().'Length'),
                $FunctionAppsAsAzResource.'Count'.ToString(),
                $_.'ResourceGroupName',
                $_.'Name'
            )
        )
        [PSCustomObject]@{
            'Resource' = $_
            'WebApp' = Get-AzWebApp -ResourceGroupName $_.'ResourceGroupName' -Name $_.'Name'
            'VirtualNetwork' = [PSCustomObject](
                (
                    (
                        Invoke-AzRestMethod -Method 'Get' -Path ('{0}/networkconfig/virtualNetwork?api-version=2018-11-01' -f $_.'Id')
                    ).'Content' | ConvertFrom-Json
                ).'Properties'
            )
        }
    }
)

I can't seem to find this API endpoint documented anywhere either. Found it by using web browser development tools (F12) in the Azure portal. Related topics:

Subnet

Get-AzVirtualNetworkSubnetConfig and look at attribute ServiceAssociationLinks.

Metadata

Metadata

Labels

App Servicesaka WebSitesService AttentionThis issue is responsible by Azure service team.customer-reportedfeature-requestThis issue requires a new behavior in the product in order be resolved.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions