Gallery › Azure Arc › Azure built-in policies
Configure Azure Arc-enabled Servers to enable automatic upgrades
Converted Policy Disabled Modify Mode Indexed Version 1.0.0
The Automatic Upgrade feature allows servers to stay updated with no action from the user after opting in. This policy ensures that Azure Arc-enabled servers are configured to be opted in for automatic upgrades.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONArc_AutomaticUpgradeEnabled_Modify.json · 61 lines
{
"properties": {
"displayName": "Configure Azure Arc-enabled Servers to enable automatic upgrades",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "The Automatic Upgrade feature allows servers to stay updated with no action from the user after opting in. This policy ensures that Azure Arc-enabled servers are configured to be opted in for automatic upgrades.",
"metadata": {
"version": "1.0.0",
"category": "Azure Arc"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Modify",
"Disabled"
],
"defaultValue": "Modify"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.HybridCompute/machines"
},
{
"field": "Microsoft.HybridCompute/machines/agentUpgrade.enableAutomaticUpgrade",
"notEquals": true
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/48b40c6e-82e0-4eb3-90d5-19e40f49b624"
],
"operations": [
{
"operation": "addOrReplace",
"field": "Microsoft.HybridCompute/machines/agentUpgrade.enableAutomaticUpgrade",
"value": true
}
]
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/f9dfba6f-7430-4214-a666-342b3d3d0d62",
"name": "f9dfba6f-7430-4214-a666-342b3d3d0d62"
}Bylawf9dfba6f-7430-4214-a666-342b3d3d0d62.bylaw.ps1 · 30 lines
# Converted from Arc_AutomaticUpgradeEnabled_Modify.json by ConvertTo-Bylaw.
Policy 'f9dfba6f-7430-4214-a666-342b3d3d0d62' {
Properties @{
DisplayName = 'Configure Azure Arc-enabled Servers to enable automatic upgrades'
Description = 'The Automatic Upgrade feature allows servers to stay updated with no action from the user after opting in. This policy ensures that Azure Arc-enabled servers are configured to be opted in for automatic upgrades.'
Version = '1.0.0'
Category = 'Azure Arc'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Modify', 'Disabled')
Default = 'Modify'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.HybridCompute/machines' {
Require 'agentUpgrade.enableAutomaticUpgrade is true' {
Field agentUpgrade.enableAutomaticUpgrade | Must -Be $true
}
}
Modify -Role 'Hybrid Server Resource Administrator' -Effect (Param Effect) {
Field agentUpgrade.enableAutomaticUpgrade | AddOrReplace $true
}
}Source: built-in-policies/policyDefinitions/Azure Arc/Arc_AutomaticUpgradeEnabled_Modify.json in Azure/azure-policy, under the MIT licence.
Bylaw