Skip to content

Instantly share code, notes, and snippets.

@illuzian
Created November 5, 2020 00:10
Show Gist options
  • Save illuzian/30d77c599977cff2d59df98b7d0ae0fa to your computer and use it in GitHub Desktop.
Save illuzian/30d77c599977cff2d59df98b7d0ae0fa to your computer and use it in GitHub Desktop.
# Output to console
Get-AzSubscription | ForEach-Object {Set-AzContext -Subscription $_.Name *>$null; Get-AzPublicIpAddress} | Where-Object {$_.IpAddress -ne 'Not Assigned'} | Select-Object -Property Name,PublicIpAllocationMethod,ipAddress,ProvisioningState,Location,ResourceGroupName,Id
# Write to CSV
Get-AzSubscription | ForEach-Object {Set-AzContext -Subscription $_.Name *>$null; Get-AzPublicIpAddress} | Where-Object {$_.IpAddress -ne 'Not Assigned'} | Select-Object -Property Name,PublicIpAllocationMethod,ipAddress,ProvisioningState,Location,ResourceGroupName,Id | Export-Csv -Path .\pips.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment