0

I finished this tutorial https://learn.microsoft.com/en-us/graph/tutorials/azure-functions?tutorial-step=5 everything worked fine until i published my azure Functions in my Azure App. When i try to make the subscription i get this error "Subscription validation request failed. Notification endpoint must respond with 200 OK to validation request". When i test with ngrok i can create the subscription with no problems but when i replace NgrokURL value for my Azure function Url, not. Is that the right way to create the susbcription? Also i tried to create the subscription in Graph Explorer but i still get this message.

Clerk tes
  • 1
  • 3

1 Answers1

0

As the same question raised in MSFT Docs Q&A Forum and thanks to the Shwetachoudhary provided the solution that helps other community members:

In the following below code, content type must be text/plain.
body must include the validation token.

  1. CodeSamples asp .net mvc sample - Specifically look at the NotificationController.cs file In the method
    [HttpPost]  
    public async Task<ActionResult> Listen()  
    {
    if  (Request.QueryString["validationToken"]  !=  null)
    {
    var token =  Request.QueryString["validationToken"];
    return  Content(token,  "plain/text");
    }
  1. 'notificationUrl' must be able to respond to the request for validation. Make sure the validation token returns as plain/text as well. Refer to the Notification endpoint validation document provided by Microsoft.

  2. Try isolating the code and calling the same API with Postman or Graph Explorer and see the results.