Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
o-l-a-v opened this issue May 5, 2022 · 1 comment
Closed

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

o-l-a-v opened this issue May 5, 2022 · 1 comment
Assignees
Labels
App Services aka WebSites customer-reported feature-request This issue requires a new behavior in the product in order be resolved. Service Attention This issue is responsible by Azure service team.

Comments

@o-l-a-v
Copy link

o-l-a-v commented May 5, 2022

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.

@o-l-a-v o-l-a-v added feature-request This issue requires a new behavior in the product in order be resolved. needs-triage This is a new issue that needs to be triaged to the appropriate team. labels May 5, 2022
@ghost ghost added customer-reported and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels May 5, 2022
@dingmeng-xue dingmeng-xue added App Services aka WebSites Service Attention This issue is responsible by Azure service team. labels May 5, 2022
@ghost
Copy link

ghost commented May 5, 2022

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @antcp, @AzureAppServiceCLI.

Issue Details

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.

Author: o-l-a-v
Assignees: -
Labels:

App Services, feature-request, Service Attention, customer-reported

Milestone: -

@Kotasudhakarreddy Kotasudhakarreddy self-assigned this May 9, 2022
@o-l-a-v o-l-a-v changed the title [Feature]: Please include VirtualNetworkSubnetId when Get-AzWebApp [Feature]: Please include VirtualNetworkSubnetId when Get-AzWebApp May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App Services aka WebSites customer-reported feature-request This issue requires a new behavior in the product in order be resolved. Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants