Step-by-Step Documenting your Azure VMs


The short version

  1. Open Azure PowerShell
  2. Select the subscription you want to document
  3. Run this one-liner


    Get-AzureVM | ForEach-Object { $vm = $ ; Write-Output “$vm VM Properties” ; Write-Output “—————” ; Format-List -InputObject $_ -Property * ; Write-Output “$vm VM Endpoints” ; Write-Output “—————” ; Get-AzureEndpoint -VM $_ ; Write-Output “$vm Virtual Disks” ; Write-Output “—————” ; Get-AzureDisk | where {$_.AttachedTo.RoleName -eq $vm} ; Write-Output “==================================`n” } | Out-File -FilePath “.\myVMs.txt”


Not too many steps in “step-by-step documenting your Azure Vms” but this is really useful and deservers some attention to be tried out.


The detailed version

  1. Open Azure PowerShell, How to install
  2. Add user account

  3. Change the default folder, either in PowerShell or in the code “xxx.\myVMs.txt“..
  4. Copy-Paste the one-liner

  5. Wait a little and then look at the result.


I have been using this script for a while and have found it to be very useful to speed up documentation, I got it from here and credit to Mark Renoden via @Plankytronixx

Ideas going forward is to have the information in a CSV and then connect it to a Visio, if anyone has tips on how to do it please let me know J

Leave a Comment