Application roles (AppRoles) play a crucial role in defining authorization within Entra ID applications. Apps without roles may indicate incomplete configuration, lack of proper access control, or potential governance gaps.
This script helps administrators identify applications that do not have any AppRoles defined/assigned, enabling better governance and security posture.
Try the M365Corner Microsoft 365 Reporting Tool β your DIY pack with 20+ out-of-the-box M365 reports for Users, Groups, and Teams.
# Connect to Microsoft Graph
Connect-MgGraph -Scopes Application.Read.All
Write-Host "Scanning applications for missing app roles..." -ForegroundColor Cyan
# Get all applications with AppRoles property
$Applications = Get-MgApplication -All -Property Id,DisplayName,AppId,CreatedDateTime,Description,AppRoles
$Results = @()
foreach ($App in $Applications) {
# Check if AppRoles exist
if (-not $App.AppRoles -or $App.AppRoles.Count -eq 0) {
# Console output (minimal)
Write-Host "$($App.DisplayName) | $($App.AppId)" -ForegroundColor Yellow
# Export object (detailed)
$Results += [PSCustomObject]@{
ApplicationName = $App.DisplayName
ApplicationId = $App.Id
ClientId = $App.AppId
CreatedDate = $App.CreatedDateTime
Description = $App.Description
AppRoleStatus = "No App Roles Defined"
}
}
}
# Export results
$ExportPath = "C:\Path\Applications_Without_AppRoles_Report.csv"
$Results | Export-Csv $ExportPath -NoTypeInformation
Write-Host "Report exported to $ExportPath" -ForegroundColor Cyan
Download this script from our M365Corner GitHub Repo: https://github.com/m365corner/M365Corner-Scripts/tree/main/Entra-Apps-Related-Scripts/List-Entra-Apps-With-No-Roles
| Step | Explanation |
|---|---|
| Connect to Graph | Uses Application.Read.All permission to read application details |
| Fetch Applications | Retrieves all applications along with AppRoles property |
| Iterate Through Apps | Loops through each application in the tenant |
| Check AppRoles | Identifies apps where AppRoles is null or empty |
| Console Output | Displays app name and client ID for quick visibility |
| Build Report Object | Captures key metadata for reporting |
| Export to CSV | Saves the report for auditing and action |
Include Owner Details
Combine with Permissions Check
Filter by Recently Created Apps
Add Role Assignment Check
Automate Reporting
| Question | Answer |
|---|---|
| What are AppRoles? | They define application-level permissions for users or services |
| Is it bad to have no AppRoles? | Not always, but may indicate incomplete or poorly designed apps |
| Does this script check role assignments? | No, only checks if roles are defined |
| Can I filter specific apps? | Yes, by modifying the loop conditions |
| Use Case | Description |
|---|---|
| Governance Audits | Identify apps lacking proper role-based access control |
| Security Review | Detect apps with weak authorization design |
| App Cleanup | Remove unused or misconfigured applications |
| Compliance Checks | Ensure apps follow access control standards |
| Development Oversight | Monitor newly created apps for proper configuration |
| Error | Cause | Solution |
|---|---|---|
| Insufficient privileges | Missing Graph permissions |
Use: Connect-MgGraph -Scopes Application.Read.All Grant admin consent if required. |
| No results returned | All applications have roles defined/assigned. |
Validate environment Remove filters if applied |
| AppRoles property missing | Property not included in query | Ensure: -Property AppRoles is included (already handled in script) . |
| Export path not found | Invalid directory |
Update path: C:\Path\Applications_Without_AppRoles_Report.csv Ensure folder exists. |
This script helps identify Entra ID applications that lack AppRoles, providing valuable insight into potential governance and security gaps.
Itβs a simple yet effective step toward maintaining a well-structured and secure application environment.
© Created and Maintained by LEARNIT WELL SOLUTIONS. All Rights Reserved.