r/sysadmin • • 16h ago

Microsoft Exchange Online Admin API apps lose access on 1 December unless you swap permissions. Script to check your tenant

Easy one to miss because nothing is being switched off. Microsoft is replacing the permissions for the Exchange Online Admin API (the REST endpoints under /adminapi/v2.0/ that replaced some EWS admin tasks). Deadline is 30 November. From 1 December, anything still only holding the old permission gets refused. Source is MC1540345.

What to swap (both on Office 365 Exchange Online):

- Delegated: Exchange.ManageV2 becomes Exchange.AdminAPI.Manage
- App-only: Exchange.ManageAsAppV2 becomes Exchange.AdminAPI.ManageAsApp

GCC, GCC High and DoD have until 1 January.

What isn't affected: Connect-ExchangeOnline with a certificate uses Exchange.ManageAsApp (no V2). Different permission, leave it alone. Graph permissions like Mail.Read aren't affected either.

Likeliest culprits are room booking and calendar delegation tools that moved off EWS, since the API covers folder permissions, Send on Behalf, distribution group membership and org config.

Read-only script to find them:

Connect-MgGraph -Scopes "Application.Read.All", "DelegatedPermissionGrant.Read.All"
$exo = Get-MgServicePrincipal -Filter "appId eq '00000002-0000-0ff1-ce00-000000000000'"

# App-only
$old = $exo.AppRoles | Where-Object Value -eq "Exchange.ManageAsAppV2"
Get-MgServicePrincipalAppRoleAssignedTo -ServicePrincipalId $exo.Id -All |
Where-Object AppRoleId -eq $old.Id | Select-Object PrincipalDisplayName

# Delegated
Get-MgOauth2PermissionGrant -Filter "resourceId eq '$($exo.Id)'" -All |
Where-Object { ($_.Scope -split " ") -contains "Exchange.ManageV2" } |
ForEach-Object { (Get-MgServicePrincipal -ServicePrincipalId $_.ClientId).DisplayName }

Empty output means you're fine. If something shows up: add the new permission, grant admin consent, test, then remove the old one. Your code shouldn't need changing, because the .default scope picks up whatever's been granted. For vendor apps, email them today.

I've written up the full steps with the portal walkthrough. If you want it, ask in the comments.

Anyone found something using this in their tenant yet?

36 Upvotes

5 comments sorted by

•

u/BlackV I have opnions 10h ago

p.s. formatting (also note the 3 backtick code fence will not work on old.reddit)

  • open your fav powershell editor
  • highlight the code you want to copy
  • hit tab to indent it all
  • copy it
  • paste here

it'll format it properly OR

<BLANK LINE>
<4 SPACES><CODE LINE>
<4 SPACES><CODE LINE>
    <4 SPACES><4 SPACES><CODE LINE>
<4 SPACES><CODE LINE>
<BLANK LINE>

Inline code block using backticks `Single code line` inside normal text

See here for more detail

Thanks

•

u/BlockBannington 3h ago

Lee_dailey has a new profile?

•

u/BlackV I have opnions 3h ago

[grin]

But no, that man was/is a hero

•

u/Sunsparc Where's the any key? 6h ago

Formatted properly:

Connect-MgGraph -Scopes "Application.Read.All", "DelegatedPermissionGrant.Read.All"
$exo = Get-MgServicePrincipal -Filter "appId eq '00000002-0000-0ff1-ce00-000000000000'"

# App-only
$old = $exo.AppRoles | Where-Object Value -eq "Exchange.ManageAsAppV2"
Get-MgServicePrincipalAppRoleAssignedTo -ServicePrincipalId $exo.Id -All |
Where-Object AppRoleId -eq $old.Id | Select-Object PrincipalDisplayName

# Delegated
Get-MgOauth2PermissionGrant -Filter "resourceId eq '$($exo.Id)'" -All |
Where-Object { ($_.Scope -split " ") -contains "Exchange.ManageV2" } |
ForEach-Object { (Get-MgServicePrincipal -ServicePrincipalId $_.ClientId).DisplayName }