Gallery › Guest Configuration › Azure built-in policies
[Deprecated]: Linux machines should have Log Analytics agent installed on Azure Arc
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.2.0-deprecated Deprecated
Machines are non-compliant if Log Analytics agent is not installed on Azure Arc enabled Linux server.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONLinuxLogAnalyticsAgentInstalled_AINE.json · 83 lines
{
"properties": {
"displayName": "[Deprecated]: Linux 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 Linux server.",
"metadata": {
"category": "Guest Configuration",
"version": "1.2.0-deprecated",
"deprecated": true,
"requiredProviders": [
"Microsoft.GuestConfiguration"
],
"guestConfiguration": {
"name": "LinuxLogAnalyticsAgentInstalled",
"version": "1.*"
}
},
"version": "1.2.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": "linux*"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.GuestConfiguration/guestConfigurationAssignments",
"name": "LinuxLogAnalyticsAgentInstalled",
"existenceCondition": {
"field": "Microsoft.GuestConfiguration/guestConfigurationAssignments/complianceStatus",
"equals": "Compliant"
}
}
}
},
"versions": [
"1.2.0",
"1.1.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/1e7fed80-8321-4605-b42c-65fc300f23a3",
"name": "1e7fed80-8321-4605-b42c-65fc300f23a3"
}Bylaw1e7fed80-8321-4605-b42c-65fc300f23a3.bylaw.ps1 · 48 lines
# Converted from LinuxLogAnalyticsAgentInstalled_AINE.json by ConvertTo-Bylaw.
Policy '1e7fed80-8321-4605-b42c-65fc300f23a3' {
Properties @{
DisplayName = '[Deprecated]: Linux 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 Linux server.'
Category = 'Guest Configuration'
Version = '1.2.0-deprecated'
Deprecated = $true
PolicyVersion = '1.2.0'
Mode = 'Indexed'
Metadata = [ordered]@{ requiredProviders = @('Microsoft.GuestConfiguration'); guestConfiguration = [ordered]@{ name = 'LinuxLogAnalyticsAgentInstalled'; 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 linux*' {
Field 'Microsoft.HybridCompute/imageOffer' | Must -Not -BeLike 'linux*' -IfPresent
}
}
AuditIfNotExists 'Microsoft.GuestConfiguration/guestConfigurationAssignments' -Name 'LinuxLogAnalyticsAgentInstalled' -Effect (Param Effect) {
Require 'complianceStatus is Compliant' {
Field complianceStatus | Must -Be 'Compliant'
}
}
}Source: built-in-policies/policyDefinitions/Guest Configuration/LinuxLogAnalyticsAgentInstalled_AINE.json in Azure/azure-policy, under the MIT licence.
Bylaw