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

enter image description here

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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.

You Might Also Like