Good afternoon all,

I am apparently in search of a unicorn. I've been through Azure Metrics, not wide enough... I've been through automation and the automation library... nada I have a basic outline of functionality in my head that I am trying to perform in my script. I want to look at all VM's across all subscriptions, and based upon either ToBeDetermined performance utilization criteria (CPU/NetworkTraffic/DiskIO/etc) or status of the VM OS state (OS booted/shut-down), pull those values and if the criteria is true (or the information meets decision metrics), to pass the values to Stop-AzureRmVM -name -resourcegroup and deallocate the machine.

But that decision needs to be driven by performance metrics, or the result of the OS check.

I have been over TechNet, GitHub, I am looking into OMS in Azure to see if this is already possible through its toolset, but everything I am finding is based off of location or resource group. I need a script based off of a previous commandlet result that gives a comparable value ($true or a numeric value that can be compared against).

Does anyone know of anything like this, or a logically similar solution? or seen it in use anywhere? I'm not looking for someone to build it for me, I just dont want to reinvent the wheel if it is out there and I am simply missing the solution, and can learn from someone's code sample to speed this solution along.

Thank you for your time, -=Craig


Log Analytics/OMS is what you need here. Aggregate all your data in Log Analytics and then you can query it. You can query cross resource groups, subscriptions and regions, so long as the data is there.

  • I will look into this, thank you for the guidance! – Craig Tate Jun 18 '18 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.