Gallery › Azure Arc › Azure built-in policies
[Preview]: Configure a Windows Server 2016 (or 2012) ESU license for eligible Azure Arc-enabled machines.
Converted Policy DeployIfNotExists Disabled Mode Indexed Version 1.0.1-preview Preview
Enable Extended Security Updates (ESUs) licenses to help protect Windows Server 2016 (or 2012) machines after the end of support. To learn how to prepare and enable Extended Security Updates through Azure Arc, visit https://learn.microsoft.com/azure/azure-arc/servers/prepare-extended-security-updates. For pricing information, visit https://aka.ms/ArcWS2012ESUPricing.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"properties": {
"displayName": "[Preview]: Configure a Windows Server 2016 (or 2012) ESU license for eligible Azure Arc-enabled machines.",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Enable Extended Security Updates (ESUs) licenses to help protect Windows Server 2016 (or 2012) machines after the end of support. To learn how to prepare and enable Extended Security Updates through Azure Arc, visit https://learn.microsoft.com/azure/azure-arc/servers/prepare-extended-security-updates. For pricing information, visit https://aka.ms/ArcWS2012ESUPricing.",
"metadata": {
"version": "1.0.1-preview",
"category": "Azure Arc",
"preview": true
},
"version": "1.0.1-preview",
"parameters": {
"ESULicenseResourceId": {
"type": "string",
"metadata": {
"displayName": "Extended Security Updates (ESUs) license Resource ID.",
"description": "Resource ID of the Extended Security Updates (ESUs) license.",
"portalReview": "true",
"assignPermissions": true
}
},
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.HybridCompute/machines"
},
{
"field": "Microsoft.HybridCompute/imageOffer",
"like": "windows*"
},
{
"field": "Microsoft.HybridCompute/machines/licenseProfile.esuProfile.esuEligibility",
"equals": "Eligible"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/48b40c6e-82e0-4eb3-90d5-19e40f49b624",
"/providers/Microsoft.Authorization/roleDefinitions/088ab73d-1256-47ae-bea9-9de8e7131f31"
],
"name": "default",
"type": "Microsoft.HybridCompute/machines/licenseProfiles",
"existenceCondition": {
"field": "Microsoft.HybridCompute/machines/licenseProfiles/esuProfile.assignedLicense",
"equals": "[parameters('ESULicenseResourceId')]"
},
"deployment": {
"properties": {
"mode": "incremental",
"parameters": {
"vmName": {
"value": "[field('name')]"
},
"location": {
"value": "[field('location')]"
},
"type": {
"value": "[field('type')]"
},
"ESULicenseResourceId": {
"value": "[parameters('ESULicenseResourceId')]"
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string"
},
"location": {
"type": "string"
},
"type": {
"type": "string"
},
"ESULicenseResourceId": {
"type": "string"
}
},
"resources": [
{
"condition": "[equals(toLower(parameters('type')), toLower('Microsoft.HybridCompute/machines'))]",
"apiVersion": "2023-06-20-preview",
"type": "Microsoft.HybridCompute/machines/licenseProfiles",
"name": "[concat(parameters('vmName'), '/default')]",
"location": "[parameters('location')]",
"properties": {
"esuProfile": {
"assignedLicense": "[parameters('ESULicenseResourceId')]"
}
}
}
]
}
}
}
}
}
},
"versions": [
"1.0.1-PREVIEW",
"1.0.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/4864134f-d306-4ff5-94d8-ea4553b18c97",
"name": "4864134f-d306-4ff5-94d8-ea4553b18c97"
}# Converted from GuestConfiguration_ArcESU_DINE.json by ConvertTo-Bylaw.
Policy '4864134f-d306-4ff5-94d8-ea4553b18c97' {
Properties @{
DisplayName = '[Preview]: Configure a Windows Server 2016 (or 2012) ESU license for eligible Azure Arc-enabled machines.'
Description = 'Enable Extended Security Updates (ESUs) licenses to help protect Windows Server 2016 (or 2012) machines after the end of support. To learn how to prepare and enable Extended Security Updates through Azure Arc, visit https://learn.microsoft.com/azure/azure-arc/servers/prepare-extended-security-updates. For pricing information, visit https://aka.ms/ArcWS2012ESUPricing.'
Version = '1.0.1-preview'
Category = 'Azure Arc'
Preview = $true
PolicyVersion = '1.0.1-preview'
Mode = 'Indexed'
}
Parameter ESULicenseResourceId @{
Type = 'string'
DisplayName = 'Extended Security Updates (ESUs) license Resource ID.'
Description = 'Resource ID of the Extended Security Updates (ESUs) license.'
JsonName = 'ESULicenseResourceId'
Metadata = [ordered]@{ portalReview = 'true'; assignPermissions = $true }
}
Parameter Effect @{
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.HybridCompute/machines' {
When {
Field 'Microsoft.HybridCompute/imageOffer' | Must -BeLike 'windows*'
}
Require 'licenseProfile.esuProfile.esuEligibility is not Eligible' {
Field licenseProfile.esuProfile.esuEligibility | Must -Not -Be 'Eligible' -IfPresent
}
}
DeployIfNotExists 'Microsoft.HybridCompute/machines/licenseProfiles' -Role 'Hybrid Server Resource Administrator', 'Guest Configuration Resource Contributor' -Name 'default' -Effect (Param Effect) {
Require 'esuProfile.assignedLicense is the ESULicenseResourceId parameter' {
Field esuProfile.assignedLicense | Must -Be (Param ESULicenseResourceId)
}
Deployment -TemplateFile './templates/4864134f-d306-4ff5-94d8-ea4553b18c97.json' -Parameters ([ordered]@{
vmName = (Arm '[field(''name'')]')
location = (Arm '[field(''location'')]')
type = (Arm '[field(''type'')]')
ESULicenseResourceId = (Param ESULicenseResourceId)
})
}
}Its deployment templates are written beside it:
templates/4864134f-d306-4ff5-94d8-ea4553b18c97.json
Source: built-in-policies/policyDefinitions/Azure Arc/GuestConfiguration_ArcESU_DINE.json in Azure/azure-policy, under the MIT licence.
Bylaw