BICEP - MicrosoftMonitorAgent invalid typehandler

Cloudy 206 Reputation points
2022-04-29T09:36:06.13+00:00

Dear community,

I have the following bicep code :

resource VmName_MmaAgentName 'Microsoft.Compute/virtualMachines/extensions@2021-11-01'  = [for (customerData,i) in customersDatas: {
  name: '${customerData.customerName}-winsrv/MMAExtension'
  location: location

  properties: {
    autoUpgradeMinorVersion: true


    protectedSettings: {
      workspaceKey: log.listkeys().primarySharedKey
    }
    publisher: 'Microsoft.EnterpriseCloud.Monitoring'
    settings: {
      workspaceId: log.properties.customerId
      azureResourceId: resourceId('${rgEnv}', 'Microsoft.Compute/virtualMachines', '${customerData.customerName}-winsrv')

    }

    type: 'MicrosoftMonitoringAgent'
    typeHandlerVersion: '1.0.217.0' // az vm extension image list --location francecentral -p Microsoft.EnterpriseCloud.Monitoring -o table ==>none of the results working
  }
}]

Result is the following:

{
"code": "DeploymentFailed",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",
"details": [
{
"code": "InvalidParameter",
"message": "The value of parameter typeHandlerVersion is invalid."
},
{
"code": "InvalidParameter",
"message": "The value of parameter typeHandlerVersion is invalid."
}
]
}

But this is not working, tried different typeHandler version and syntaxes '1.0','1.*','1.0.217.0' and nothing works :(

I haven't any other idea to make it works...

Any help would be appreciated,

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,380 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,134 questions
0 comments No comments
{count} votes

Accepted answer
  1. Stanislav Zhelyazkov 25,321 Reputation points MVP
    2022-04-29T10:58:16.18+00:00

    Hi,
    type handler version should be '1.0'. It is not possible to use wild cards or to have specific build from version 1.0. Source. Should work with 1.0 as I have deployed it many times this way.

    Update: This means that the problem. It can be clearly seen due to deployment works for one of 2 VMs and that the error is completely different for the one that fails. the extension needs to be in the same region/location as the VM region/location. My wild guess is that the VMs are in two different regions and but the location is static value so for one of the VMs the location for the extension is not correct. If that is not the case I would advise you to open support ticket for this as probably there is some specific in your subscription or there is some current Azure issue that is unknown.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


1 additional answer

Sort by: Most helpful
  1. Cloudy 206 Reputation points
    2022-04-29T11:48:06.32+00:00

    @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'))]" } } ] }


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.