Scopes & Permissions
Scopes & Permissions
Scopes define what your application can access using an access token. Understanding scopes is critical for requesting the right permissions and troubleshooting authorization issues.
What Are Scopes?
A scope is a permission that grants access to specific resources or operations in an API.
Format
https://api.example.com/.default
https://graph.microsoft.com/User.Read
https://management.azure.com/user_impersonationParts:
- Resource URI: The API you’re accessing (
https://graph.microsoft.com) - Permission: The specific capability (
User.Read,.default)
Common Scope Patterns
Microsoft Graph API
| |
Azure Management API
| |
Custom APIs
| |
Azure Key Vault
| |
Azure Storage
| |
The .default Scope
What It Means
The .default suffix requests all permissions configured in your app registration.
Example: If your app is configured with:
User.ReadMail.ReadCalendars.Read
Then requesting https://graph.microsoft.com/.default includes all three.
When to Use
✅ Use .default when:
- Working with service principals (Client Credentials flow)
- You want all configured permissions
- Building automation scripts
⚠️ Avoid .default when:
- Requesting minimal permissions
- Building user-facing apps (use explicit scopes)
- Different operations need different scopes
Example
| |
Profile Scopes vs Runtime Scopes
Profile Scopes
Scopes stored in your profile configuration:
| |
Used by default when running:
| |
Runtime Scope Override
Override profile scopes with --scope or -s:
| |
Use cases:
- Different operations need different permissions
- Testing with minimal scopes
- Temporary scope changes without editing profile
Multiple Scopes
Space-Separated Format
| |
Comma-Separated Format
| |
The tool normalizes both formats automatically.
Scope Requirements by Flow
Client Credentials Flow
Requires: Application permissions configured in Azure Portal
| |
Example scopes:
| |
User-Interactive Flows
Requires: Delegated permissions configured in Azure Portal
| |
Example scopes:
| |
Inspecting Token Scopes
Use inspect to see what scopes are included in your token:
| |
Output:
| |
Fields:
scp: Delegated permissions (user context)roles: Application permissions (app context)
Common Scope Patterns
Reading User Data
| |
Email Access
| |
Calendar Access
| |
Azure Resource Management
| |
SharePoint
| |
Scope Configuration
Setting Scopes in Profile
During Creation
| |
During Edit
| |
Manual JSON Edit
Edit ~/.entratool/profiles.json:
| |
Scope Troubleshooting
“Invalid scope”
Cause: Scope format is incorrect
Fix:
| |
“AADSTS65001: User consent required”
Cause: User hasn’t consented to delegated permissions
Fix:
- Use interactive flow (Authorization Code or Interactive Browser)
- User will be prompted to consent
- Or: Admin grants consent in Azure Portal
“AADSTS70011: Invalid scopes”
Cause: Scope not configured in app registration
Fix:
- Go to Azure Portal → App registrations
- Select your app → API permissions
- Add the required permission
- Grant admin consent (if Application permission)
“Insufficient privileges”
Cause: Token has scope but user/app lacks underlying permission
Fix:
- For users: Assign appropriate role (e.g., Global Reader)
- For apps: Grant admin consent for Application permissions
- Verify permission configuration in Azure Portal
Best Practices
✅ Principle of Least Privilege
Request only the scopes you need:
| |
✅ Use Explicit Scopes for User Apps
For user-facing applications, request specific scopes:
| |
✅ Use .default for Service Principals
For automation and service accounts:
| |
✅ Separate Profiles for Different Scopes
Create profiles for different scenarios:
| |
❌ Don’t Hard-Code Tokens
Always request fresh tokens with appropriate scopes:
| |
Scope Discovery
Finding Available Scopes
Azure Portal:
- App registrations → API permissions → Add permission
- Browse Microsoft APIs or your custom APIs
- View available Delegated and Application permissions
Microsoft Graph Explorer:
- Visit: https://developer.microsoft.com/graph/graph-explorer
- Explore API endpoints and required scopes
API Documentation:
- Microsoft Graph: https://docs.microsoft.com/graph/permissions-reference
- Azure Management: https://docs.microsoft.com/rest/api/azure/
Using discover Command
| |
Output shows:
- Token audience
- Issued scopes
- Roles
- Expiration time
Scope Combinations
Common Combinations
Graph API Read-Only Access
| |
Graph API Admin Access
| |
Azure Management + Graph
| |