Testing Azure functions locally for Microsoft Graph API change notifications

Newbie Dev 156 Reputation points
2021-12-20T12:08:54.377+00:00

I am trying out Microsoft Graph API Change Notification(for users) in Azure Function. There are 2 endpoints in my Azure function solution,

Timer Function : Create subscription with Graph API
Http Trigger Function : which validates and receives notification from Graph API.
I created a self-signed certificate and exposed the http trigger functions via https, so it is now of the format "https://locahost:port number/notification".

But when I try to create the subscription I am getting error "Code: InvalidRequest Message: Unable to connect to the remote server".

Is it not enough to make the notification endpoint https? Would graph API not accept localhost?

I there a better way of testing it locally?

Thanks in advance.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,911 questions
Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. MikeUrnun 9,777 Reputation points Moderator
    2021-12-20T20:30:19.95+00:00

    Hello @Newbie Dev

    I believe it is because the https://locahost:port number/ is not a publicly exposed URL. In order for Webhooks flow to work the way you want, you'll need to expose a public IP from your local network, and use it to construct a Webhook URL to receive notification-related requests from Azure.

    However, instead of Webhooks, a much better approach looks to me is to use Azure Event Hubs for facilitating the notifications, check out the following doc: Get change notifications delivered in different ways

    And as for converting your HTTP Triggered function to Even Hub triggered one: Azure Event Hubs trigger for Azure Functions

    I hope this is helpful, let me know if any further queries!

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.