Created
May 16, 2019 20:23
-
-
Save irlperu/1f76565ece25b4b5ac4d23e465f943c3 to your computer and use it in GitHub Desktop.
Get All Public IP's in Azure Subscription
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
#Login-AzAccount | |
Get-AzSubscription | |
Select-AzSubscription -SubscriptionId SubscriptionIdHere | |
Get-AzPublicIpAddress | select -Property *name,@{name='sku';e={$_.sku.name}} | |
# Loop through all Subscriptions that you have access to and export the information | |
Get-AzSubscription | foreach-object { | |
Write-Verbose -Message "Changing to Subscription $($_.Name)" -Verbose | |
$s = Select-AzSubscription -TenantId $_.TenantId -Subscription $_.Id -Force | |
$Name = $_.Name | |
$TenantId = $_.TenantId | |
Get-AzPublicIpAddress | select -Property @{name='subscription';e={$name}}, *name,ipaddress, PublicIpAllocationMethod,location,@{name='sku';e={$_.sku.name}},@{name='dns';e={$_.dnssettings.domainnamelabel}} -OutVariable ra | |
} | Export-Csv -Path C:\temp\publicipazure.csv -NoTypeInformation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment