In this section of the blog series, we’ll walk through the steps to create a Microsoft Graph subscription for Teams presence updates based on the Custom connector created on the previous post and configure a Power Automate flow to receive and process these updates through Azure Event Hub.
Step 1: Creating a Microsoft Graph Subscription for Teams Presence
Using the custom connector built in Part 1 of this blog series, initiate the Microsoft Graph subscription by calling the Create Subscription action

{
"changeType": "updated",
"notificationUrl": "EventHub:https:// yourazureeventhubinstancename.servicebus.windows.net/eventhubname/ youreventhubname?tenantId=techcloudtree.onmicrosoft.com",
"lifecycleNotificationUrl": "EventHub:https:// yourazureeventhubinstancename.servicebus.windows.net/eventhubname/ youreventhubname?tenantId=techcloudtree.onmicrosoft.com",
"resource": "communications/presences/0xxxx-your-xxx-objectid-xxxxxb",
"expirationDateTime": "2025-05-05T10:00:00.0000000Z"
}
When creating a Microsoft Graph subscription for Teams presence updates, make sure to update the following fields in your request payload:
- notificationUrl
URL where Microsoft Graph will send presence update notifications. This should point to your Azure Event Hub endpoint configured to receive events. - lifecycleNotificationUrl
URL to handle lifecycle events such as validation and subscription expiration. This should point to an endpoint capable of processing these system-level callbacks (optional but recommended). - resource
This defines the target of the subscription.
Format: /communications/presences/{userId}- Replace {userId} with the Object ID (GUID) of the Azure AD user whose presence updates you want to track.
- expirationDateTime
Timestamp defining when the subscription expires.- For presence, the maximum allowed duration is 1 hour.
- Use ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ

Tip: After the subscription is successfully created, make sure to note down the Subscription ID, as it is required to renew the presence subscription— which must be refreshed every hour. This renewal process can be automated using a scheduled Power Automate flow.
Step 2: Receiving Notifications via Azure Event Hub
Azure Event Hub serves as a high-throughput ingestion pipeline for Microsoft Graph notifications. After the subscription is created, presence change events are pushed into the specified Event Hub.
Each event includes metadata such as the subscription ID, resource details containing user information, and a timestamp—enabling you to respond effectively to presence status changes in real time.

As seen in the payload above, user availability or activity changes in Microsoft Teams are not directly visible—this data is encrypted. To access it, you’ll need to configure certificate-based encryption and decrypt the payload accordingly. We’ll cover this process in detail in the next blog post.
Step 3: Creating a Power Automate Flow to Process Presence Updates
Now that presence updates are routed into Azure Event Hub, we’ll use Power Automate to process these updates.
Steps to Configure:
- Trigger:
- Use the “When events are available in Event Hub” trigger (premium connector).

Create a New connection using the Authentication type Microsoft Entra ID Integrated

Namespace Endpoint: Example: sb://graphapichangenotification.servicebus.windows.net/
After the Connection is created, you would be able to select the Event hub from the dropdown to complete the trigger configuration.
- Parse Event Data:
- Use a Parse JSON action to extract userId, subscriptionId, and changeType from the incoming event schema.
- You can get the payload which is in Base64 format by using the expression base64ToString(triggerOutputs()?[‘body/ContentData’])
- Act on Status Change:
- Act of the notification by making a another query to the presence endpoint or subscription to rich notications by using certificate which we will discuss in our next blog post
Note: Once the Power Automate flow is configured to receive events from the Event Hub, the Data Explorer in the Azure Portal will no longer display events, as the Event Hub allows only one active consumer per consumer group. There would be an Error message like: At least one receiver for the endpoint is created with epoch of ‘638819602939505217’, and so non-epoch receiver is not allowed.
What’s Next?
In the next part, we will explore how to receive rich presence notifications from Microsoft Teams users, including availability and activity details. Specifically, we will cover:
- How to configure certificate-based encryption to enable rich notifications
- How to retrieve availability information from the encrypted payload
Do you like this article?
Subscribe to my blog with your email address using the widget on the right side or on the bottom of this page to have new articles sent directly to your inbox the moment I publish them.
Do you like this article?
Subscribe to my blog with your email address using the widget on the right side or on the bottom of this page to have new articles sent directly to your inbox the moment I publish them.



