PowerShell – Report on Azure Disks across Organization

Azure is a powerful cloud platform that provides a wide range of services to help organizations scale, manage, and deploy their applications and data.

Among these services, Azure Disk Storage is a fundamental component for managing and storing data in virtual machines.

To keep track of the disks in your organization’s Azure environment, it’s essential to have an efficient reporting mechanism.

In this blog, I am sharing the Script that can generate report of Azure Disks across your organization.

 

Prerequisites for this Solution:

Download the script from Git or PowerShell gallery from below links:

Git:

https://github.com/VikasSukhija/Downloads

AzureDisksReport.ps1

 

PowerShell Gallery:

https://www.powershellgallery.com/packages/AzureDisksReport/

Install-Script -Name AzureDisksReport

Update the below section of the script with your own parameters:


Note: Script will auto generate encrypted password first time it is run and save it in the same folder as shown in below screenshot.


Report will be generated and send on the email id specified and saved in reports folder.


Logic of the script:

It will first find all the subscriptions in your organization.


After this, it will loop thru each subscription and within each subscription, it will loop thru all the disks to capture the required information for the report.


Here is the sample report:


After running it for first time interactively you can schedule it to run via task scheduler as password has been stored as encrypted credentials inside the script folder.

Note: If in your organization, MFA is enabled and its does not work then you need to change the authentication piece to use app-based auth. (service principal auth)

 

 

Thanks for reading and downloading…

Tech Wizard

 

https://techwizard.cloud

https://syscloudpro.com/

PowerShell Fast Track

Leave a comment