I have a problem with a logic app calling an azure function app. Its failing with an Unauthorized error

Chris Crowhurst 0 Reputation points
2025-02-17T17:19:40.6766667+00:00

I have an azure logic app "logic-nats-test-func". It calls an azure function app called "func-assurityimport-nats-dev". It is displaying "Unauthorized" when it is run.

When it is run I can see the function running by looking in the Log Stream, but it always returns this :

{ "statusCode": 401, "headers": { "Date": "Mon, 17 Feb 2025 15:55:50 GMT", "WWW-Authenticate": "Bearer", "Request-Context": "appId=cid-v1:58850597-4e54-4d55-9584-88976280b385", "Content-Length": "0" } }

I don't have any bearer token authentication enabled. I also have a test function with the same app and that works fine. Both functions are using the same function signature :

        public async Task<HttpResponseData> HttpStartNATS(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequestData req)
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,529 questions
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,388 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Sai Prabhu Naveen Parimi 395 Reputation points Microsoft External Staff
    2025-02-20T16:37:19.97+00:00

    Chris Crowhurst

    It seems like you're encountering an "Unauthorized" error when running your Azure Logic App "logic-nats-test-func" which calls the Azure Function App "func-assurityimport-nats-dev". The error message indicates a missing valid access token.

    You've mentioned that adding the x-functions-key to the header didn't resolve the issue. Could you please confirm if you have tried invoking the function through Postman or curl with the function key? This will help determine if the issue is specific to the Logic App or if it persists across different methods of invocation.

    Your feedback on this matter would be greatly appreciated. Please let me know if this approach works or if you require further assistance.


  2. Sai Prabhu Naveen Parimi 395 Reputation points Microsoft External Staff
    2025-02-20T16:40:16.9866667+00:00

    [Duplicate]

    0 comments No comments

  3. RithwikBojja 790 Reputation points Microsoft External Staff
    2025-03-03T05:30:24.0033333+00:00

    Hi @Chris Crowhurst

    As an Alternative you try below approach if you are still facing this issue:

    enter image description here

    In place of Azure functions connector, you can simply use a Http calling connector which works same as postman and Azure functions connector also.

    Here, I had used POST method, in which I have got first part of url from http trigger and second part from Aure function keys as below:

    https://funcappname.azurewebsites.net/api/funcname?

    Then code=key :

    enter image description here

    Output:

    enter image description here

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.


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.