Gallery › Guest Configuration › Azure built-in policies
[Preview]: Eligible Azure Arc-enabled Windows Server 2016 (or 2012) machines should have ESUs installed.
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.1-preview Preview
Windows Server 2016 (or 2012) Arc-enabled machines should have all applicable Extended Security Updates (ESUs) installed. This policy requires that Guest Configuration prerequisites have been deployed to the policy assignment scope. For Guest Configuration prerequisites and setup information, visit https://aka.ms/gcpol.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONPendingESUUpdates_AINE.json · 74 lines
{
"properties": {
"displayName": "[Preview]: Eligible Azure Arc-enabled Windows Server 2016 (or 2012) machines should have ESUs installed.",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Windows Server 2016 (or 2012) Arc-enabled machines should have all applicable Extended Security Updates (ESUs) installed. This policy requires that Guest Configuration prerequisites have been deployed to the policy assignment scope. For Guest Configuration prerequisites and setup information, visit https://aka.ms/gcpol.",
"metadata": {
"version": "1.0.1-preview",
"category": "Guest Configuration",
"requiredProviders": [
"Microsoft.GuestConfiguration"
],
"guestConfiguration": {
"name": "PendingESUUpdates",
"version": "1.*"
},
"preview": true
},
"version": "1.0.1-preview",
"parameters": {
"effect": {
"type": "string",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of this policy"
},
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"defaultValue": "AuditIfNotExists"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.HybridCompute/machines"
},
{
"field": "Microsoft.HybridCompute/imageOffer",
"like": "windows*"
},
{
"field": "Microsoft.HybridCompute/machines/licenseProfile.esuProfile.licenseAssignmentState",
"equals": "Assigned"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.GuestConfiguration/guestConfigurationAssignments",
"name": "PendingESUUpdates",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.GuestConfiguration/guestConfigurationAssignments/complianceStatus",
"equals": "Compliant"
}
]
}
}
}
},
"versions": [
"1.0.1-PREVIEW",
"1.0.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/14b4e776-9fab-44b0-b53f-38d2458ea8be",
"name": "14b4e776-9fab-44b0-b53f-38d2458ea8be"
}Bylaw14b4e776-9fab-44b0-b53f-38d2458ea8be.bylaw.ps1 · 39 lines
# Converted from PendingESUUpdates_AINE.json by ConvertTo-Bylaw.
Policy '14b4e776-9fab-44b0-b53f-38d2458ea8be' {
Properties @{
DisplayName = '[Preview]: Eligible Azure Arc-enabled Windows Server 2016 (or 2012) machines should have ESUs installed.'
Description = 'Windows Server 2016 (or 2012) Arc-enabled machines should have all applicable Extended Security Updates (ESUs) installed. This policy requires that Guest Configuration prerequisites have been deployed to the policy assignment scope. For Guest Configuration prerequisites and setup information, visit https://aka.ms/gcpol.'
Version = '1.0.1-preview'
Category = 'Guest Configuration'
Preview = $true
PolicyVersion = '1.0.1-preview'
Mode = 'Indexed'
Metadata = [ordered]@{ requiredProviders = @('Microsoft.GuestConfiguration'); guestConfiguration = [ordered]@{ name = 'PendingESUUpdates'; version = '1.*' } }
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of this policy'
}
Resource 'Microsoft.HybridCompute/machines' {
When {
Field 'Microsoft.HybridCompute/imageOffer' | Must -BeLike 'windows*'
}
Require 'licenseProfile.esuProfile.licenseAssignmentState is not Assigned' {
Field licenseProfile.esuProfile.licenseAssignmentState | Must -Not -Be 'Assigned' -IfPresent
}
}
AuditIfNotExists 'Microsoft.GuestConfiguration/guestConfigurationAssignments' -Name 'PendingESUUpdates' -Effect (Param Effect) {
Require 'complianceStatus is Compliant' {
Field complianceStatus | Must -Be 'Compliant'
}
}
}Source: built-in-policies/policyDefinitions/Guest Configuration/PendingESUUpdates_AINE.json in Azure/azure-policy, under the MIT licence.
Bylaw