Hi Itay Miron,
Accordingcode, you're encountering issues with associating VMs to both a DCR and DCE? You cannot associate both DCR and DCE in the same association, a single association can reference either a DCR or DCE, but not both. Choose one based on your monitoring needs.
My advice is deploy the DCE at first
resource dce 'Microsoft.Insights/dataCollectionEndpoints@2022-06-01' = {
name: 'my-dce'
location: location
properties: {
networkAcls: {
publicNetworkAccess: 'Enabled'
}
}
}
then deplot DCR
resource dcr 'Microsoft.Insights/dataCollectionRules@2022-06-01' = {
name: 'my-dcr'
location: location
properties: {
dataCollectionEndpointId: dce.id
// Your rule definitions here
}
}
and at the end associate with VMs
resource vmAssociation 'Microsoft.Insights/dataCollectionRuleAssociations@2022-06-01' = {
name: 'vm-dcr-association'
scope: virtualMachine
properties: {
dataCollectionRuleId: dcr.id
}
}
Something like that...
Verify your API version is current (2022-06-01 is recommended, but I'm not sure for 100%), check that all resources are in the same region, for private links, ensure network permissions are configured.
Use Azure CLI to validate existing associations
az monitor data-collection rule association list --resource-group YourRG
Best regards,
Alex
P.S. If my answer help to you, please Accept my answer