How can I make multiple subscriptions in the same tenant with microsoft graph?

TiagoC 20 Reputation points
2023-05-03T09:50:31.3166667+00:00

I have a scenario where I want to be able to make multiple subscriptions to Microsoft graph in the same tenant. But when I try to do so, even thought the resource of my post request is different from the first subscription, it will show me the following message:

"Status Code: Conflict; Reason: A subscripton already exists. It must be deleted before a another can be made."

Example:
This are the parameters I am using for my first subscription which is successful:

let presenceSubscriptionOptions = {
  method: "POST",
  url: "https://graph.microsoft.com/v1.0/subscriptions",
  headers: {
	"Content-Type": "application/json",
	Authorization: userToken,
  },
  data: JSON.stringify({
	changeType: "updated",
	clientState: "MyGraphExplorerSecretClientState",
	notificationUrl: notificationUrl,
	resource: "/communications/presences?$filter=id in ('70c5d24f-82b0-443f-8d7f-5acd754f2467','7287a48e-6f92-4cb2-ac8e-af236db330ae','90e78e73-4c99-44a6-8dcb-5616bbd24ce0','438a42cb-772d-44bc-95cc-cf63cdd78c93')",
	expirationDateTime: expirationDateTime,
  }),
};

This are the parameters I am using for my second subscription which is unsuccessful:

let presenceSubscriptionOptions = {
  method: "POST",
  url: "https://graph.microsoft.com/v1.0/subscriptions",
  headers: {
	"Content-Type": "application/json",
	Authorization: userToken,
  },
  data: JSON.stringify({
	changeType: "updated",
	clientState: "MyGraphExplorerSecretClientState",
	notificationUrl: notificationUrl,
	resource: "/communications/presences?$filter=id in ('70c5d24f-82b0-443f-8d7f-5acd754f2467','7287a48e-6f92-4cb2-ac8e-af236db330ae','0b167637-747c-420f-acb7-9830c1a35d3d','438a42cb-772d-44bc-95cc-cf63cdd78c93','90e78e73-4c99-44a6-8dcb-5616bbd24ce0')",
	expirationDateTime: expirationDateTime,
  }),
};

The change in both is a user id in the resource and the userToken.

Is the problem with my post request parameter? An azure AD configuration or something else?

Microsoft Security Microsoft Entra Microsoft Entra ID
Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. James Hamil 27,211 Reputation points Microsoft Employee Moderator
    2023-05-03T19:25:53.82+00:00

    Hi @TiagoC , unfortunately only one tenant can be associated with a single subscription. Unless I misunderstand your question, this can't be accomplished. Please let me know if you have any questions and I can help you further.

    If this answer helps you please mark it as "Verified" so other users can reference it.

    Thank you,

    James


1 additional answer

Sort by: Most helpful
  1. Alfredo Reza 0 Reputation points
    2023-05-04T14:38:28.9966667+00:00

    in this link a MS employee dont tell the same story, something changed???

    https://learn.microsoft.com/en-us/answers/questions/958845/creating-presence-subscription-for-more-than-650-u

    Sayali-MSFT1,621 Reputation points• Microsoft Vendor

    Aug 11, 2022, 9:40 AM

    @Prajakta Kenjale -Yes. You can create multiple subscription with different User Id.

    0 comments No comments

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.