How To List All VNET Subnets Used for Private Endpoints of App service using PowerShell Script
Published Apr 28 2023 02:14 AM 3,983 Views
Microsoft

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

 

Co-Authors
Version history
Last update:
‎Apr 27 2023 07:14 PM
Updated by: