Gallery › Guest Configuration › Azure built-in policies
[Deprecated]: Windows machines should have Log Analytics agent installed on Azure Arc
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 2.1.0-deprecated Deprecated
Machines are non-compliant if Log Analytics agent is not installed on Azure Arc enabled windows server.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONWindowsLogAnalyticsAgentInstalled_AINE.json · 83 lines
{
"properties": {
"displayName": "[Deprecated]: Windows machines should have Log Analytics agent installed on Azure Arc",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Machines are non-compliant if Log Analytics agent is not installed on Azure Arc enabled windows server.",
"metadata": {
"category": "Guest Configuration",
"version": "2.1.0-deprecated",
"deprecated": true,
"requiredProviders": [
"Microsoft.GuestConfiguration"
],
"guestConfiguration": {
"name": "WindowsLogAnalyticsAgentInstalled",
"version": "1.*"
}
},
"version": "2.1.0",
"parameters": {
"IncludeArcMachines": {
"type": "string",
"metadata": {
"displayName": "Include Arc connected servers",
"description": "By selecting this option, you agree to be charged monthly per Arc connected machine.",
"portalReview": "true"
},
"allowedValues": [
"true",
"false"
],
"defaultValue": "false"
},
"effect": {
"type": "string",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of this policy"
},
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"defaultValue": "Disabled"
}
},
"policyRule": {
"if": {
"allOf": [
{
"value": "[parameters('IncludeArcMachines')]",
"equals": "true"
},
{
"field": "type",
"equals": "Microsoft.HybridCompute/machines"
},
{
"field": "Microsoft.HybridCompute/imageOffer",
"like": "windows*"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.GuestConfiguration/guestConfigurationAssignments",
"name": "WindowsLogAnalyticsAgentInstalled",
"existenceCondition": {
"field": "Microsoft.GuestConfiguration/guestConfigurationAssignments/complianceStatus",
"equals": "Compliant"
}
}
}
},
"versions": [
"2.1.0",
"2.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/4078e558-bda6-41fb-9b3c-361e8875200d",
"name": "4078e558-bda6-41fb-9b3c-361e8875200d"
}Bylaw4078e558-bda6-41fb-9b3c-361e8875200d.bylaw.ps1 · 48 lines
# Converted from WindowsLogAnalyticsAgentInstalled_AINE.json by ConvertTo-Bylaw.
Policy '4078e558-bda6-41fb-9b3c-361e8875200d' {
Properties @{
DisplayName = '[Deprecated]: Windows machines should have Log Analytics agent installed on Azure Arc'
Description = 'Machines are non-compliant if Log Analytics agent is not installed on Azure Arc enabled windows server.'
Category = 'Guest Configuration'
Version = '2.1.0-deprecated'
Deprecated = $true
PolicyVersion = '2.1.0'
Mode = 'Indexed'
Metadata = [ordered]@{ requiredProviders = @('Microsoft.GuestConfiguration'); guestConfiguration = [ordered]@{ name = 'WindowsLogAnalyticsAgentInstalled'; version = '1.*' } }
}
Parameter IncludeArcMachines @{
Type = 'string'
AllowedValues = @('true', 'false')
Default = 'false'
DisplayName = 'Include Arc connected servers'
Description = 'By selecting this option, you agree to be charged monthly per Arc connected machine.'
JsonName = 'IncludeArcMachines'
Metadata = [ordered]@{ portalReview = 'true' }
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'Disabled'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of this policy'
}
Resource 'Microsoft.HybridCompute/machines' {
When {
Param IncludeArcMachines | Must -Be 'true'
}
Require 'imageOffer is not like windows*' {
Field 'Microsoft.HybridCompute/imageOffer' | Must -Not -BeLike 'windows*' -IfPresent
}
}
AuditIfNotExists 'Microsoft.GuestConfiguration/guestConfigurationAssignments' -Name 'WindowsLogAnalyticsAgentInstalled' -Effect (Param Effect) {
Require 'complianceStatus is Compliant' {
Field complianceStatus | Must -Be 'Compliant'
}
}
}Source: built-in-policies/policyDefinitions/Guest Configuration/WindowsLogAnalyticsAgentInstalled_AINE.json in Azure/azure-policy, under the MIT licence.
Bylaw