Gallery › Monitoring › Azure built-in policies
[Deprecated]: The Log Analytics extension should be installed on Virtual Machine Scale Sets
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.1.0-deprecated Deprecated
This policy definition is deprecated because OMS Agent was deprecated on August 31, 2024. While there is not a specific replacement policy, we have various policies available based on the VM setup that can be found under Azure Monitor Agent/DCRA Linux or Windows. Learn more about policy definition deprecation at aka.ms/policydefdeprecation.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONVMSS_LogAnalyticsAgent_AINE.json · 69 lines
{
"properties": {
"displayName": "[Deprecated]: The Log Analytics extension should be installed on Virtual Machine Scale Sets",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "This policy definition is deprecated because OMS Agent was deprecated on August 31, 2024. While there is not a specific replacement policy, we have various policies available based on the VM setup that can be found under Azure Monitor Agent/DCRA Linux or Windows. Learn more about policy definition deprecation at aka.ms/policydefdeprecation.",
"metadata": {
"version": "1.1.0-deprecated",
"category": "Monitoring",
"deprecated": true
},
"version": "1.1.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "Disabled",
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.Compute/virtualMachineScaleSets"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Compute/virtualMachineScaleSets/extensions",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.Compute/virtualMachineScaleSets/extensions/publisher",
"equals": "Microsoft.EnterpriseCloud.Monitoring"
},
{
"field": "Microsoft.Compute/virtualMachineScaleSets/extensions/type",
"in": [
"MicrosoftMonitoringAgent",
"OmsAgentForLinux"
]
},
{
"field": "Microsoft.Compute/virtualMachineScaleSets/extensions/provisioningState",
"equals": "Succeeded"
},
{
"field": "Microsoft.Compute/virtualMachineScaleSets/extensions/settings.workspaceId",
"exists": "true"
}
]
}
}
}
},
"versions": [
"1.1.0",
"1.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/efbde977-ba53-4479-b8e9-10b957924fbf",
"name": "efbde977-ba53-4479-b8e9-10b957924fbf"
}Bylawefbde977-ba53-4479-b8e9-10b957924fbf.bylaw.ps1 · 32 lines
# Converted from VMSS_LogAnalyticsAgent_AINE.json by ConvertTo-Bylaw.
Policy 'efbde977-ba53-4479-b8e9-10b957924fbf' {
Properties @{
DisplayName = '[Deprecated]: The Log Analytics extension should be installed on Virtual Machine Scale Sets'
Description = 'This policy definition is deprecated because OMS Agent was deprecated on August 31, 2024. While there is not a specific replacement policy, we have various policies available based on the VM setup that can be found under Azure Monitor Agent/DCRA Linux or Windows. Learn more about policy definition deprecation at aka.ms/policydefdeprecation.'
Version = '1.1.0-deprecated'
Category = 'Monitoring'
Deprecated = $true
PolicyVersion = '1.1.0'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'Disabled'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Compute/virtualMachineScaleSets'
AuditIfNotExists 'Microsoft.Compute/virtualMachineScaleSets/extensions' -Effect (Param Effect) {
Require 'publisher, type, provisioningState and 1 more are as required' {
Field publisher | Must -Be 'Microsoft.EnterpriseCloud.Monitoring'
Field 'Microsoft.Compute/virtualMachineScaleSets/extensions/type' | Must -BeIn @('MicrosoftMonitoringAgent', 'OmsAgentForLinux')
Field provisioningState | Must -Be 'Succeeded'
Field settings.workspaceId | Must -Exist
}
}
}Source: built-in-policies/policyDefinitions/Monitoring/VMSS_LogAnalyticsAgent_AINE.json in Azure/azure-policy, under the MIT licence.
Bylaw