Give Presence.Read.All permission for continuous-running scripts

SATO Yusuke 21 Reputation points


  • I am writing a script that records our staff's presence in Office365 to assist attendance management.
  • The script uses Microsoft Graph REST API (GET /users/{id}/presence) to get one's presence.
  • The script runs from Task Scheduler periodically with the Run whether user is logged on or not option.
  • The script runs continuously, so I think I have to register this script to Azure Active Directory so that the script can update the access token to call Microsoft Graph REST API. ## Problem

To test This script, I am using Microsoft 365 developer instant sandbox. When I register the script to Azure Active Directory and request API permissions, I have selected "Application permissions" because the script runs in the background. But with this selection, I could not select the "Presence.Read.All" permission.

The permission "Presence.Read.All" is permission is required from the "GET /users/{id}/presence" API endpoint.

You can select the Presence.ReadWrite.All permission, but I cannot use this permission because it requires Admin consent (I am not an administrator of Azure AD of our company). Also, I don't want to use this permission to avoid additional security risks. The script reads one's presence but doesn't modify it, so the Presence.Read.All permission is enough for the script.

You can select the Presence.Read.All permission when you select Delegated permissions, but I think this option is not suitable for the script because it runs even if I have logged out from Windows.


How can I give minimum requisite permissions to a continuous-running script that uses GET /users/{id}/presence API endpoint?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,026 questions
0 comments No comments
{count} votes

1 additional answer

Sort by: Most helpful
  1. awijekoon 710 Reputation points Microsoft Vendor

    @SATO Yusuke Get User Presence API with Application Permission now available in Graph v1.0.
    for more details See this comment The Graph API change log and documentation is not yet updated. If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    0 comments No comments