Bylaw

Gallery › Azure Arc › Azure built-in policies

[Preview]: Deny creation or modification of Windows Server 2016 (or 2012) ESU licenses.

Converted Policy Deny Disabled Mode Indexed Version 1.0.1-preview Preview

This policy enables you to restrict the creation or modification of Extended Security Updates (ESU) licenses for Windows Server 2016 (or 2012) Arc-enabled machines. For details about Windows Server ESUs and associated pricing, visit https://aka.ms/ArcWS2012ESUPricing.

ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.

Azure Policy JSONGuestConfiguration_ArcESU_Deny.json · 43 lines
{
  "properties": {
    "displayName": "[Preview]: Deny creation or modification of Windows Server 2016 (or 2012) ESU licenses.",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "This policy enables you to restrict the creation or modification of Extended Security Updates (ESU) licenses for Windows Server 2016 (or 2012) Arc-enabled machines. For details about Windows Server ESUs and associated pricing, visit https://aka.ms/ArcWS2012ESUPricing.",
    "metadata": {
      "version": "1.0.1-preview",
      "category": "Azure Arc",
      "preview": true
    },
    "version": "1.0.1-preview",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Deny"
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "equals": "Microsoft.HybridCompute/licenses"
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.1-PREVIEW",
      "1.0.0-PREVIEW"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/4c660f31-eafb-408d-a2b3-6ed2260bd26c",
  "name": "4c660f31-eafb-408d-a2b3-6ed2260bd26c"
}
Bylaw4c660f31-eafb-408d-a2b3-6ed2260bd26c.bylaw.ps1 · 24 lines
# Converted from GuestConfiguration_ArcESU_Deny.json by ConvertTo-Bylaw.
Policy '4c660f31-eafb-408d-a2b3-6ed2260bd26c' {

    Properties @{
        DisplayName   = '[Preview]: Deny creation or modification of Windows Server 2016 (or 2012) ESU licenses.'
        Description   = 'This policy enables you to restrict the creation or modification of Extended Security Updates (ESU) licenses for Windows Server 2016 (or 2012) Arc-enabled machines. For details about Windows Server ESUs and associated pricing, visit https://aka.ms/ArcWS2012ESUPricing.'
        Version       = '1.0.1-preview'
        Category      = 'Azure Arc'
        Preview       = $true
        PolicyVersion = '1.0.1-preview'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        AllowedValues = @('Deny', 'Disabled')
        Default       = 'Deny'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }

    Resource 'Microsoft.HybridCompute/licenses'

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Azure Arc/GuestConfiguration_ArcESU_Deny.json in Azure/azure-policy, under the MIT licence.