Last active
August 25, 2022 07:41
-
-
Save yooakim/33eac1fe3b543af0d78d6d4a19c4bfe9 to your computer and use it in GitHub Desktop.
Simple PowerShell + AZ CLI to get public IP addresse from all subscriptions I have access to
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Subscriptions = az account list --query '[].{Id:id,Name:name,TenantId:tenantId}' | ConvertFrom-Json | |
$PublicIPs=$Subscriptions | % { az network public-ip list --query '[].{Name:name,PublicIP:ipAddress,Version:publicIpAddressVersion,Method:publicIpAllocationMethod,SKU:sku.name,ResourceGroup:resourceGroup,DNS:dnsSettings.fqdn,d:id}' --subscription $_.Id -o json | ConvertFrom-Json } | |
$PublicIPs | select Name,PublicIP, ResourceGroup, SKU, Version, Method | Sort-Object Name | Format-Table -AutoSize | |
$PublicIPs | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment