Export or Backup Azure Virtual Networks or Subnet information into CSV using PowerShell

 There may be times when you  want to get a report that contains information of all VNETS along with their subnets and address prefixes. You might have question, how to export or backup Azure VNET or subnets information into CSV.  This script will export Azure Virtual Network information along with subnets and address prefixes of all Active subscriptions into a CSV.

foreach ( $Subscription in $(Get-AzSubscription| Where-Object {$_.State -ne "Disabled"}) )
Select-AzSubscription -SubscriptionId $Subscription.SubscriptionId
foreach ($net in $nets)
foreach ($snet in $snets)
$outputtemp = "" | SELECT  VNET,VNET_AddressSpace,VNET_Location,ResourceGroup,Subnet_Name,Subnet_AddressPrefix
$outputfinal += $outputtemp
#$outputfinal | Format-Table
$outputfinal | Export-Csv ./clouddrive/.cloudconsole/NETS_"$((Get-Date).ToString("yyyyMMdd_HHmmss")).csv" -NoTypeInformation



  1. Do you have a script that Imports the Subnet settings for a Vnet from a CSV?


Post a Comment

Popular posts from this blog

Specifying SSH port in Ansible Inventory

Ansible-Playbook to display output of multiple show commands (using stdout_lines with Loop)

Filtering Routes in BGP using Route-maps and Prefix-list

Ansible Playbook for Network OS Upgrade with pre and post checks

Bypassing Proxy Server in Google Chrome

VMware NSX Traffic Flow — East-West & North-South

Export or Backup Azure Network Security Groups into CSV using PowerShell

Ansible-playbook for backing up running config of Cisco IOS