How to connect to Azure logic apps via managed identity

Debashis Jena 71 Reputation points

How to connect to Azure logic Apps from Azure function via managed identity ?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,506 questions
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,946 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sedat SALMAN 13,265 Reputation points


    steps :

    1. Assign a managed identity to the Azure Function.
    2. Grant the managed identity access to the Logic App.
    3. Obtain an access token for the managed identity within the Azure Function.
    from azure.identity import DefaultAzureCredential
    from azure.core.credentials import AccessToken
    def get_access_token() -> str:
        credential = DefaultAzureCredential()
        token: AccessToken = credential.get_token("")
        return token.token
    1. Call the Logic App using the access token.
    import requests
    def call_logic_app(logic_app_url: str, access_token: str):
        headers = {
            "Authorization": f"Bearer {access_token}",
            "Content-Type": "application/json"
        data = {
            # Your request data here
        response =, headers=headers, json=data)
        # Handle the response as needed
    0 comments No comments