Listing Azure Services within a CSV file

less than 1 minute read

In some situations you will look into a current Azure Environment and the setup/governance of it and need to migrate or move resources around.

The below script will help you with exporting the Azure resources into a CSV file, from that CSV file you can join the data within Excel to make plans.

Script

 

###################################################################################
##
## PowerShell script for exporting Azure Resources within a subscription.
## Creator: Maik van der Gaag
##
###################################################################################


Login-AzureRmAccount
$path = Read-Host "Enter the full path to save the export file to"

$subsciptions = Get-AzureRmSubscription

Write-Host "Subscriptions"
Write-Host "--------------"
foreach($sub in $subsciptions){

    Write-Host ($sub | Select -ExpandProperty "Name")
}

Write-Host ""

$name = Read-Host "Please enter the subscription names for which you want to export the Azure Services devided by (,)"

$names = $name.Split(",");

foreach($subName in $names){