Why when I upload an Api permission via Powershell to AzureAd I get only the Id?

Lorenzo Cacciola 1 Reputation point
2022-03-31T08:13:43.733+00:00

I'm trying to upload some api permission to my app registration in Azure, but I don't get why for some the process work and for others no.

188673-azureapipermission.png

$svcGraph = Get-AzureADServicePrincipal -All $true | ? { $_.DisplayName -eq "Microsoft Graph" }  
  
$Graph = New-Object -TypeName "Microsoft.Open.AzureAD.Model.RequiredResourceAccess"  
$Graph.ResourceAppId = $svcGraph.AppId  
  
$delPermission1 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "df021288-bdef-4463-88db-98f22de89214","Scope"  
  
$delPermission2 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "e1fe6dd8-ba31-4d61-89e7-88639da4683d","Scope"  
  
$Graph.ResourceAccess = $delPermission1, $delPermission2  
  
Set-AzureADApplication -ObjectId $MyAppObjectId -RequiredResourceAccess $Graph  

User.read (delPermission2) work, but User.Read.All (delPermission1) don't, and I don't understand why.

I tried multiple permission, but just User.read worked, here are the id and value:

741f803b-c850-494e-b5df-cde7c675a1ca User.ReadWrite.All

83cded22-8297-4ff6-a7fa-e97e9545a259 Presence.ReadWrite.All

810c84a8-4a9e-49e6-bf7d-12d183f40d01 Mail.Read

Windows for business | Windows Server | User experience | PowerShell
Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Graph
Microsoft Security | Microsoft Entra | Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Mehtab Siddique (MINDTREE LIMITED) 971 Reputation points
    2022-04-01T04:51:47.113+00:00

    Hi @Lorenzo Cacciola , Can you please check if you are using the correct ID's for the permissions for uploading via powershell to azure AD.
    Please refer this Document for getting to know on how to assign more permissions to azure AD via powershell.

    0 comments No comments

  2. Limitless Technology 40,081 Reputation points
    2022-04-06T11:02:40.99+00:00

    Hi @Lorenzo Cacciola

    You might need to have a look at the Microsoft Graph permissions reference. If only Id is visible it might be due to the different Access scenarios on the Group resource.

    As a best practice, request the least privileged permissions that your app needs in order to access data and function correctly. Requesting permissions with more than the necessary privileges is poor security practice, which may cause users to refrain from consenting and affect your app's usage.

    The below article shows the permissions that an app needs to be able to perform specific operations required by the scenario. Note that in some cases the ability of the app to perform specific operations will depend on whether permission is an application or delegated permission.

    https://learn.microsoft.com/en-us/graph/permissions-reference

    Hope this resolves your Query!!

    --
    --If the reply is helpful, please Upvote and Accept it as an answer–

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.