Azure function showing error as "The remote server returned an error: (401) Unauthorized."

chandrasekhar bheemuni 1 Reputation point

Dear All,

Recently we are seeing wired issue in Azure function and showing error as below highlighted. The purpose of the Azure function to install custom application in new site collection and it is executing from the MSO workflow. It is working fine from last 6 months and stopped working from last 3 weeks. showing log errors (see below log) when it is executing from flow or manual Function Test/Run.

In order to find the root cause of this issue we have verified below settings.

  • Function (user) account has enough permissions
  • Same function is working fine in UAT environment
  • Compared function app and function permissions in both production and UAT, both are looks good

Kindly review below log and let me know if I missed anything.

Your suggestions will much appreciated.

Error in Log:


Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
3,997 questions
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,152 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jerryzy 10,556 Reputation points

    Hi @chandrasekhar bheemuni ,

    From the error message, it specify the "token request failed", so I assume you have registered App Client Id/Secret for getting the token.

    And this function is working in UAT, permission also the same.

    so I think maybe the Client Secret is expired, you can check this point in your production environment.

    If this is no related to the issue, please test the C# code in a local console application to see if the error can be reproduce and check the detailed code line which throw the exception.

    Best Regards

    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments