By default, anyone running Connect-MgGraph authenticates through the Microsoft Graph Command Line Tools enterprise application, with all permissions consented on this single app. In large organizations, this centralized model quickly creates a granularity problem: the support service doesn't need the same rights as a compliance team or a global administrator. This article details how to create and use dedicated Entra ID applications to segment interactive access to the Microsoft Graph PowerShell SDK.
The Problem of the Default Application and Permission Drift
The Microsoft Graph Command Line Tools application works well for occasional administrative use, but it accumulates an increasing number of permissions consented by different teams over time. This permission creep phenomenon makes security reviews complex: it's impossible to know precisely who needs what, since everyone shares the same permission surface.
An organization that wants to apply the principle of least privilege must segment this access. Concrete example: the help desk needs to manage user accounts, groups, and devices, but must have no access to compliance data, audit logs, or tenant-wide security settings.
The Principle
Each registered application has its own set of Graph permissions and its own user/group assignments. The application becomes the unit of governance for interactive access, not the user account.
Default Enterprise Application or Dedicated Registered Application
The difference between the two approaches hinges on three axes: permission scope, ability to restrict assignments, and ease of periodic review.
| Criterion | Default Enterprise Application | Dedicated Registered Application |
|---|---|---|
| Application Used | Microsoft Graph Command Line Tools | App created and named by the tenant (e.g. HelpDeskGraphSDK) |
| Permission Scope | Broad, accumulated through consents | Limited to permissions strictly necessary for the team |
| User Assignment | Often open to all accounts | Restricted via a dedicated security group |
| Governance and Review | Difficult, permissions shared between teams | Periodic review possible application by application |
| Typical Use Case | Generalist administrators or automation scripts | Specialized teams: support, security, compliance |
Create a Dedicated Registered Application for the Graph PowerShell SDK
Creating a dedicated application is done entirely from the Entra portal, without needing a script for registration itself. Here's the complete sequence.
Register the Application in Entra ID
In the Entra admin center, App Registrations section, create a new application registration, give it an explicit name (e.g. HelpDeskGraphSDK) and register it. Assign at least one application owner and configure an icon for easier identification later.
Configure the Redirect URI
Open the application's Authentication tab. Under Redirect URI, choose Add Redirect URI then Mobile and desktop applications. The exact choice of value depends on the PowerShell version used by your teams (see the next section). Don't forget to click Configure to validate the addition.
Add Delegated Permissions and Consent
Add only the necessary delegated Graph permissions, for example Directory.Read.All and User.Read.All for a help desk, then grant admin consent. The application only works with delegated access: users remain limited to data they themselves are authorized to view. To manipulate tenant-wide objects (groups, reports, directory data), assigned accounts must also have the appropriate Entra roles.
Make Assignment Required
In Enterprise applications, find the app's service principal, open the Properties page and set Assignment required? to Yes. This toggle requires a user or group to be explicitly assigned before using the application.
Assign Authorized Users and Groups
Still in the enterprise application, open the Users and groups tab and add accounts or, preferably, a dedicated security group. Assignments apply to the service principal, as it's the one enforcing access control in the tenant.
Connect via the Dedicated Application
Once the application is configured, authorized users connect by specifying the tenant ID and application ID in Connect-MgGraph:
1Connect-MgGraph -TenantId mytenant.com -AppId a69635f3-3ac8-4949-a82b-f31b396de57bRepeat the entire procedure for each team requiring differentiated access to the Graph PowerShell SDK.
Don't Multiply Apps Indiscriminately
Each registered application must be managed over time. Plan a periodic review of the permissions granted to each one, otherwise you'll end up with the same permission drift as seen on the default application.
Redirect URI: The Classic Trap with WAM and PowerShell 7
Before WAM (Web Account Manager) support arrived in the Microsoft Graph PowerShell SDK, set to become the default behavior for all interactive sessions, the standard redirect URI was https://login.microsoftonline.com/common/oauth2/nativeclient. This value remains functional with PowerShell 5.1.
However, under PowerShell Core (7.x), WAM uses a different authentication flow, and the nativeclient URI causes an AADSTS50011 error. According to Microsoft documentation on Graph PowerShell SDK authentication commands, the correct configuration pairs http://localhost with a WAM broker redirect URI of the form ms-appx-web://Microsoft.AAD.BrokerPlugin/.

Check Before Any Deployment
If your teams still run scripts under Windows PowerShell 5.1 and PowerShell 7 in parallel, add both redirect URIs on the same application registration rather than creating two separate apps.
Assign and Verify User Access
The Get-MgServicePrincipalAppRoleAssignedTo cmdlet lists accounts with direct assignment on an application. The example below first retrieves the service principal ID via Get-MgServicePrincipal, then queries the assignments:
1$GraphSDKApp = Get-MgServicePrincipal -filter "displayname eq 'HelpDeskGraphSDK'"2 3$GraphSDKApp | Format-Table DisplayName, Id4 5# DisplayName Id6# -------------- --7# Help Desk Graph SDK 0c593b15-ec27-4481-9e12-31777c9f65038 9$Assignees = Get-MgServicePrincipalAppRoleAssignedTo -ServicePrincipalId $GraphSDKApp.Id10 11$Assignees | Format-Table CreatedDateTime, PrincipalDisplayName, AppRoleId12 13# CreatedDateTime PrincipalDisplayName AppRoleId14# --------------- -------------------- ---------15# 07/09/2026 09:04:54 Tenant Administrator 00000000-0000-0000-0000-00000000000016# 07/09/2026 09:03:00 Help Desk Graph SDK Access 00000000-0000-0000-0000-000000000000The ID 00000000-0000-0000-0000-000000000000 corresponds to the Default Access role, sufficient to use the application. You can also add a direct assignment by script with New-MgUserAppRoleAssignment:
1$SP = Get-MgServicePrincipal -filter "DisplayName eq 'HelpDeskGraphSDK'"2$DefaultRoleId = "00000000-0000-0000-0000-000000000000"3$User = Get-MgUser -UserId Kim.Akers@office365itpros.com4 5New-MgUserAppRoleAssignment -UserId $User.Id -AppRoleId $DefaultRoleId -PrincipalId $User.Id -ResourceId $SP.IdOnce connected via a dedicated application under Microsoft Graph PowerShell SDK V2.39 in PowerShell Core, the user has only the permissions consented to this app, for example User.ReadBasic.All. Note: this permission doesn't allow filtering on the UserType property, which will block attempts to search restricted to member accounts.

To remove an obsolete assignment, use the symmetric Remove-MgServicePrincipalAppRoleAssignedTo cmdlet after retrieving the exact assignment ID via Get-MgServicePrincipalAppRoleAssignedTo:
1$AssignmentId = ($Assignees | Where-Object PrincipalDisplayName -eq 'Kim Akers').Id2Remove-MgServicePrincipalAppRoleAssignedTo -ServicePrincipalId $SP.Id -AppRoleAssignmentId $AssignmentIdImplementation: Periodic Audit of Graph SDK Applications
Rather than manually checking each application, a regular audit script allows you to track assignments and consented permissions, and spot any drift.
Read-Only Script
The script below makes no modifications: it only queries the tenant. Any corrective action (removing a permission, deleting an assignment) must be validated manually before execution, as these operations could cut Graph access for legitimate users.
1# Prerequisites: Microsoft.Graph module (Applications and Identity.SignIns submodules)2# Installation: Install-Module Microsoft.Graph -Scope CurrentUser3# Minimum required permission: Application.Read.All (delegated) + Directory.Read.All4# Output: CSV file listing, for each dedicated Graph SDK application,5# the assigned accounts/groups and consented delegated permissions6 7Connect-MgGraph -Scopes "Application.Read.All", "Directory.Read.All" -NoWelcome8 9# Naming convention: adapt this pattern to your own Graph SDK applications10$AppNamingPattern = "*GraphSDK*"11 12$CustomApps = Get-MgServicePrincipal -All | Where-Object { $_.DisplayName -like $AppNamingPattern }13 14if (-not $CustomApps) {15 Write-Host "No applications matching the pattern '$AppNamingPattern' were found." -ForegroundColor Yellow16 return17}18 19$Report = foreach ($App in $CustomApps) {20 21 # Accounts and groups assigned to the application (Users and groups tab)22 $Assignees = Get-MgServicePrincipalAppRoleAssignedTo -ServicePrincipalId $App.Id -All23 24 # Delegated permissions consented for this application25 $DelegatedGrants = Get-MgServicePrincipalOauth2PermissionGrant -ServicePrincipalId $App.Id -All26 27 [PSCustomObject]@{28 Application = $App.DisplayName29 AppId = $App.AppId30 AssignmentRequired = $App.AppRoleAssignmentRequired31 NumberOfAssignments = $Assignees.Count32 Assignees = ($Assignees.PrincipalDisplayName -join "; ")33 DelegatedPermissions = ($DelegatedGrants.Scope -join " ").Trim()34 }35}36 37# Export the report for periodic review (recommended: quarterly)38$Report | Export-Csv -Path ".\\Graph-SDK-Apps-Report.csv" -NoTypeInformation -Encoding UTF839 40$Report | Format-Table -AutoSizeThis script produces a table and CSV file listing, application by application, the number of assigned accounts, their identity, and the list of consented delegated permissions. This is the report to review during the quarterly audit mentioned above.
Troubleshooting Common Errors
- AADSTS50011 ("The reply URL specified in the request does not match"): the redirect URI doesn't match the WAM flow used by PowerShell Core. Check for the presence of
http://localhostand the broker URIms-appx-web://Microsoft.AAD.BrokerPlugin/. - AADSTS50105 ("Your administrator has configured the application... to block users unless they are specifically granted access"): the user is trying to connect to an application with
Assignment required?set to Yes without having a direct assignment or via a group. - AADSTS65001 (consent required): the application's delegated permissions haven't been consented to by an administrator. Go back to the API permissions page and click Grant admin consent.
- Access denied when running
Get-MgServicePrincipalOauth2PermissionGrant: the account running the audit script doesn't have theApplication.Read.Allpermission. Check the scope requested during the initialConnect-MgGraph.
Key Takeaways
Segmenting interactive access to the Microsoft Graph PowerShell SDK through dedicated Entra ID applications directly addresses the permission drift problem accumulated on the default application. Specifically:
- Create a registered application per team with distinct access needs, with
Assignment required?set to Yes. - Configure the redirect URI based on the PowerShell version used (
nativeclientfor 5.1,localhost+ WAM broker for PowerShell Core). - Use a security group rather than individual assignments to simplify access management.
- Plan a periodic review of permissions and assignments via an audit script, and don't forget to also secure the default Microsoft Graph Command Line Tools application.
If your organization manages multiple teams with heterogeneous Graph needs, start with a single pilot application (the help desk, for example) before generalizing the model to all affected services.



