JSON
api-version=2021-06-01
Copy definition Copy definition 4 EPAC EPAC
{ 7 items displayName: "Configure Windows Virtual Machine Scale Sets to be associated with a Data Collection Rule or a Data Collection Endpoint" , policyType: "BuiltIn" , mode: "Indexed" , description: "Deploy Association to link Windows virtual machine scale sets to the specified Data Collection Rule or the specified Data Collection Endpoint. The list of locations and OS images are updated over time as support is increased." , metadata: { 2 items version: "3.4.0" , category: "Monitoring" } , parameters: { 5 items effect: { 4 items type: "String" , metadata: { 2 items displayName: "Effect" , description: "Enable or disable the execution of the policy." } , allowedValues: [ 2 items "DeployIfNotExists" , "Disabled" ] , defaultValue: "DeployIfNotExists" } , scopeToSupportedImages: { 4 items type: "Boolean" , metadata: { 2 items displayName: "Scope Policy to Azure Monitor Agent-Supported Operating Systems" , description: "If set to true, the policy will apply only to virtual machine scale sets with AMA-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://aka.ms/AMAOverview." } , allowedValues: [ 2 items ] , defaultValue: true } , listOfWindowsImageIdToInclude: { 3 items type: "Array" , metadata: { 2 items displayName: "Optional: List of virtual machine scale set images that have supported Windows OS to add to scope" , description: "Example values: '/subscriptions/<subscriptionId>/resourceGroups/YourResourceGroup/providers/Microsoft.Compute/images/ContosoStdImage'" } , defaultValue : [] } , dcrResourceId: { 2 items type: "String" , metadata: { 4 items displayName: "Data Collection Rule Resource Id or Data Collection Endpoint Resource Id" , description: "Resource Id of the Data Collection Rule or the Data Collection Endpoint to be applied on the Linux machines in scope." , portalReview: "true" , assignPermissions: true } } , resourceType: { 4 items type: "String" , metadata: { 3 items displayName: "Resource Type" , description: "Either a Data Collection Rule (DCR) or a Data Collection Endpoint (DCE)" , portalReview: "true" } , allowedValues: [ 2 items "Microsoft.Insights/dataCollectionRules" , "Microsoft.Insights/dataCollectionEndpoints" ] , defaultValue: "Microsoft.Insights/dataCollectionRules" } } , policyRule: { 2 items if: { 1 item allOf: [ 3 items { 2 items field: "type" , equals: "Microsoft.Compute/virtualMachineScaleSets" } , { 2 items field: "location" , in: [ 57 items "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" ] } , { 1 item anyOf: [ 11 items { 1 item allOf: [ 2 items { 2 items value: "[parameters('scopeToSupportedImages')]" , equals: false } , { 2 items field: "Microsoft.Compute/virtualMachineScaleSets/virtualMachineProfile.storageProfile.osDisk.osType" , like: "Windows*" } ] } , { 2 items field: "Microsoft.Compute/imageId" , in: "[parameters('listOfWindowsImageIdToInclude')]" } , { 1 item allOf: [ 3 items { 2 items field: "Microsoft.Compute/imagePublisher" , equals: "MicrosoftWindowsServer" } , { 2 items field: "Microsoft.Compute/imageOffer" , equals: "WindowsServer" } , { 1 item anyOf: [ 5 items { 2 items field: "Microsoft.Compute/imageSku" , like: "2008-R2-SP1*" } , { 2 items field: "Microsoft.Compute/imageSku" , like: "2012-*" } , { 2 items field: "Microsoft.Compute/imageSku" , like: "2016-*" } , { 2 items field: "Microsoft.Compute/imageSku" , like: "2019-*" } , { 2 items field: "Microsoft.Compute/imageSku" , like: "2022-*" } ] } ] } , { 1 item allOf: [ 3 items { 2 items field: "Microsoft.Compute/imagePublisher" , equals: "MicrosoftWindowsServer" } , { 2 items field: "Microsoft.Compute/imageOffer" , equals: "WindowsServerSemiAnnual" } , { 2 items field: "Microsoft.Compute/imageSKU" , in: [ 4 items "Datacenter-Core-1709-smalldisk" , "Datacenter-Core-1709-with-Containers-smalldisk" , "Datacenter-Core-1803-with-Containers-smalldisk" , "Datacenter-Core-1809-with-Containers-smalldisk" ] } ] } , { 1 item allOf: [ 2 items { 2 items field: "Microsoft.Compute/imagePublisher" , equals: "MicrosoftWindowsServerHPCPack" } , { 2 items field: "Microsoft.Compute/imageOffer" , equals: "WindowsServerHPCPack" } ] } , { 1 item allOf: [ 2 items { 2 items field: "Microsoft.Compute/imagePublisher" , equals: "MicrosoftSQLServer" } , { 1 item anyOf: [ 4 items { 2 items field: "Microsoft.Compute/imageOffer" , like: "*-WS2016" } , { 2 items field: "Microsoft.Compute/imageOffer" , like: "*-WS2016-BYOL" } , { 2 items field: "Microsoft.Compute/imageOffer" , like: "*-WS2012R2" } , { 2 items field: "Microsoft.Compute/imageOffer" , like: "*-WS2012R2-BYOL" } ] } ] } , { 1 item allOf: [ 2 items { 2 items field: "Microsoft.Compute/imagePublisher" , equals: "MicrosoftRServer" } , { 2 items field: "Microsoft.Compute/imageOffer" , equals: "MLServer-WS2016" } ] } , { 1 item } , { 1 item allOf: [ 3 items { 2 items field: "Microsoft.Compute/imagePublisher" , equals: "MicrosoftDynamicsAX" } , { 2 items field: "Microsoft.Compute/imageOffer" , equals: "Dynamics" } , { 2 items field: "Microsoft.Compute/imageSKU" , equals: "Pre-Req-AX7-Onebox-U8" } ] } , { 1 item allOf: [ 2 items { 2 items field: "Microsoft.Compute/imagePublisher" , equals: "microsoft-ads" } , { 2 items field: "Microsoft.Compute/imageOffer" , equals: "windows-data-science-vm" } ] } , { 1 item allOf: [ 2 items { 2 items field: "Microsoft.Compute/imagePublisher" , equals: "MicrosoftWindowsDesktop" } , { 2 items field: "Microsoft.Compute/imageOffer" , like: "Windows-1*" } ] } ] } ] } , then: { 2 items effect: "[parameters('effect')]" , details: { 5 items type: "Microsoft.Insights/dataCollectionRuleAssociations" , roleDefinitionIds: [ 2 items ] , evaluationDelay: "AfterProvisioning" , existenceCondition: { 1 item anyOf: [ 2 items { 2 items field: "Microsoft.Insights/dataCollectionRuleAssociations/dataCollectionRuleId" , equals: "[parameters('dcrResourceId')]" } , { 2 items field: "Microsoft.Insights/dataCollectionRuleAssociations/dataCollectionEndpointId" , equals: "[parameters('dcrResourceId')]" } ] } , deployment: { 1 item properties: { 3 items mode: "incremental" , template: { 5 items $schema: "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#" , contentVersion: "1.0.0.0" , parameters: { 4 items } , variables: { 4 items dcrAssociationName: 🔍 "[
concat(
'assoc-',
uniqueString(
concat(
parameters('resourceName'),
parameters('dcrResourceId')
)
)
)
]", dceAssociationName: "configurationAccessEndpoint" , dcrResourceType: "Microsoft.Insights/dataCollectionRules" , dceResourceType: "Microsoft.Insights/dataCollectionEndpoints" } , resources: [ 2 items { 6 items condition: 🔍 "[
equals(
parameters('resourceType'),
variables(
'dcrResourceType'
)
)
]", name: "[variables('dcrAssociationName')]" , type: "Microsoft.Insights/dataCollectionRuleAssociations" , apiVersion: "2021-04-01" , properties: { 1 item dataCollectionRuleId: "[parameters('dcrResourceId')]" } , scope: 🔍 "[
concat(
'Microsoft.Compute/virtualMachineScaleSets/',
parameters('resourceName')
)
]" } , { 6 items condition: 🔍 "[
equals(
parameters('resourceType'),
variables(
'dceResourceType'
)
)
]", name: "[variables('dceAssociationName')]" , type: "Microsoft.Insights/dataCollectionRuleAssociations" , apiVersion: "2021-04-01" , properties: { 1 item dataCollectionEndpointId: "[parameters('dcrResourceId')]" } , scope: 🔍 "[
concat(
'Microsoft.Compute/virtualMachineScaleSets/',
parameters('resourceName')
)
]" } ] } , parameters: { 4 items } } } } } } }