Gallery › Monitoring › Azure built-in policies
[Deprecated]: Configure Dependency agent on Azure Arc enabled Windows servers
Converted Policy DeployIfNotExists Disabled Mode Indexed Version 2.2.0-deprecated Deprecated
This policy definition is deprecated following the planned retirement of the Dependency Agent on June 30, 2028. The Dependency Agent does not have a replacement, thus no replacement policy is available. For more information, see https://aka.ms/dependencyagentretirement.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDependencyAgentExtension_Windows_HybridVM_Disabled.json · 126 lines
{
"properties": {
"displayName": "[Deprecated]: Configure Dependency agent on Azure Arc enabled Windows servers",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "This policy definition is deprecated following the planned retirement of the Dependency Agent on June 30, 2028. The Dependency Agent does not have a replacement, thus no replacement policy is available. For more information, see https://aka.ms/dependencyagentretirement.",
"metadata": {
"version": "2.2.0-deprecated",
"category": "Monitoring",
"deprecated": true
},
"version": "2.2.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "Disabled",
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.HybridCompute/machines"
},
{
"field": "Microsoft.HybridCompute/machines/osName",
"equals": "windows"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.HybridCompute/machines/extensions",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/92aaf0da-9dab-42b6-94a3-d43ce8d16293"
],
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.HybridCompute/machines/extensions/type",
"equals": "DependencyAgentWindows"
},
{
"field": "Microsoft.HybridCompute/machines/extensions/publisher",
"equals": "Microsoft.Azure.Monitoring.DependencyAgent"
},
{
"field": "Microsoft.HybridCompute/machines/extensions/provisioningState",
"equals": "Succeeded"
}
]
},
"deployment": {
"properties": {
"mode": "incremental",
"template": {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string"
},
"location": {
"type": "string"
}
},
"variables": {
"DaExtensionName": "DependencyAgentWindows",
"DaExtensionType": "DependencyAgentWindows",
"DaExtensionTypeHandlerVersion": "9.10"
},
"resources": [
{
"type": "Microsoft.HybridCompute/machines/extensions",
"apiVersion": "2020-03-11-preview",
"name": "[concat(parameters('vmName'), '/', variables('DaExtensionName'))]",
"location": "[parameters('location')]",
"properties": {
"publisher": "Microsoft.Azure.Monitoring.DependencyAgent",
"type": "[variables('DaExtensionType')]",
"typeHandlerVersion": "[variables('DaExtensionTypeHandlerVersion')]",
"enableAutomaticUpgrade": true,
"autoUpgradeMinorVersion": true,
"settings": {}
}
}
],
"outputs": {
"policy": {
"type": "string",
"value": "[concat('Enabled DA extension for VM', ': ', parameters('vmName'))]"
}
}
},
"parameters": {
"vmName": {
"value": "[field('name')]"
},
"location": {
"value": "[field('location')]"
}
}
}
}
}
}
},
"versions": [
"2.2.0",
"2.1.0",
"2.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/91cb9edd-cd92-4d2f-b2f2-bdd8d065a3d4",
"name": "91cb9edd-cd92-4d2f-b2f2-bdd8d065a3d4"
}Bylaw91cb9edd-cd92-4d2f-b2f2-bdd8d065a3d4.bylaw.ps1 · 40 lines
# Converted from DependencyAgentExtension_Windows_HybridVM_Disabled.json by ConvertTo-Bylaw.
Policy '91cb9edd-cd92-4d2f-b2f2-bdd8d065a3d4' {
Properties @{
DisplayName = '[Deprecated]: Configure Dependency agent on Azure Arc enabled Windows servers'
Description = 'This policy definition is deprecated following the planned retirement of the Dependency Agent on June 30, 2028. The Dependency Agent does not have a replacement, thus no replacement policy is available. For more information, see https://aka.ms/dependencyagentretirement.'
Version = '2.2.0-deprecated'
Category = 'Monitoring'
Deprecated = $true
PolicyVersion = '2.2.0'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'Disabled'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.HybridCompute/machines' {
Require 'osName is not windows' {
Field osName | Must -Not -Be 'windows' -IfPresent
}
}
DeployIfNotExists 'Microsoft.HybridCompute/machines/extensions' -Role 'Log Analytics Contributor' -Effect (Param Effect) {
Require 'type, publisher and provisioningState are as required' {
Field 'Microsoft.HybridCompute/machines/extensions/type' | Must -Be 'DependencyAgentWindows'
Field publisher | Must -Be 'Microsoft.Azure.Monitoring.DependencyAgent'
Field provisioningState | Must -Be 'Succeeded'
}
Deployment -TemplateFile './templates/91cb9edd-cd92-4d2f-b2f2-bdd8d065a3d4.json' -Parameters ([ordered]@{
vmName = (Arm '[field(''name'')]')
location = (Arm '[field(''location'')]')
})
}
}Its deployment templates are written beside it:
templates/91cb9edd-cd92-4d2f-b2f2-bdd8d065a3d4.json
Source: built-in-policies/policyDefinitions/Monitoring/DependencyAgentExtension_Windows_HybridVM_Disabled.json in Azure/azure-policy, under the MIT licence.
Bylaw