Blog Post

Apps on Azure Blog
1 MIN READ

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

Weizhen_Sun's avatar
Weizhen_Sun
Former Employee
Apr 28, 2023

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 

 

  • Regarding more parameters for Get-AzPrivateEndpoint

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

 

Published Apr 28, 2023
Version 1.0
No CommentsBe the first to comment