As the service principal is the identity that the Azure AD SCIM app service runs as it calls Microsoft Graph, you need to assign the service principal permissions required for your use case. You assign these permissions using the Azure CLI, which is a command-line tool that use to connect to Azure and execute administrative commands on Azure resources.
To assign permissions to the service principal, you need to complete the following tasks:
Install Azure CLI on your machine (if not already installed). For instructions, see Install the Azure CLI for Windows | Microsoft Docs.
Sign in to your tenant with Azure CLI using .
Open an administrative command prompt or PowerShell session and set assign permissions to the service principal for your use case.
Create an application in Azure AD and associate it with the certificate you generated in EmpowerID.
Install Azure CLI
If Azure CLI is not installed on your machine, please see Microsoft’s instructions for doing so here: Install the Azure CLI for Windows | Microsoft Docs. Once you install the CLI, sign in to your tenant with the Azure CLI using the credentials of a user with adequate permissions to execute the permissions script in Azure AD (owner at the tenant level).grant the service principal the appropriate access in Azure by running the permissions script shown in the Set Graph API Permissions section of this article.
Set Graph API Permissions
To set Graph API permissions, sign in to your tenant with the Azure CLI using the credentials of a user with adequate permissions to execute the script in Azure AD (owner at the tenant level) and then execute the script against the tenant. run the below script in either an administrative command prompt or PowerShell session. The script
Permissions follow the least-privilege principle and include the following for managing Azure Licenses:
Table 1: Permissions needed to manage Azure licenses in EmpowerID
Graph API / Permissions name | Access Granted by Permissions | Used By |
AuditLog.Read.All | Read audit log data | App Service Managed Identity |
Group.Read.All | Read group data | App Service Managed Identity |
GroupMember.ReadWrite.All | Read and write group memberships | App Service Managed Identity |
User.Read.All | Read user profile | App Service Managed Identity |
Reports.Read.All | Read report data | App Service Managed Identity |
Organization.Read.All | Read organization information | App Service Managed Identity |
Policy.Read.lAll | ||
Policy.ReadWrite.ConditionalAccess | ||
Domain.Read.All |
In addition to adding the permissions, you need to enter values for the below parameters:
webApp — Name of the app service you created for the Azure AD SCIM microservice
When running the script, be sure to authenticate to Azure as a user with adequate permissions to execute it in Azure AD (owner at the tenant level).
$webApp="<Web-App-Name>" $sprincipal_id=$(az resource list -n $webApp --query [*].identity.principalId --out tsv) $graphResourceId=$(az ad sp list --display-name "Microsoft Graph" --query [0].objectId --out tsv) $uri="https://graph.microsoft.com/v1.0/servicePrincipals/$sprincipal_id/appRoleAssignments" $PermissionsToAdd = @("RoleManagement.ReadWrite.Directory","Directory.ReadWrite.All","Organization.Read.All", "User.Read.All", "Group.Read.All", "GroupMember.ReadWrite.All", "Reports.Read.All", "AuditLog.Read.All","Policy.Read.All","Policy.ReadWrite.ConditionalAccess","Application.Read.All","Domain.Read.All") $PermissionsToAdd | foreach { $appRoleId=$(az ad sp list --display-name "Microsoft Graph" --query "[0].appRoles[?value=='$($_)' && contains(allowedMemberTypes, 'Application')].id" --output tsv) $body="{'principalId':'$sprincipal_id','resourceId':'$graphResourceId','appRoleId':'$appRoleId'}" az rest --method post --uri $uri --body $body --headers "Content-Type=application/json" }