Forum Discussion

James1's avatar
James1
Brass Contributor
Aug 31, 2023

Teams Get presence application Permission

Hello everyone

 

Im trying to retrieve user presence information for our monitoring system. We want to use API calls.

 

We have set new application in Azure AD, set API delegate permissions for Presence.Read, Presence.Read.All and granted it for our directory.

 

After that Bearer token is generated:

POST https://login.microsoftonline.com/[directory_name]/oauth2/token

grant_type=client_credentials
client_id=[client_id]
client_secret=[client_secret]
resource=https://graph.microsoft.com

 

Then a presence request is made:

GET https://graph.microsoft.com/v1.0/users/[user_id]/presence

 

Response always is 403 (Forbidden). I've put Bearer token is both Authorization and Header (Bearer : [token]). Both return the same.

 

From what i've read in Microsoft docs, the Permission type: Application is Not Supported. Im very new to this, but does that means that Teams presence cannot be retrieved using Application created in Azure? If that is true, how then achieve Delegated permission?

Before we tried retrieve presence with Powershell, it worked great however it is not possible to use Modern Authentication. All other information can be provided.

Resources