1
votes

We are going to have an application that is going to create subscriptions across different tenants so we will receive notifications when Users are updated in AAD. The documentation for Subscriptions and Users has not been posted yet but the other Webhook notification sample(s) do not include any tenant information. Is there any guidance for Webhooks and multi-tenant notifications?

1
The documentation does mention this: "Client must store the subscription ID to correlate a notification with the corresponding subscription." So I guess when you create the subscription in each tenant you store the id next to the tenant id of the tenant that just started using your app. Then you can use the subscription id to figure out which tenant it is?juunas

1 Answers

1
votes

Based on the documentation, you can use the subscription id to correlate it to a tenant:

Client must store the subscription ID to correlate a notification with the corresponding subscription.

Webhook notification includes the subscription id:

{
  "value":[
  {
    "subscriptionId":"<subscription_guid>",
    "subscriptionExpirationDateTime":"2016-03-19T22:11:09.952Z",
    "clientState":"SecretClientState",
    "changeType":"Created",
    "resource":"Users/{user_guid}@<tenant_guid>/Messages/{long_id_string}",
    "resourceData":
    {
      "@odata.type":"#Microsoft.Graph.Message",
      "@odata.id":"Users/{user_guid}@<tenant_guid>/Messages/{long_id_string}",
      "@odata.etag":"W/\"CQAAABYAAADkrWGo7bouTKlsgTZMr9KwAAAUWRHf\"",
      "id":"<long_id_string>"
    }
  }
  ]
}

So when a tenant starts using your app and you create the subscription in their tenant, record the subscription id with the id of the tenant and store those in a database.