How To List All VNET Subnets Used for Private Endpoints of App service using PowerShell Script

This post has been republished via RSS; it originally appeared at: Microsoft Tech Community - Latest Blogs - .

Azure App service can enable Private Endpoints for inbound traffic. 

Customers may want to list all VNET subnets used for Private Endpoints, and enable Network Security Group for the Private Endpoints.

There is no way to do it from Azure portal. But the below Power shell script can help customers list all the subnets used for Private Endpoints.

 

  • List all VNET subnets used for Private Endpoint using PowerShell script

$privateEndpoints = Get-AzPrivateEndpoint

$subnetIds = $privateEndpoints | ForEach-Object { $_.Subnet.Id }

$uniqueSubnetIds = $subnetIds | Sort-Object -Unique

 

foreach ($subnetId in $uniqueSubnetIds) {

    Get-AzResource -ResourceId $subnetId

}

 

The output is like this 

Weizhen_Sun_0-1682581634213.png

 

  • Regarding more parameters for Get-AzPrivateEndpoint

         Check Get-AzPrivateEndpoint (Az.Network) | Microsoft Learn

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.