Get-MgServicePrincipalSynchronizationJob fails with Status: Unauthorized for Application based Authentication.

Michael Hoffman 20 Reputation points

I am trying to create an automation using application permissions to get synchronization job status and am getting the following error "Get-MgServicePrincipalSynchronizationJob_Get: The server responded with a Request Error, Status: Unauthorized"

Debug output shows app only and scopes correctly.

DEBUG: [CmdletBeginProcessing]: - Get-MgServicePrincipalSynchronizationJob begin processing with parameterSet 'Get'.

DEBUG: [Authentication]: - AuthType: 'AppOnly', AuthProviderType: 'ClientCredentialProvider', ContextScope: 'Process', AppName: '****'.

DEBUG: [Authentication]: - Scopes: [Application.ReadWrite.OwnedBy, Application.ReadWrite.All, Directory.ReadWrite.All].

Any suggestions would be appreciated.

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

Accepted answer
  1. Andy David - MVP 138.6K Reputation points MVP

    Assign the Application to the "Hybrid Identity Administrator" Azure role as well.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful