I have defined a notification function to be suscribed to Graph:
public static class NotificationFunction
{
[FunctionName("NotificationFunction")]
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
string validationToken = req.Query["validationToken"];
log.LogInformation($"validationToken {validationToken}");
return new HttpResponseMessage(System.Net.HttpStatusCode.OK)
{
Content = new StringContent(validationToken, System.Text.Encoding.UTF8, "text/plain")
};
}
}
I try to add this notificationUrl in a Timer Function:
var subscription = new Subscription
{
ChangeType = "created,updated",
NotificationUrl = NotificationUrlValue,
Resource = "me/mailFolders('Inbox')/messages",
ExpirationDateTime = DateTimeOffset.Parse("2019-12-30T18:23:45.9356913Z"),
ClientState = "secretClientValue"
};
The NotificationUrlValue is the NotificationFunction URL and works fine If I test it, but when the Timer Trigger runs gets:
Code: InvalidRequest
Message: Subscription validation request failed. Must respond with 200 OK to this request.
In the Trigger function Monitor I don't see any call, maybe is a firewall problem? From which IP is invoking the NotificationUrl?