PowerShell – Report on AZURE Storage Account Usage in Organization

In the era of cloud computing, Azure has emerged as a powerful platform, providing a plethora of services to organizations worldwide. Among these services, Azure Storage holds a crucial role, serving as the backbone for data storage needs. Keeping track of Azure Storage Account usage is essential for organizations to ensure optimal resource utilization and cost management. In this blog post, we will delve into how PowerShell can be harnessed to generate comprehensive reports on Azure Storage Account usage within your organization.

This post is a follow-up post of à

How to Programmatically get Azure Storage Accounts Usage

We have created the script using the concept in above blog post.

Prerequisites for this Solution:

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

Git:

https://github.com/VikasSukhija/Downloads

AzureStorageAccountsUsage.ps1

PowerShell Gallery:

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

Install-Script -Name AzureStorageAccountsUsage

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 also saved in report 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 Storage Accounts to capture the required information for the report. This information will be extracted using Get-AzMetric that we have discussed in the previous blog post.


Below is the sample Report that you will get on the email address specified in the $email1 variable.


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