We have an Remote Event Receiver which is deployed in Azure and running for an SPO site.

It was running fine, but from yesterday, it is not working properly.

After a detailed investigation, we found an error from Application Insights.

Error Details:

ExecuteQuery threw following exception: System.Net.WebException: The remote server returned an error: (401) Unauthorized

Can anyone tell, what is happening here?

  • 1
    just one question, are u using app client id? Commented Mar 14, 2018 at 7:04
  • yes. That's correct. We are using Client id and Secret Id for authentication. Commented Mar 14, 2018 at 7:16

1 Answer 1


Could you please check as if your client id is expired or not. Generally this error can be found when the Client Secret Id got Expired. To get the end date of when the client secret will expire you have to query the application keys using the client Id. If the current secret id is expired then you have to remove the it and create a new one.

I thing this article will be helpful for to do the procedure.

Update: Because of some changes from Microsoft end, there is a new scenario which will not be resolved by the previous methodology. And the resolution is to add a key in the Azure Application Settings as provided bellow:

value: 0 

Here is the article which have described it elaborately with the reason of the issue.

Let me know if it works.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.