I might not have exactly what your looking for but you can use this to get the information at least, you can then use it to scope it differently for your need :)
# Retrieve all private endpoints in the subscription
$privateEndpoints = Get-AzPrivateEndpoint
# Check if private endpoints exist
if ($privateEndpoints.Count -eq 0) {
Write-Host "No private endpoints found in this subscription."
exit
}
# Loop through each private endpoint and output information
foreach ($endpoint in $privateEndpoints) {
Write-Output "Resource Group: $($endpoint.ResourceGroupName)"
Write-Output "Private Endpoint Name: $($endpoint.Name)"
# Initialize an array to store FQDNs
$fqdnList = @()
# Loop through private link service connections to build FQDNs
foreach ($connection in $endpoint.PrivateLinkServiceConnections) {
if ($connection.GroupIds -and $connection.GroupIds.Count -gt 0) {
foreach ($group in $connection.GroupIds) {
$fqdnList += "$($group).privatelink.$($connection.Name).azure.net"
}
}
}
# Display FQDNs or "None found" if empty
if ($fqdnList.Count -gt 0) {
Write-Output "FQDNs:"
foreach ($fqdn in $fqdnList) {
Write-Output " - $fqdn"
}
} else {
Write-Output "FQDNs: None found"
}
# Retrieve the private IP addresses from network interfaces
Write-Output "IP Addresses:"
$networkInterface = Get-AzNetworkInterface -ResourceId $endpoint.NetworkInterfaces.Id
# Loop through IP configurations to fetch private IP addresses
$ipAddresses = $networkInterface.IpConfigurations | ForEach-Object { $_.PrivateIpAddress }
if ($ipAddresses.Count -gt 0) {
foreach ($ip in $ipAddresses) {
Write-Output " - $ip"
}
} else {
Write-Output " - None found"
}
Write-Output "-----------------------------------------"
}
Hope this is helpful and remember shared knowledge is the best knowledge 😊 Best Regards, Timmy Malmgren
If the Answer is helpful, please click "Accept Answer" and upvote it as it helps others to find what they are looking for faster!