Unable to find log analytics workspace key

Mike 45 Reputation points
2025-12-09T20:42:30.3666667+00:00

The Logic App send data action requires the Log Analytics workspace key. Workspace keys are no longer visible in the Azure portal. I found this information, The “Primary Key” and “Secondary Key” fields were part of the older Log Analytics Agent (MMA) configuration model. With the introduction of the Azure Monitor Agent (AMA), the authentication mechanism has changed: but it doesn't address what to do in this case.

I tried using the Get-AzOperationalInsightWorkspaceSharedKeys command in Cloud Shell, but it failed stating that it couldn't find the Resource Group, even though I used the same Resource Group name that was returned with the command Get-AZOperationalInsightsWorkspace.

Any suggestions?

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
{count} votes

2 answers

Sort by: Most helpful
  1. Pravallika KV 3,565 Reputation points Microsoft External Staff Moderator
    2025-12-09T21:47:32.49+00:00

    Hi Mike,

    Thanks for reaching out to Microsoft Q&A.

    I have tested the same in Portal(Azure Bash/Azure Powershell) and got the same error.

    As discussed over offline, you need to run below PowerShell command in local Terminal to fetch Log Analytics workspace shared keys:

    Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName "ResourceGroup" -Name "Workspace"
    

    Or you can also use below command to fetch Log Analytics workspace keys in azure cli locally:

    az monitor log-analytics workspace get-shared-keys --resource-group <ResourceGroup> --workspace-name <loganalyticsname> --query "{primaryKey: primarySharedKey, secondaryKey: secondarySharedKey}"
    

    I tried the same and able to fetch both Primary Key and Secondary Key of log analytics workspace as below:

    image

    Hope it helps!


    Please do not forget to click "Accept the answer” and Yes, this can be beneficial to other community members.

    User's image

    If you have any other questions, let me know in the "comments" and I would be happy to help you.

    1 person found this answer helpful.

  2. Mike 45 Reputation points
    2025-12-11T19:24:50.27+00:00

    Running the following commands (provided by Pravallika KV) in local Terminal displayed the shared keys.

    install-module -name Az -AllowClobber -Force

    Connect-AzAccount

    Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName "ResourceGroupName" -Name "WorkspaceName"

    0 comments No comments

Your answer

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