Gallery › Monitoring › Azure built-in policies
[Deprecated]: Deploy Dependency agent for Linux virtual machine scale sets with Azure Monitoring Agent settings
Converted Policy DeployIfNotExists Disabled Mode Indexed Version 3.3.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_Linux_VMSS_Deploy_AMA_Disabled.json · 386 lines
{
"properties": {
"displayName": "[Deprecated]: Deploy Dependency agent for Linux virtual machine scale sets with Azure Monitoring Agent settings",
"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": "3.3.0-deprecated",
"category": "Monitoring",
"deprecated": true
},
"version": "3.3.0",
"parameters": {
"listOfImageIdToInclude": {
"type": "Array",
"defaultValue": [],
"metadata": {
"displayName": "Optional: List of VM images that have supported Linux OS to add to scope",
"description": "Example value: '/subscriptions/<subscriptionId>/resourceGroups/YourResourceGroup/providers/Microsoft.Compute/images/ContosoStdImage'"
}
},
"effect": {
"type": "string",
"defaultValue": "Disabled",
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Deprecated. This parameter is no longer used due to the planned retirement of the Dependency Agent on June 30, 2028. There is no replacement for the Dependency Agent. For more information, see https://aka.ms/dependencyagentretirement."
}
},
"enableProcessesAndDependencies": {
"type": "Boolean",
"metadata": {
"displayName": "Enable Processes and Dependencies",
"description": "Deprecated. This parameter is no longer used due to the planned retirement of the Dependency Agent on June 30, 2028. There is no replacement for the Dependency Agent. For more information, see https://aka.ms/dependencyagentretirement."
},
"allowedValues": [
true,
false
],
"defaultValue": false
},
"scopeToSupportedImages": {
"type": "Boolean",
"metadata": {
"displayName": "Scope Policy to Dependency Agent-Supported Operating Systems",
"description": "If set to true, the policy will apply only to virtual machine scale sets with supported operating systems. Otherwise, the policy will apply to all virtual machine scale set resources in the assignment scope. For supported operating systems, see https://learn.microsoft.com/azure/azure-monitor/vm/vminsights-dependency-agent-maintenance"
},
"allowedValues": [
true,
false
],
"defaultValue": true
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/virtualMachineScaleSets"
},
{
"value": "[parameters('enableProcessesAndDependencies')]",
"equals": true
},
{
"anyOf": [
{
"allOf": [
{
"value": "[parameters('scopeToSupportedImages')]",
"equals": false
},
{
"field": "Microsoft.Compute/virtualMachineScaleSets/virtualMachineProfile.storageProfile.osDisk.osType",
"like": "Linux*"
}
]
},
{
"field": "Microsoft.Compute/imageId",
"in": "[parameters('listOfImageIdToInclude')]"
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "Canonical"
},
{
"field": "Microsoft.Compute/imageOffer",
"equals": "UbuntuServer"
},
{
"anyOf": [
{
"field": "Microsoft.Compute/imageSKU",
"in": [
"14.04.0-LTS",
"14.04.1-LTS",
"14.04.5-LTS"
]
},
{
"field": "Microsoft.Compute/imageSKU",
"in": [
"16.04-LTS",
"16.04.0-LTS"
]
},
{
"field": "Microsoft.Compute/imageSKU",
"in": [
"18.04-LTS"
]
}
]
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "Canonical"
},
{
"field": "Microsoft.Compute/imageOffer",
"equals": "0001-com-ubuntu-server-focal"
},
{
"field": "Microsoft.Compute/imageSKU",
"equals": "20_04-lts"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "RedHat"
},
{
"field": "Microsoft.Compute/imageOffer",
"in": [
"RHEL",
"RHEL-SAP-HANA"
]
},
{
"anyOf": [
{
"field": "Microsoft.Compute/imageSKU",
"like": "6.*"
},
{
"field": "Microsoft.Compute/imageSKU",
"like": "7*"
},
{
"field": "Microsoft.Compute/imageSKU",
"like": "8*"
}
]
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "SUSE"
},
{
"anyOf": [
{
"allOf": [
{
"field": "Microsoft.Compute/imageOffer",
"in": [
"SLES",
"SLES-HPC",
"SLES-HPC-Priority",
"SLES-SAP",
"SLES-SAP-BYOS",
"SLES-Priority",
"SLES-BYOS",
"SLES-SAPCAL",
"SLES-Standard"
]
},
{
"field": "Microsoft.Compute/imageSKU",
"in": [
"12-SP2",
"12-SP3",
"12-SP4",
"12-sp4-gen2",
"12-SP5",
"15",
"15-SP1"
]
}
]
},
{
"allOf": [
{
"anyOf": [
{
"field": "Microsoft.Compute/imageOffer",
"like": "sles-12-sp5*"
},
{
"field": "Microsoft.Compute/imageOffer",
"like": "sles-15-sp1*"
}
]
},
{
"field": "Microsoft.Compute/imageSKU",
"in": [
"gen1",
"gen2"
]
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imageOffer",
"like": "sles-sap-15-sp1*"
},
{
"field": "Microsoft.Compute/imageSKU",
"equals": "gen1"
}
]
}
]
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "OpenLogic"
},
{
"field": "Microsoft.Compute/imageOffer",
"in": [
"CentOS",
"Centos-LVM",
"CentOS-SRIOV"
]
},
{
"anyOf": [
{
"field": "Microsoft.Compute/imageSKU",
"like": "6.*"
},
{
"field": "Microsoft.Compute/imageSKU",
"like": "7*"
},
{
"field": "Microsoft.Compute/imageSKU",
"like": "8*"
}
]
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "cloudera"
},
{
"field": "Microsoft.Compute/imageOffer",
"equals": "cloudera-centos-os"
},
{
"field": "Microsoft.Compute/imageSKU",
"like": "7*"
}
]
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Compute/virtualMachineScaleSets/extensions",
"roleDefinitionIds": [
"/providers/microsoft.authorization/roleDefinitions/9980e02c-c2be-4d73-94e8-173b1dc7cf3c"
],
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.Compute/virtualMachineScaleSets/extensions/type",
"equals": "DependencyAgentLinux"
},
{
"field": "Microsoft.Compute/virtualMachineScaleSets/extensions/publisher",
"equals": "Microsoft.Azure.Monitoring.DependencyAgent"
}
]
},
"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": {
"vmExtensionName": "DependencyAgentLinux",
"vmExtensionPublisher": "Microsoft.Azure.Monitoring.DependencyAgent",
"vmExtensionType": "DependencyAgentLinux",
"vmExtensionTypeHandlerVersion": "9.10"
},
"resources": [
{
"type": "Microsoft.Compute/virtualMachineScaleSets/extensions",
"name": "[concat(parameters('vmName'), '/', variables('vmExtensionName'))]",
"apiVersion": "2021-04-01",
"location": "[parameters('location')]",
"properties": {
"publisher": "[variables('vmExtensionPublisher')]",
"type": "[variables('vmExtensionType')]",
"typeHandlerVersion": "[variables('vmExtensionTypeHandlerVersion')]",
"enableAutomaticUpgrade": true,
"autoUpgradeMinorVersion": true,
"settings": {
"enableAMA": "true"
}
}
}
],
"outputs": {
"policy": {
"type": "string",
"value": "[concat('Enabled extension for: ', parameters('vmName'))]"
}
}
},
"parameters": {
"vmName": {
"value": "[field('name')]"
},
"location": {
"value": "[field('location')]"
}
}
}
}
}
}
},
"versions": [
"3.3.0",
"3.2.0",
"3.1.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/2fea0c12-e7d4-4e03-b7bf-c34b2b8d787d",
"name": "2fea0c12-e7d4-4e03-b7bf-c34b2b8d787d"
}Bylaw2fea0c12-e7d4-4e03-b7bf-c34b2b8d787d.bylaw.ps1 · 145 lines
# Converted from DependencyAgentExtension_Linux_VMSS_Deploy_AMA_Disabled.json by ConvertTo-Bylaw.
Policy '2fea0c12-e7d4-4e03-b7bf-c34b2b8d787d' {
Properties @{
DisplayName = '[Deprecated]: Deploy Dependency agent for Linux virtual machine scale sets with Azure Monitoring Agent settings'
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 = '3.3.0-deprecated'
Category = 'Monitoring'
Deprecated = $true
PolicyVersion = '3.3.0'
Mode = 'Indexed'
}
Parameter ListOfImageIdToInclude @{
Type = 'Array'
Default = @()
DisplayName = 'Optional: List of VM images that have supported Linux OS to add to scope'
Description = 'Example value: ''/subscriptions/<subscriptionId>/resourceGroups/YourResourceGroup/providers/Microsoft.Compute/images/ContosoStdImage'''
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'Disabled'
DisplayName = 'Effect'
Description = 'Deprecated. This parameter is no longer used due to the planned retirement of the Dependency Agent on June 30, 2028. There is no replacement for the Dependency Agent. For more information, see https://aka.ms/dependencyagentretirement.'
}
Parameter EnableProcessesAndDependencies @{
Type = 'Boolean'
AllowedValues = @($true, $false)
Default = $false
DisplayName = 'Enable Processes and Dependencies'
Description = 'Deprecated. This parameter is no longer used due to the planned retirement of the Dependency Agent on June 30, 2028. There is no replacement for the Dependency Agent. For more information, see https://aka.ms/dependencyagentretirement.'
}
Parameter ScopeToSupportedImages @{
Type = 'Boolean'
AllowedValues = @($true, $false)
Default = $true
DisplayName = 'Scope Policy to Dependency Agent-Supported Operating Systems'
Description = 'If set to true, the policy will apply only to virtual machine scale sets with supported operating systems. Otherwise, the policy will apply to all virtual machine scale set resources in the assignment scope. For supported operating systems, see https://learn.microsoft.com/azure/azure-monitor/vm/vminsights-dependency-agent-maintenance'
}
Resource 'Microsoft.Compute/virtualMachineScaleSets' {
When {
Param EnableProcessesAndDependencies | Must -Be $true
}
Require 'virtualMachineProfile.storageProfile.osDisk.osType is as required' {
AnyOf {
Param ScopeToSupportedImages | Must -Not -Be $false
Field virtualMachineProfile.storageProfile.osDisk.osType | Must -Not -BeLike 'Linux*' -IfPresent
}
}
Require 'imageId is not one of the ListOfImageIdToInclude parameter' {
Field 'Microsoft.Compute/imageId' | Must -Not -BeIn (Param ListOfImageIdToInclude) -IfPresent
}
Require 'imagePublisher, imageOffer and imageSKU are as required' {
AnyOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Not -Be 'Canonical' -IfPresent
Field 'Microsoft.Compute/imageOffer' | Must -Not -Be 'UbuntuServer' -IfPresent
AllOf {
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeIn @('14.04.0-LTS', '14.04.1-LTS', '14.04.5-LTS') -IfPresent
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeIn @('16.04-LTS', '16.04.0-LTS') -IfPresent
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeIn @('18.04-LTS') -IfPresent
}
}
}
Require 'imagePublisher, imageOffer and imageSKU are as required' {
AnyOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Not -Be 'Canonical' -IfPresent
Field 'Microsoft.Compute/imageOffer' | Must -Not -Be '0001-com-ubuntu-server-focal' -IfPresent
Field 'Microsoft.Compute/imageSKU' | Must -Not -Be '20_04-lts' -IfPresent
}
}
Require 'imagePublisher, imageOffer and imageSKU are as required' {
AnyOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Not -Be 'RedHat' -IfPresent
Field 'Microsoft.Compute/imageOffer' | Must -Not -BeIn @('RHEL', 'RHEL-SAP-HANA') -IfPresent
AllOf {
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '6.*' -IfPresent
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '7*' -IfPresent
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '8*' -IfPresent
}
}
}
Require 'imagePublisher, imageOffer and imageSKU are as required' {
AnyOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Not -Be 'SUSE' -IfPresent
AllOf {
AnyOf {
Field 'Microsoft.Compute/imageOffer' | Must -Not -BeIn @('SLES', 'SLES-HPC', 'SLES-HPC-Priority', 'SLES-SAP', 'SLES-SAP-BYOS', 'SLES-Priority', 'SLES-BYOS', 'SLES-SAPCAL', 'SLES-Standard') -IfPresent
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeIn @('12-SP2', '12-SP3', '12-SP4', '12-sp4-gen2', '12-SP5', '15', '15-SP1') -IfPresent
}
AnyOf {
AllOf {
Field 'Microsoft.Compute/imageOffer' | Must -Not -BeLike 'sles-12-sp5*' -IfPresent
Field 'Microsoft.Compute/imageOffer' | Must -Not -BeLike 'sles-15-sp1*' -IfPresent
}
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeIn @('gen1', 'gen2') -IfPresent
}
AnyOf {
Field 'Microsoft.Compute/imageOffer' | Must -Not -BeLike 'sles-sap-15-sp1*' -IfPresent
Field 'Microsoft.Compute/imageSKU' | Must -Not -Be 'gen1' -IfPresent
}
}
}
}
Require 'imagePublisher, imageOffer and imageSKU are as required' {
AnyOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Not -Be 'OpenLogic' -IfPresent
Field 'Microsoft.Compute/imageOffer' | Must -Not -BeIn @('CentOS', 'Centos-LVM', 'CentOS-SRIOV') -IfPresent
AllOf {
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '6.*' -IfPresent
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '7*' -IfPresent
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '8*' -IfPresent
}
}
}
Require 'imagePublisher, imageOffer and imageSKU are as required' {
AnyOf {
Field 'Microsoft.Compute/imagePublisher' | Must -Not -Be 'cloudera' -IfPresent
Field 'Microsoft.Compute/imageOffer' | Must -Not -Be 'cloudera-centos-os' -IfPresent
Field 'Microsoft.Compute/imageSKU' | Must -Not -BeLike '7*' -IfPresent
}
}
}
DeployIfNotExists 'Microsoft.Compute/virtualMachineScaleSets/extensions' -Role 'Virtual Machine Contributor' -Effect (Param Effect) {
Require 'type is DependencyAgentLinux and publisher is Microsoft.Azure.Monitoring.DependencyAgent' {
Field 'Microsoft.Compute/virtualMachineScaleSets/extensions/type' | Must -Be 'DependencyAgentLinux'
Field publisher | Must -Be 'Microsoft.Azure.Monitoring.DependencyAgent'
}
Deployment -TemplateFile './templates/2fea0c12-e7d4-4e03-b7bf-c34b2b8d787d.json' -Parameters ([ordered]@{
vmName = (Arm '[field(''name'')]')
location = (Arm '[field(''location'')]')
})
}
}Its deployment templates are written beside it:
templates/2fea0c12-e7d4-4e03-b7bf-c34b2b8d787d.json
Source: built-in-policies/policyDefinitions/Monitoring/DependencyAgentExtension_Linux_VMSS_Deploy_AMA_Disabled.json in Azure/azure-policy, under the MIT licence.
Bylaw