Find Storage Account Used for Diagnostic in Azure VM

Next is another guest blog by Gourav Kumar…

I am writing this block after a while,
So let’s make some noise first….. HEY! I am back……
I was just busy in my daily operations and learning to complete AZ103, AZ300, AZ301 and AZ500 certifications. Now let’s get started and get back to business for that we are supposed to be here.

Earlier, during my day to day operations I got an interesting requirement from my seniors and teammates. Requirement is “Can we find the storage account name associated with each VM in the subscription for their diagnostic logs

Now I have the problem statement and need to figure out an answer for the same……
First, I thought this could be done through Graph Query but this seems either I do not have that much of expertise in it or this is not feasible yet.

Now what’s left…………..
Its’ my favourite scripting language: The PowerShell. It is cross platform also and can pull data from Azure, so what else needed to begin with, I guess nothing.

Started with Some Get and Help commands to find the available CMDlets. And I found one with the name Diagnostic extension, Just drilled it down and cooked an script to do my work.

And I am done, So here is the script that can leverage the given task with the help of PowerShell Automation.

You could use this into Azure Automation, Export result using general powershell host.

Do whatever you want to do with script, But do share your feedback and rate this on TechNet.

Thanks for reading, Keep SCOMing and love PowerShell, Azure 🙂
Gourav Kumar