Log Analytics agent with VMSS: invalid Workspace key and invalid Workspace Id

Dusan 1 Reputation point
2022-10-28T13:57:58.807+00:00

I found in documentation this example and I even hard coded the values so I don't have wrong something, but still getting this error:
link to doc: https://learn.microsoft.com/en-us/azure/azure-monitor/agents/resource-manager-agent?tabs=bicep

VM has reported a failure when processing extension 'Microsoft.Insights.LogAnalyticsAgent'. Error message: \"The configuration was not valid. Please validate the workspaceId is in the PublicSetting field, and the workspaceKey is in the PrivateSetting field. Both fields are case-sensitive. (MMAEXTENSION_ERROR_INVALIDCONFIG)

This is my code:

resource vmss 'Microsoft.Compute/virtualMachineScaleSets@2022-03-01' = {
name: vmssName
location: location
tags: tags

  extensionProfile: {  
    extensions: [  
      {  
        name: 'DependencyAgentWindows'  
        properties: {  
          autoUpgradeMinorVersion: true  
          publisher: 'Microsoft.Azure.Monitoring.DependencyAgent'  
          type: 'DependencyAgentWindows'  
          typeHandlerVersion: '9.10'  
        }  
      }  
      {  
        name: 'Microsoft.Insights.LogAnalyticsAgent'  
        properties: {  
          autoUpgradeMinorVersion: true  
          publisher: 'Microsoft.EnterpriseCloud.Monitoring'  
          type: 'MicrosoftMonitoringAgent'  
          typeHandlerVersion: '1.0'  
          settings: {  
           wokspaceId: workspaceId // 625e7dc0-54c8-4f6e-ac94-9805cb4e5ee2  
          }  
          protectedSettings: {  
            workspaceKey: protectedSettings // PJWmnkRHFqfA03YwpVSCUh2ocmC/O34YZFwVSjjw93+ShyFxHl43JDSjqLn7FdfDCDFXVQ6JH8ZAM44YIDn60A==  
          }      
        }  
      }  
    ]  
  }  
}  

}
}

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,196 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. KarishmaTiwari-MSFT 18,527 Reputation points Microsoft Employee
    2022-10-29T09:21:43.37+00:00

    @Dusan

    1. I am seeing a typo in the settings
      wokspaceId: workspaceId
      Could that be the issue?
    2. workspaceId and workspaceKey are case-sensitive. So double check both to ensure that's not the issue.

    Let me know the results and I can further investigate.

    0 comments No comments