Gallery › Monitoring › Azure built-in policies
The legacy Log Analytics extension should not be installed on Azure Arc enabled Windows servers
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
Automatically prevent installation of the legacy Log Analytics Agent as the final step of migrating from legacy agents to Azure Monitor Agent. After you have uninstalled existing legacy extensions, this policy will deny all future installations of the legacy agent extension on Azure Arc enabled Windows servers. Learn more: https://aka.ms/migratetoAMA
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONLogAnalyticsExtension_Windows_HybridVM_Deny.json · 54 lines
{
"properties": {
"displayName": "The legacy Log Analytics extension should not be installed on Azure Arc enabled Windows servers",
"policyType": "BuiltIn",
"mode": "All",
"description": "Automatically prevent installation of the legacy Log Analytics Agent as the final step of migrating from legacy agents to Azure Monitor Agent. After you have uninstalled existing legacy extensions, this policy will deny all future installations of the legacy agent extension on Azure Arc enabled Windows servers. Learn more: https://aka.ms/migratetoAMA",
"metadata": {
"version": "1.0.0",
"category": "Monitoring"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Deny",
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.HybridCompute/machines/extensions"
},
{
"field": "Microsoft.HybridCompute/machines/extensions/publisher",
"equals": "Microsoft.EnterpriseCloud.Monitoring"
},
{
"field": "Microsoft.HybridCompute/machines/extensions/type",
"equals": "MicrosoftMonitoringAgent"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/df441472-4dae-4e4e-87b9-9205ba46be16",
"name": "df441472-4dae-4e4e-87b9-9205ba46be16"
}Bylawdf441472-4dae-4e4e-87b9-9205ba46be16.bylaw.ps1 · 32 lines
# Converted from LogAnalyticsExtension_Windows_HybridVM_Deny.json by ConvertTo-Bylaw.
Policy 'df441472-4dae-4e4e-87b9-9205ba46be16' {
Properties @{
DisplayName = 'The legacy Log Analytics extension should not be installed on Azure Arc enabled Windows servers'
Description = 'Automatically prevent installation of the legacy Log Analytics Agent as the final step of migrating from legacy agents to Azure Monitor Agent. After you have uninstalled existing legacy extensions, this policy will deny all future installations of the legacy agent extension on Azure Arc enabled Windows servers. Learn more: https://aka.ms/migratetoAMA'
Version = '1.0.0'
Category = 'Monitoring'
PolicyVersion = '1.0.0'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('Deny', 'Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.HybridCompute/machines/extensions' {
When {
Field publisher | Must -Be 'Microsoft.EnterpriseCloud.Monitoring'
}
Require 'type is not MicrosoftMonitoringAgent' {
Field 'Microsoft.HybridCompute/machines/extensions/type' | Must -Not -Be 'MicrosoftMonitoringAgent' -IfPresent
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Monitoring/LogAnalyticsExtension_Windows_HybridVM_Deny.json in Azure/azure-policy, under the MIT licence.
Bylaw