Powershell – Generate Azure Inventory

As with any managed services or infrastructure services projects, maintaining the server inventory is very crucial. The server-inventory-file provides a one-stop checklist, that you can refer while you are on priority 1 bridge calls.

With a traditional data center, it is easy to maintain server/infra inventory on an excel sheet. But it is not the same as the cloud because the infrastructure is so dynamic.

The only solution to this problem is Automation. I have written a PowerShell script just to do that.

Below is the flow

  • Prompt user for Azure login credentials.
  • Prompt user to select the subscription.
  • Pull inventory information for Azure VMs, Storage, VNet, NSG, External LB.
  • Populate the data in an excel sheet.
  • Prompt user if they want to view the sheet.

**Note: This script expects that you are using Powershell v5.0 and you have the excel modules installed. Basically, you should have the MSOffice software installed.

Version 2.0:

I have changed the design of this script. It no longer creates a single Excel sheet. Rather, produces a CSV file for individual services inside individual subscription’s folder.


This script will pull the infrastructure details of the Azure subscriptions. Details will be stored under the folder “c:\AzureInventory”If you have multiple subscriptions, a separate folder will be created for individual subscription.CSV files will be created for individual services (Virtual Machines, NSG rules, Storage Account, Virtual Networks, Azure Load Balancers) inside the subscription’s directory

Below is the link to the script:


Below are the links to:

AWS IaaS Inventory

Azure PaaS Inventory

Click here to download my PowerShell scripts for Free !!




  1. Hi Manjunath,

    Script is very good. We need in virtual machine worksheet Virtual machine running status can you please add and republish the script.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s