question

SebSeb-1554 avatar image
0 Votes"
SebSeb-1554 asked SebSeb-1554 commented

BICEP - MicrosoftMonitorAgent invalid typehandler

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-virtual-machinesazure-monitor
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

stan avatar image
0 Votes"
stan answered stan edited

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.


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @stan !

Thanks for your answer but as mentionned i also tests with '1.0' and the behavior is the same i also deployed manually the agent on a vm and export the template to arm/bicep and the typehandler is 1.0 but...when deploying using bicep i'm still facing the issue.

0 Votes 0 ·
stan avatar image stan SebSeb-1554 ·

Are you getting the same error when typeHandlerVersion: '1.0' is used? As I have said I am constantly using this deployment with those values and there are no issues so either there is something specific in your input that is causing the error or some small issue in the code.

0 Votes 0 ·
SebSeb-1554 avatar image
0 Votes"
SebSeb-1554 answered SebSeb-1554 commented

@stan yes very strange behavior.

A new one after another new test :
197792-sample.png



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

sample.png (94.7 KiB)
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

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. I will add this reply to the original answer as well in case I am correct so you can mark it as answer

0 Votes 0 ·

For sure both vm are in the same region, same subscription, same RG==> same location i'll try other things and maybe raise a support ticket if it still doesn't work.

Thanks for your advices !

0 Votes 0 ·
stan avatar image stan SebSeb-1554 ·

You basically have issue like this: https://docs.microsoft.com/en-us/answers/questions/588466/no-version-found-in-the-artifact-repository-that-s.html. The extensions are located on some storages/repositories in that region. Could be that one of those repositories have some issues and because things are distributed one of the VMs takes it from healthy repository and the other does not. If possible still mark my reply as answer as the question on type handler version was answered and the rest of issue is in the scope of Azure Support.

0 Votes 0 ·
Show more comments