@Stanislav Zhelyazkov yes very strange behavior. A new one after another new test : ![197792-sample.png][1] [1]: /api/attachments/197792-sample.png?platform=QnA As you can see the dpeloyment works good for one vm but not for the other one and still the same error. The deployed template is the following: { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "location": { "defaultValue": "[resourceGroup().location]", "type": "String" }, "rgEnv": { "type": "String" }, "customersDatas": { "type": "Array" }, "logAnalyticsWorkspaceName": { "type": "String" } }, "resources": [ { "type": "Microsoft.Compute/virtualMachines/extensions", "apiVersion": "2021-11-01", "name": "[format('{0}-winsrv/MMAExtension', parameters('customersDatas')[copyIndex()].customerName)]", "location": "[parameters('location')]", "properties": { "autoUpgradeMinorVersion": true, "protectedSettings": { "workspaceKey": "[listkeys(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, parameters('rgEnv')), 'Microsoft.OperationalInsights/workspaces', parameters('logAnalyticsWorkspaceName')), '2020-10-01').primarySharedKey]" }, "publisher": "Microsoft.EnterpriseCloud.Monitoring", "settings": { "workspaceId": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, parameters('rgEnv')), 'Microsoft.OperationalInsights/workspaces', parameters('logAnalyticsWorkspaceName')), '2020-10-01').customerId]", "azureResourceId": "[resourceId(format('{0}', parameters('rgEnv')), 'Microsoft.Compute/virtualMachines', format('{0}-winsrv', parameters('customersDatas')[copyIndex()].customerName))]" }, "type": "MicrosoftMonitoringAgent", "typeHandlerVersion": "1.0" }, "copy": { "name": "VmName_MmaAgentName", "count": "[length(parameters('customersDatas'))]" } } ] }