Azure Policy target only windows

Reek2750 0 Reputation points
2024-05-10T08:25:57.5633333+00:00

Hello! :)

I am fairly new to Azure Policy, I am trying to create a policy to target windows servers that doesn't have AHUB enabled, however this policy keeps getting Linux machines in aswell.

Why is that, when I state it should be windowsserver or dynamics?

{
  "mode": "All",
  "policyRule": {
    "if": {
      "allOf": [
        {
          "anyOf": [
            {
              "field": "type",
              "equals": "Microsoft.Compute/virtualMachines"
            }
          ]
        },
        {
          "anyOf": [
            {
              "field": "Microsoft.Compute/virtualMachines/storageProfile.imageReference.publisher",
              "equals": "MicrosoftDynamicsAX"
            },
            {
              "field": "Microsoft.Compute/virtualMachines/storageProfile.imageReference.publisher",
              "equals": "MicrosoftWindowsServer"
            }
          ]
        },
        {
          "field": "Microsoft.Compute/virtualMachines/licenseType",
          "notEquals": "Windows_Server"
        }
      ]
    },
    "then": {
      "effect": "audit"
    }
  },
  "parameters": {}
}
Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
808 questions
0 comments No comments
{count} votes