Quick Download: https://github.com/thekevinholman/AzureVMMP
This is a SCOM MP that will discover if your VM is running in Azure, and if so, pull back some interesting and useful properties for grouping, if needed. You can create SCOM groups based on Azure location, resource group, tags, subscription, etc.
You can read more about the Azure VM metadata here: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/instance-metadata-service
The MP runs a script that will execute a Invoke-WebRequest against the Windows Azure Guest Agent Service Metadata. These properties are as below:
Credits: This MP is a much simplified idea based on the work done here by Matthew Long: https://github.com/shadeon/SCOM-CloudInstanceMetadata
If you want to make Groups of Windows Computers based on this data, you can use a Group Membership rule similar to below:
<MembershipRule> <MonitoringClass>$MPElement[Name="Windows!Microsoft.Windows.Computer"]$</MonitoringClass> <RelationshipClass>$MPElement[Name="MSIL!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass> <Expression> <Contains> <MonitoringClass>$MPElement[Name="Azure.VM.Class"]$</MonitoringClass> <Expression> <RegExExpression> <ValueExpression> <Property>$MPElement[Name="Azure.VM.Class"]/Tags$</Property> </ValueExpression> <Operator>MatchesRegularExpression</Operator> <Pattern>^SomeStuff*</Pattern> </RegExExpression> </Expression> </Contains> </Expression> </MembershipRule>
This is just the base we need as we have requirements to turn monitoring off for “servers in Azure” which are managed by an outsourced team
I had got around this by creating custom classes and groups to mimic the base classes and based off an IP Address, which is fine for now, but will obviously only survive as long as the IP range doesn’t change 🙂
This sets us up nicely now for varying routing of incidents based on the discovery information.
Thanks, I imported it and it seems to work, but wham I try to select the class to create a group, it’s not listed :O
Am I doing something wrong ? The class is in place:
PS C:\Users\——-> Get-SCOMClass -DisplayName “Azure Virtual Machine”
DisplayName Name ManagementPackName Id
———– —- —————— —
Azure Virtual Machine Azure.VM.Class Azure.VM be82f4a7-d75f-b6b0-efbf-181e6b5258a5
but it seems not visible for the new group creation…
thanks for any help
You need to seal the MP – to use the classes in groups that you are trying to create in another MP.
Bumped into this and it looks great!
Al my Azure VMs are discovered etc. My question is; How do I create Computer groups based on tags. I can create groups dynamically based on the tags and show the AzureVMs, but I don’t get the group to show the actual computer object. I think the way to do it is to create a Computer group based on discovery data from a different class, but I cant figure it out..
My goal here is to create Computer groups based on tags and then schedule maintenance mode for those machines. I can set the Azure Computer object in maintenance but that doesn’t affect the actual computer object.
Any help on this would be appreciated.
Easy! You want to create a group with a similar expression:
“A Group of Windows Computer objects, that CONTAINS an Azure VM Class instance, with a TAGS property that matches some expression”
So you can build a MP fragment for this to be able to reuse it… or you can just create a simple group of Windows Computers using the SCOM UI using something basic (which we will overwrite), then export the XML and edit it similar to the example I just added to the body of this post.
Thank you so much! It works like a charm.
I couldn’t figure out the “Contains” bit, but now I know.
For anyone else doing this, remember; Before you seal the Azure VM management pack make sure that the Tags Property “MaxLength” is large enough.
Mine was set to default but I didn’t’ get all the tags because of the limit. Changed it to “650” and all is good (for my part)
Thanks again Kevin, your doing great work.