Gallery › Monitoring › Azure built-in policies
Windows Arc-enabled machines should have Azure Monitor Agent installed
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.4.0
Windows Arc-enabled machines should be monitored and secured through the deployed Azure Monitor Agent. The Azure Monitor Agent collects telemetry data from the guest OS. Windows Arc-enabled machines in supported regions are monitored for Azure Monitor Agent deployment. Learn more: https://aka.ms/AMAOverview.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONAzureMonitor_Agent_Windows_HybridVM_Audit.json · 144 lines
{
"properties": {
"displayName": "Windows Arc-enabled machines should have Azure Monitor Agent installed",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Windows Arc-enabled machines should be monitored and secured through the deployed Azure Monitor Agent. The Azure Monitor Agent collects telemetry data from the guest OS. Windows Arc-enabled machines in supported regions are monitored for Azure Monitor Agent deployment. Learn more: https://aka.ms/AMAOverview.",
"metadata": {
"version": "1.4.0",
"category": "Monitoring"
},
"version": "1.4.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy."
},
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"defaultValue": "AuditIfNotExists"
},
"listOfApplicableLocations": {
"type": "Array",
"metadata": {
"displayName": "Applicable Locations",
"description": "List of locations where the policy should apply.",
"strongType": "location"
},
"defaultValue": [
"australiacentral",
"australiacentral2",
"australiaeast",
"australiasoutheast",
"brazilsouth",
"brazilsoutheast",
"canadacentral",
"canadaeast",
"centralindia",
"centralus",
"centraluseuap",
"eastasia",
"eastus",
"eastus2",
"eastus2euap",
"francecentral",
"francesouth",
"germanynorth",
"germanywestcentral",
"israelcentral",
"italynorth",
"japaneast",
"japanwest",
"jioindiacentral",
"jioindiawest",
"koreacentral",
"koreasouth",
"malaysiasouth",
"mexicocentral",
"northcentralus",
"northeurope",
"norwayeast",
"norwaywest",
"polandcentral",
"qatarcentral",
"southafricanorth",
"southafricawest",
"southcentralus",
"southeastasia",
"southindia",
"spaincentral",
"swedencentral",
"swedensouth",
"switzerlandnorth",
"switzerlandwest",
"taiwannorth",
"taiwannorthwest",
"uaecentral",
"uaenorth",
"uksouth",
"ukwest",
"westcentralus",
"westeurope",
"westindia",
"westus",
"westus2",
"westus3",
"chilecentral",
"newzealandnorth"
]
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.HybridCompute/machines"
},
{
"field": "Microsoft.HybridCompute/machines/osName",
"equals": "Windows"
},
{
"field": "location",
"in": "[parameters('listOfApplicableLocations')]"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.HybridCompute/machines/extensions",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.HybridCompute/machines/extensions/type",
"equals": "AzureMonitorWindowsAgent"
},
{
"field": "Microsoft.HybridCompute/machines/extensions/publisher",
"equals": "Microsoft.Azure.Monitor"
},
{
"field": "Microsoft.HybridCompute/machines/extensions/provisioningState",
"equals": "Succeeded"
}
]
}
}
}
},
"versions": [
"1.4.0",
"1.3.0",
"1.2.0",
"1.1.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/ec621e21-8b48-403d-a549-fc9023d4747f",
"name": "ec621e21-8b48-403d-a549-fc9023d4747f"
}Bylawec621e21-8b48-403d-a549-fc9023d4747f.bylaw.ps1 · 45 lines
# Converted from AzureMonitor_Agent_Windows_HybridVM_Audit.json by ConvertTo-Bylaw.
Policy 'ec621e21-8b48-403d-a549-fc9023d4747f' {
Properties @{
DisplayName = 'Windows Arc-enabled machines should have Azure Monitor Agent installed'
Description = 'Windows Arc-enabled machines should be monitored and secured through the deployed Azure Monitor Agent. The Azure Monitor Agent collects telemetry data from the guest OS. Windows Arc-enabled machines in supported regions are monitored for Azure Monitor Agent deployment. Learn more: https://aka.ms/AMAOverview.'
Version = '1.4.0'
Category = 'Monitoring'
PolicyVersion = '1.4.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy.'
}
Parameter ListOfApplicableLocations @{
Type = 'Array'
Default = @('australiacentral', 'australiacentral2', 'australiaeast', 'australiasoutheast', 'brazilsouth', 'brazilsoutheast', 'canadacentral', 'canadaeast', 'centralindia', 'centralus', 'centraluseuap', 'eastasia', 'eastus', 'eastus2', 'eastus2euap', 'francecentral', 'francesouth', 'germanynorth', 'germanywestcentral', 'israelcentral', 'italynorth', 'japaneast', 'japanwest', 'jioindiacentral', 'jioindiawest', 'koreacentral', 'koreasouth', 'malaysiasouth', 'mexicocentral', 'northcentralus', 'northeurope', 'norwayeast', 'norwaywest', 'polandcentral', 'qatarcentral', 'southafricanorth', 'southafricawest', 'southcentralus', 'southeastasia', 'southindia', 'spaincentral', 'swedencentral', 'swedensouth', 'switzerlandnorth', 'switzerlandwest', 'taiwannorth', 'taiwannorthwest', 'uaecentral', 'uaenorth', 'uksouth', 'ukwest', 'westcentralus', 'westeurope', 'westindia', 'westus', 'westus2', 'westus3', 'chilecentral', 'newzealandnorth')
DisplayName = 'Applicable Locations'
Description = 'List of locations where the policy should apply.'
Metadata = [ordered]@{ strongType = 'location' }
}
Resource 'Microsoft.HybridCompute/machines' {
When {
Field osName | Must -Be 'Windows'
}
Require 'location is not one of the ListOfApplicableLocations parameter' {
Field location | Must -Not -BeIn (Param ListOfApplicableLocations) -IfPresent
}
}
AuditIfNotExists 'Microsoft.HybridCompute/machines/extensions' -Effect (Param Effect) {
Require 'type, publisher and provisioningState are as required' {
Field 'Microsoft.HybridCompute/machines/extensions/type' | Must -Be 'AzureMonitorWindowsAgent'
Field publisher | Must -Be 'Microsoft.Azure.Monitor'
Field provisioningState | Must -Be 'Succeeded'
}
}
}Source: built-in-policies/policyDefinitions/Monitoring/AzureMonitor_Agent_Windows_HybridVM_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw