Skip to content

Instantly share code, notes, and snippets.

Created June 12, 2020 10:09
What would you like to do?
Get a list of Network Interface Cards attached on NSGs and ASGs
Get-AzNetworkInterface | Select Name, ResourceGroupName,`
@{Name="NSG";Expression = {$_.NetworkSecurityGroup.Id.tostring().substring($_.NetworkSecurityGroup.Id.tostring().lastindexof('/')+1)}},`
# optional if you want to add the below line for exporting to file
# | Export-Csv "nsg and asg info.csv" -Delimiter ","
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment