← All posts

Stop refreshing the Intune portal: Teams notifications for EPM elevation requests with Microsoft Graph and Power Automate

13 min read

Endpoint Privilege Management (EPM) is one of the best things to happen to the "nobody should be a local admin" discussion in a long time. The support-approved elevation type works especially well: users run as standard users, and when they need to elevate something that isn't covered by a rule, they send a request that IT reviews.

The problem is on the admin side. Intune doesn't really tell you that someone is waiting. There's no push notification, no Teams message and no useful alert. You find out when you open Endpoint security > Endpoint Privilege Management > Elevation requests, or when the user calls the service desk to ask why nothing is happening. The user side isn't much better.

The good news is that elevation requests are available in Microsoft Graph. If Graph can read something, Power Automate can act on it. In this post I'll go through a flow that:

  1. Checks for new pending EPM elevation requests every 15 minutes
  2. Posts a summary card for each request to a Teams group chat for the admins
  3. Watches the request until someone approves or denies it in the Intune portal
  4. Updates the admin card and sends the end user a Teams message with the decision and the reviewer's justification

At the end I'll show how the same setup can be extended to a multi-admin approval (four-eyes) process.


Why bother? The gaps in the native experience

Here is how the support-approved process works today, according to Microsoft's documentation:

That leaves three gaps:

Teams solves all three. Admins are already there, users are already there, and an Adaptive Card can hold all the context you need.


The building block: elevation requests in Microsoft Graph

Elevation requests are exposed through the privilegeManagementElevationRequest resource in Graph beta. These are the support-approved requests that end users submit and admins act on.

GET  https://graph.microsoft.com/beta/deviceManagement/elevationRequests
GET  https://graph.microsoft.com/beta/deviceManagement/elevationRequests/{id}
POST https://graph.microsoft.com/beta/deviceManagement/elevationRequests/{id}/approve
POST https://graph.microsoft.com/beta/deviceManagement/elevationRequests/{id}/deny

Each object contains what you need for a useful notification:

Property What it gives you
requestedByUserPrincipalName Who asked. This is also where the user notification goes
deviceName Which device
requestJustification The user's reason
applicationDetail File name, path, hash, publisher, product name and version
requestCreatedDateTime / requestExpiryDateTime When the request was created and when it expires
status The current state: none, pending, approved, denied, expired, revoked, completed
reviewCompletedByUserPrincipalName / reviewerJustification Who decided, and why

Permissions: reading requests works with the application permission DeviceManagementConfiguration.Read.All. Approving or denying through Graph requires DeviceManagementConfiguration.ReadWrite.All. For the notification-only flow, Read.All is enough. Keep that in mind when we get to multi-admin approval.

⚠️ This is a /beta endpoint. Microsoft supports the Intune beta APIs, but they change more often than v1.0. At the time of writing, beta is the only option for elevation requests, so build with that in mind and keep an eye on the flow's run history.


Prerequisites


The flow, step by step

First part of the flow

1. Recurrence: every 15 minutes

The trigger is a plain Recurrence set to 15 minutes. You could use 5 minutes, but 15 is a reasonable balance between response time and the number of runs.

2. Initialise variables

I set up the state that the loop uses later:

Variable Type Purpose
elevationStatus String Current status of the request we're watching
elevationJustification String The reviewer's justification once a decision is made
pollCount Integer Safety limit for the polling loop

3. Graph HTTP: get pending elevation requests

An HTTP action with Active Directory OAuth authentication (tenant ID, client ID, certificate or secret, audience https://graph.microsoft.com):

GET https://graph.microsoft.com/beta/deviceManagement/elevationRequests?$filter=status eq 'pending'

Only requests from the last 15 minutes are relevant, so filter on requestCreatedDateTime. Either add it to the $filter or use a Filter array after parsing:

@and(
  equals(item()?['status'], 'pending'),
  greaterOrEquals(item()?['requestCreatedDateTime'], addMinutes(utcNow(), -15))
)

Tip: test $filter support in Graph Explorer first. Beta endpoints don't always support every filter combination, and Filter array in the flow always works.

4. Parse JSON

Run the call once in Graph Explorer, paste the response into Generate from sample, and you get properly typed dynamic content for the rest of the flow.

5. Apply to each: one pass per request

Everything below runs once for each pending request.

5a. Post an Adaptive Card to the admin group chat

I use Post adaptive card and wait for a response (Teams connector, posted as Flow bot) to the admin group chat. The card holds everything an admin needs to make a decision without opening five blades in the portal:

{
  "type": "AdaptiveCard",
  "version": "1.4",
  "body": [
    { "type": "TextBlock", "size": "Large", "weight": "Bolder", "text": "🔐 New EPM elevation request" },
    { "type": "FactSet", "facts": [
      { "title": "User",          "value": "@{items('Apply_to_each')?['requestedByUserPrincipalName']}" },
      { "title": "Device",        "value": "@{items('Apply_to_each')?['deviceName']}" },
      { "title": "File",          "value": "@{items('Apply_to_each')?['applicationDetail']?['fileName']}" },
      { "title": "Publisher",     "value": "@{items('Apply_to_each')?['applicationDetail']?['publisherName']}" },
      { "title": "Product",       "value": "@{items('Apply_to_each')?['applicationDetail']?['productName']} @{items('Apply_to_each')?['applicationDetail']?['productVersion']}" },
      { "title": "Justification", "value": "@{items('Apply_to_each')?['requestJustification']}" },
      { "title": "Expires",       "value": "@{items('Apply_to_each')?['requestExpiryDateTime']}" }
    ]},
    { "type": "TextBlock", "wrap": true, "isSubtle": true,
      "text": "File hash: @{items('Apply_to_each')?['applicationDetail']?['fileHash']}" }
  ],
  "actions": [
    { "type": "Action.OpenUrl", "title": "Open in Intune",
      "url": "https://intune.microsoft.com/#view/Microsoft_Intune_Workflows/SecurityManagementMenu/~/epm" },
    { "type": "Action.Submit", "title": "I'm on it" }
  ]
}

Because I use the wait for a response variant, one admin claims the request before the flow starts watching it, and everyone in the chat can see who picked it up. If you don't want a claim step, use Post card in a chat or channel instead. Both actions return a message ID that you can use to update the card later.

The publisher and hash are the most useful fields on the card. An empty publisher (unsigned binary) or an unexpected path such as %TEMP% or Downloads should make the admin look more closely before approving.

5b. Reset the variables

For every iteration I reset elevationStatus, elevationJustification and pollCount. Variables in Power Automate are global to the run, so without the reset, request #2 starts with the values left over from request #1.

5c. Do until: wait for a decision

This is where the flow waits for an admin to act. The admin decides in the Intune portal, and the flow checks the request once a minute to see whether the status has changed.

Inside the loop:

  1. Get current request: a Graph call that fetches the latest version of this particular request (GET …/elevationRequests/{id}, or list and filter on the ID)
  2. Parse JSON and Filter array to isolate the request
  3. Set variable elevationStatus to the current status, and elevationJustification to reviewerJustification
  4. Condition: if the status is still pending, Delay 1 minute. If it isn't, continue so the loop can exit
  5. Increment pollCount

The Delay 1 minute step only checks whether the request has moved from pending to approved or denied before the flow continues. Nothing else happens there. It keeps the flow from polling Graph in a tight loop.

The exit condition should cover more than the status:

@or(
  not(equals(variables('elevationStatus'), 'pending')),
  greaterOrEquals(variables('pollCount'), 720)
)

Two things to watch:

5d. Condition: approved or denied?

When the loop exits, a condition checks elevationStatus.

Approved (true):

  1. Update an adaptive card in a chat or channel: replace the admin card with a short summary, for example "✅ Approved by admin@contoso.com – 'Known vendor, needed for project X'". The chat then works as a simple audit trail.
  2. Post card in a chat or channel to the requesting user (Flow bot → chat with requestedByUserPrincipalName). Say that the request was approved, include the admin's justification, and explain how to use it: right-click → Run with elevated access, valid for 24 hours, and the device may need a few minutes to sync.

Denied (false):

  1. Update the admin card to show "❌ Denied by …"
  2. Send the user a card with the denial and, most importantly, the reason. Native Intune doesn't notify the user on denial at all, so this message fills that gap. A sentence like "Contact the service desk if you believe this is wrong" saves everyone a round of confusion.

Prefer Outlook?

The process is the same in Outlook. Replace the Teams actions with Send an email (V2), or use Send email with options for simple button responses. Teams is my preference because the card can be updated afterwards, so the admin chat always shows the current status instead of a pile of emails.


Lessons learned and hardening


Taking it further: multi-admin approval for elevations

So far the decision is still made in the Intune portal, and the flow only handles notifications. Once Graph tells you about requests, though, the flow can also make the decision.

Graph has approve and deny actions on the elevation request, both accepting a reviewerJustification. That means you can move the decision into Power Automate and require more than one admin to approve.

The pattern

  1. The flow detects a new pending request, as before.
  2. Instead of a notification card, it starts Start and wait for an approval (Approvals connector) with the type Approve/Reject – Everyone must approve, assigned to two or more admins, or to a group of admins in sequence.
  3. If everyone approves:
    POST https://graph.microsoft.com/beta/deviceManagement/elevationRequests/{id}/approve
    Content-Type: application/json
    
    { "reviewerJustification": "Approved by alice@contoso.com and bob@contoso.com – <comments>" }
  4. If anyone rejects, call /deny with the rejecting admin's comment.
  5. Notify the user as before.

Make it risk-based

Not every request needs two people. Because applicationDetail is available in the flow, you can route requests based on risk:

Signal Route
Signed by a known, approved publisher Single approver
Unsigned / empty publisherName Two approvers
Path in Downloads, %TEMP% or a user profile Two approvers, including a security reviewer
The requester is an admin themselves Never approve themselves: remove them from the approver list

This puts your elevation policy into the flow itself.

Things to get right before you go live


Summary

EPM support-approved elevations work well technically, but the notification side is close to non-existent. Admins have to check the portal manually, denied users hear nothing, and approved users get a toast they probably won't notice. With one Graph endpoint, a small app registration and a Power Automate flow, you get:

Until Microsoft builds this into the product, this kind of Graph-based flow is a simple way to cover the gap.


References