Can i create an Azure Policy definition that checks which Virtual Machines have Inventory enabled

Peter Casey 20 Reputation points
2024-01-11T17:55:40.0133333+00:00

Hello, I am looking to create an Azure Policy Definition that will check which Virtual Machines have Inventory enabled. Is this possible?? In the definition JSON, i have attempted the below...
But cannot find what I should enter in place of the question marks. I believe it should be something that references a Virtual Machines Inventory enablement. I'm really stuck on this one and would totally appreciate if anyone could advise what i need to enter here.

"allOf": [
              {
                "field": "type",
                "equals": "Microsoft.Compute/virtualMachines"
              },
              {
                "field": "Microsoft.Compute/virtualMachines/????",
                "notEquals": "true"
              }
            ]
Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
806 questions
{count} votes

Accepted answer
  1. SwathiDhanwada-MSFT 18,031 Reputation points
    2024-01-12T09:03:42.9033333+00:00

    Peter Casey One way to check if the inventory has been enabled for the azure virtual machine is to check if Change Tracking extension has been enabled or not. For instance, you can if change tracking is enabled for linux virtual machines, by using field property as "Microsoft.Compute/virtualMachines/extensions/type" and value as "ChangeTracking-Linux". For further references related to change tracking you can refer existing initiative [Preview]: Enable ChangeTracking and Inventory for virtual machines


0 additional answers

Sort by: Most helpful