How to send custom logs to Azure Log Analytics in Azure Synapse Analytics workspace with Managed Identity authentication?

Liang Chen 1 Reputation point Microsoft Vendor
2024-04-10T09:42:12.92+00:00

Hi Azure Community,

I want to send custom logs to Azure Log Analytics in Azure Synapse Analytics Notebook with Managed Identity authentication. I was following this tutorial to do so, but the authencation method in this tutorial focuses on Service Principal instead of Managed Identity. May I ask if there is a way that I can send custom logs to Log Analytics in Synapse Notebook with Managed Identity authentication? Thanks in advance!!

Below is the error message I got when trying the sample codes in the above tutorial:
dew1

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,812 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Amira Bedhiafi 15,676 Reputation points
    2024-04-10T11:12:32.6666667+00:00

    Based on this old thread :

    It's important to understand that Managed Identity feature in Azure is ONLY relevant when, in this case, the App Service is deployed. This would mean you would probably want to use DefaultAzureCredential() from the Azure.Identity library which is compatible both when running locally and for the deployed web app. This class will run down the hierarchy of possible authentication methods and when running locally I prefer to use a service principal. Run the following in Azure CLI to create a service principal: az ad sp create-for-rbac --name localtest-sp-rbac --skip-assignment. You then add the service principal localtest-sp-rbac in the IAM for the required Azure services. I recommend reading this article for more information and how to configure your local environment: https://learn.microsoft.com/en-us/azure/developer/python/configure-local-development-environment You can see the list of credential types that DefaultAzureCredential() goes through in the Azure docs.

    More links to help :

    https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/TROUBLESHOOTING.md

    https://stackoverflow.com/questions/75464358/managedidentitycredential-authentication-unavailable-when-running-from-visual-st

    https://stackoverflow.com/questions/72560109/managedidentitycredential-authentication-unavailable-no-managed-identity-endpoi

    0 comments No comments