Graph API - Insufficient privileges to complete the operation

前端 未结 9 1392
长情又很酷
长情又很酷 2020-12-09 01:37

When trying to access the Graph Service Client using I am receiving the error :

Code: Authorization_RequestDenied
Message: Insufficient privile

9条回答
  •  庸人自扰
    2020-12-09 02:16

    Grant permissions by ticking 'Directory.Read.All/ Write' is not enough.

    I run into the same issue. and solved by adding service principle to administrator role.

    If you application is created recently, this can be done Azure AD Powershell.

    $pricinple = Get-AzureADServicePrincipal || Where-Object {$_.DisplayName -eq 'youappname'}
    
     $role = Get-AzureADDirectoryRole | Where-Object {$_.displayName -eq 'Company Administrator'}
    
    Add-AzureADDirectoryRoleMember -ObjectId $role.ObjectId -RefObjectId $pricinple.ObjectId
    

    for detail, see https://docs.microsoft.com/en-us/powershell/module/Azuread/Add-AzureADDirectoryRoleMember?view=azureadps-2.0

    If you application was created long time ago, you will need to use MSOnline. see: https://docs.microsoft.com/en-us/powershell/module/msonline/Add-MsolRoleMember?view=azureadps-1.0

提交回复
热议问题