Getting error message "Invoking Azure function failed with HttpStatusCode - Unauthorized"

Shaarang 0 Reputation points
2024-09-20T15:01:12.1766667+00:00

I have a synapse pipeline which contains a single component, an azure function activity component.

The objective is to send a test JSON payload to a private endpoint using POST call.

The azure function activity is configured to use the POST method and an azure function linked service has also been specified in the activity.

We have a function app in premium plan, the linked service is pointing to the function app.

Inside the function app, we have function which contains the main python code that makes the request.

Function app stack is python and the function created inside is an HTTP trigger using V2 programming model and the authorization level selected is Function.

When I debug the pipeline I am getting the error message Invoking Azure function failed with HttpStatusCode - Unauthorized.

Please support in resolving this. Thanks

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,029 questions
Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,936 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Vinodh247 21,881 Reputation points
    2024-09-21T06:49:27.95+00:00

    Hi Shaarang,

    Thanks for reaching out to Microsoft Q&A.

    Function Key:

    • Since your function's authorization level is set to "Function", you need to provide a function key when calling it.
    • Make sure the Azure Function Linked Service in your Synapse pipeline is configured with the correct function key.
    • In Synapse, ensure that this key is passed as a header with the key "x-functions-key" and the value set to the copied function key.

    Linked Service Configuration:

    • Double-check the Azure Function Linked Service configuration in Synapse.
    • Ensure the function app name, function name, and function key are all correct.

    Managed Identity:

    • If you're using MI for authentication, make sure it's properly configured and has the necessary permissions to invoke the function.

    Network Security:

    • Since you mentioned a private endpoint, ensure that the Synapse workspace has the necessary network access to the Function App's private endpoint.
    • Since you're using a private endpoint, ensure that the Synapse workspace has the necessary network configurations to communicate with the Azure Function App through its private endpoint.
    • Make sure that the Private DNS Zone is set up correctly, and that the Synapse pipeline can resolve the function app's private endpoint URL. Verify that the Managed Private Endpoint for Synapse to the Function App is approved and in a healthy state.

    Function App Configuration:

    • Check if there are any IP restrictions or authentication rules in the Function App that might be blocking the request from Synapse.

    Please 'Upvote'(Thumbs-up) and 'Accept' as an answer if the reply was helpful. This will benefit other community members who face the same issue.

    0 comments No comments

Your answer

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