How Can I Get the Shared Key from Log Analytics Workspace in a Python Runbook?

I'm trying to get the primary/shared key from a Log Analytics Workspace in a Python Runbook to use with the Log Collector API for Auth. I've searched everywhere yet can't find anything.

1 Answer

You can use RESTAPI calls to get the Shared Keys for Log Analytics Workspace in Azure Automation Runbook.

Get Shared Keys from Log Analytics Workspace

Use below RESTAPI call to fetch the Shared Key for Log Analytics Workspace in a Azure Automation Runbook. (Before calling API call you have to authenticate with your resources using AAD Oauth2)

# use POST method to get the Shared Key

MSDOC to access the logs from log analytics workspace

Steps to use API calls in python from MSFT stack.

Result

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest