AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured approach to configuring Microsoft Entra ID (formerly Azure AD) for secure application authentication. It covers the end-to-end lifecycle of app registration, including setting up OAuth 2.0 flows, configuring API permissions, and implementing authentication in code using the Microsoft Authentication Library (MSAL). It emphasizes secure practices, such as using managed identities and avoiding hardcoded secrets, while providing references for CLI-based automation and Infrastructure-as-Code (IaC) templates.
What it does
- Guides the creation and configuration of Microsoft Entra ID app registrations.
- Explains how to implement OAuth 2.0 authentication flows for various application types.
- Details the configuration of API permissions for Microsoft Graph and custom APIs.
- Provides best practices for secure credential management, including certificates and managed identities.
- Offers CLI commands and code-based examples for MSAL integration.
- Outlines patterns for service-to-service and user-interactive authentication.
When to use it
- When you need to register a new application in Microsoft Entra ID.
- When setting up authentication for web, mobile, or daemon applications.
- When you need to grant your application access to Microsoft Graph or other protected APIs.
- When implementing secure service-to-service communication using client credentials.
- When migrating from legacy authentication methods to modern OAuth 2.0 flows.
Advantages
- Centralizes configuration steps for Entra ID app registrations.
- Promotes security best practices like least privilege and secret rotation.
- Supports both manual portal configuration and automated CLI/IaC workflows.
- Provides clear guidance on choosing the right authentication library and flow.
Usage examples
- “How do I register a new web application in Microsoft Entra ID?”
- The agent provides a step-by-step guide for the Azure Portal or CLI, including setting redirect URIs and account types.
- “What are the steps to add Microsoft Graph permissions to my app?”
- The agent explains how to navigate to API permissions in the portal and select the appropriate delegated or application permissions.
- “How do I implement a client credentials flow for a background service?”
- The agent outlines the process of creating a client secret or certificate and using the MSAL library to authenticate the service.
- “What is the best way to handle authentication in production?”
- The agent recommends using managed identities or client certificates instead of secrets, with code examples for different environments.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/microsoft/entra-app-registration/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip entra-app-registration.zip -d .agents/skills
Documentation by Microsoft
Overview
Microsoft Entra ID (formerly Azure Active Directory) is Microsoft's cloud-based identity and access management service. App registrations allow applications to authenticate users and access Azure resources securely.
Key Concepts
| Concept | Description |
|---|---|
| App Registration | Configuration that allows an app to use Microsoft identity platform |
| Application (Client) ID | Unique identifier for your application |
| Tenant ID | Unique identifier for your Azure AD tenant/directory |
| Client Secret | Password for the application (confidential clients only) |
| Redirect URI | URL where authentication responses are sent |
| API Permissions | Access scopes your app requests |
| Service Principal | Identity created in your tenant when you register an app |
Application Types
| Type | Use Case |
|---|---|
| Web Application | Server-side apps, APIs |
| Single Page App (SPA) | JavaScript/React/Angular apps |
| Mobile/Native App | Desktop, mobile apps |
| Daemon/Service | Background services, APIs |
Core Workflow
Step 1: Register the Application
Create an app registration in the Azure portal or using Azure CLI.
Portal Method:
Navigate to Azure Portal → Microsoft Entra ID → App registrations
Click "New registration"
Provide name, supported account types, and redirect URI
Click "Register"
CLI Method: See references/cli-commands.md IaC Method: See references/BICEP-EXAMPLE.bicep
It's highly recommended to use the IaC to manage Entra app registration if you already use IaC in your project, need a scalable solution for managing lots of app registrations or need fine-grained audit history of the configuration changes.
Step 2: Configure Authentication
Set up authentication settings based on your application type.
Web Apps: Add redirect URIs, enable ID tokens if needed
SPAs: Add redirect URIs, enable implicit grant flow if necessary
Mobile/Desktop: Use
http://localhostor custom URI schemeServices: No redirect URI needed for client credentials flow
Step 3: Configure API Permissions
Grant your application permission to access Microsoft APIs or your own APIs.
Common Microsoft Graph Permissions:
User.Read- Read user profileUser.ReadWrite.All- Read and write all usersDirectory.Read.All- Read directory dataMail.Send- Send mail as a user
Details: See references/api-permissions.md
Step 4: Create Client Credentials (if needed)
For confidential client applications (web apps, services), create a client secret, certificate or federated identity credential.
Client Secret:
Navigate to "Certificates & secrets"
Create new client secret
Copy the value immediately (only shown once)
Store securely (Key Vault recommended)
Certificate: For production environments, use certificates instead of secrets for enhanced security. Upload certificate via "Certificates & secrets" section.
Federated Identity Credential: For dynamically authenticating the confidential client to Entra platform.
Step 5: Implement OAuth Flow
Integrate the OAuth flow into your application code.
See:
references/oauth-flows.md - OAuth 2.0 flow details
references/console-app-example.md - Console app implementation
Common Patterns
Pattern 1: First-Time App Registration
Walk user through their first app registration step-by-step.
Required Information:
Application name
Application type (web, SPA, mobile, service)
Redirect URIs (if applicable)
Required permissions
Script: See references/first-app-registration.md
Pattern 2: Console Application with User Authentication
Create a .NET/Python/Node.js console app that authenticates users.
Required Information:
Programming language (C#, Python, JavaScript, etc.)
Authentication library (MSAL recommended)
Required permissions
Example: See references/console-app-example.md
Pattern 3: Service-to-Service Authentication
Set up daemon/service authentication without user interaction.
Required Information:
Service/app name
Target API/resource
Whether to use secret or certificate
Implementation: Use Client Credentials flow (see references/oauth-flows.md#client-credentials-flow)
MCP Tools and CLI
Azure CLI Commands
| Command | Purpose |
|---|---|
az ad app create | Create new app registration |
az ad app list | List app registrations |
az ad app show | Show app details |
az ad app permission add | Add API permission |
az ad app credential reset | Generate new client secret |
az ad sp create | Create service principal |
Complete reference: See references/cli-commands.md
Microsoft Authentication Library (MSAL)
MSAL is the recommended library for integrating Microsoft identity platform.
Supported Languages:
.NET/C# -
Microsoft.Identity.ClientJavaScript/TypeScript -
@azure/msal-browser,@azure/msal-nodePython -
msal
Examples: See references/console-app-example.md
Security Best Practices
| Practice | Recommendation |
|---|---|
| Never hardcode secrets | Use environment variables, Azure Key Vault, or managed identity |
| Rotate secrets regularly | Set expiration, automate rotation |
| Use certificates over secrets | More secure for production |
| Least privilege permissions | Request only required API permissions |
| Enable MFA | Require multi-factor authentication for users |
| Use managed identity | For Azure-hosted apps, avoid secrets entirely |
| Validate tokens | Always validate issuer, audience, expiration |
| Use HTTPS only | All redirect URIs must use HTTPS (except localhost) |
| Monitor sign-ins | Use Entra ID sign-in logs for anomaly detection |
SDK Quick References
Azure Identity: Python | .NET | TypeScript | Java | Rust
Key Vault (secrets): Python | TypeScript
Auth Events: .NET
References
OAuth Flows - Detailed OAuth 2.0 flow explanations
CLI Commands - Azure CLI reference for app registrations
Console App Example - Complete working examples
First App Registration - Step-by-step guide for beginners
API Permissions - Understanding and configuring permissions
Troubleshooting - Common issues and solutions
External Resources
Files
- ATTRIBUTION.mdAdded by AutoGineer998 B
- LICENSELicence file added by AutoGineer1.1 KiB
- SKILL.md8.0 KiB
- references/BICEP-EXAMPLE.bicep5.2 KiB
- references/api-permissions.md10.0 KiB
- references/auth-best-practices.md6.1 KiB
- references/cli-commands.md8.6 KiB
- references/console-app-example.md10.7 KiB
- references/first-app-registration.md7.2 KiB
- references/oauth-flows.md9.3 KiB
- references/sdk/azure-identity-dotnet.md940 B
- references/sdk/azure-identity-java.md1.2 KiB
- references/sdk/azure-identity-py.md1.1 KiB
- references/sdk/azure-identity-rust.md805 B
- references/sdk/azure-identity-ts.md1.1 KiB
- references/sdk/azure-keyvault-py.md1.1 KiB
- references/sdk/azure-keyvault-secrets-ts.md1.0 KiB
- references/sdk/microsoft-azure-webjobs-extensions-authentication-events-dotnet.md1.5 KiB
- references/troubleshooting.md7.4 KiB
references/api-permissions.md
API Permissions Guide
This document explains how to configure and manage API permissions for your Microsoft Entra app registration.
Permission Types
Delegated Permissions (User Context)
What: Application acts on behalf of a signed-in user
When to use:
User is present and can consent
App needs to access resources as the user
Interactive authentication flows
Examples:
Read user's email
Update user's calendar
Access user's OneDrive files
Scope format: User must consent (or admin pre-consents)
Application Permissions (App Context)
What: Application acts with its own identity (no user)
When to use:
Background services, daemons
Scheduled jobs
API-to-API calls without user
Examples:
Read all users in organization
Send mail as any user
Access all SharePoint sites
Requirement: Always requires admin consent
Permission Scopes
Understanding Scopes
Scope: A string that defines what access is granted
Format:
{resource}/{permission_name}
Examples:
https://graph.microsoft.com/User.Read
https://graph.microsoft.com/Mail.Send
api://myapi-id/access_as_user.default Scope
Special scope that includes all configured permissions:
https://graph.microsoft.com/.default
api://your-api-id/.defaultWhen to use:
Client credentials flow (always)
Want all pre-configured permissions
Migrating from v1.0 endpoint
Microsoft Graph Permissions
Common Delegated Permissions
| Permission | What it allows | Admin Consent Required |
|---|---|---|
User.Read | Read signed-in user's profile | No |
User.ReadWrite | Read and update user profile | No |
User.ReadBasic.All | Read basic info of all users | No |
User.Read.All | Read all users' full profiles | Yes |
Mail.Read | Read user's mail | No |
Mail.ReadWrite | Read and write user's mail | No |
Mail.Send | Send mail as user | No |
Calendars.Read | Read user's calendars | No |
Calendars.ReadWrite | Read and write calendars | No |
Files.Read.All | Read all files user can access | No |
Sites.Read.All | Read items in all site collections | Yes |
Directory.Read.All | Read directory data | Yes |
Directory.ReadWrite.All | Read and write directory data | Yes |
Common Application Permissions
| Permission | What it allows | Admin Consent Required |
|---|---|---|
User.Read.All | Read all users' full profiles | Yes (Always) |
User.ReadWrite.All | Read and write all users' profiles | Yes (Always) |
Mail.Read | Read mail in all mailboxes | Yes (Always) |
Mail.Send | Send mail as any user | Yes (Always) |
Calendars.Read | Read calendars in all mailboxes | Yes (Always) |
Directory.Read.All | Read directory data | Yes (Always) |
Directory.ReadWrite.All | Read and write directory data | Yes (Always) |
Group.ReadWrite.All | Read and write all groups | Yes (Always) |
Adding Permissions
Azure Portal Method
Navigate to your app registration
Click "API permissions" in left menu
Click "+ Add a permission"
Choose API source:
Microsoft APIs (Graph, Office 365, etc.)
APIs my organization uses (custom APIs)
My APIs (your own APIs)
Select permission type:
Delegated permissions (user context)
Application permissions (app context)
Search and select permissions
Click "Add permissions"
See cli-commands.md for az cli commands to add API permissions programmatically.
Finding Permission IDs
Method 1: Azure Portal
Go to Microsoft Entra ID → Enterprise applications
Search for "Microsoft Graph"
Click on it → Permissions
Browse available permissions and copy IDs
Method 2: Microsoft Graph Explorer
Click "Modify permissions"
Browse and view permission details
Method 3: Microsoft Documentation
Visit: https://learn.microsoft.com/en-us/graph/permissions-reference
Method 4: Azure CLI Query
# List all Graph permissions (warning: long output)
az ad sp list --filter "appId eq '00000003-0000-0000-c000-000000000000'" \
--query "[0].{delegated:oauth2PermissionScopes,application:appRoles}" -o jsonGranting Admin Consent
When Admin Consent is Required
Always required for:
All application permissions
High-privilege delegated permissions
When organization disables user consent
Examples requiring admin consent:
User.Read.All(read all users)Directory.Read.All(read directory)Mail.Read(application permission)Sites.Read.All(read all SharePoint sites)
How to Grant Admin Consent
Portal Method:
Go to API permissions
Click "Grant admin consent for [Your Org]"
Confirm the action
Check for green checkmarks next to permissions
CLI Method:
az ad app permission admin-consent --id $APP_IDVerifying Consent Status
Portal: Look for green checkmarks in "Status" column
CLI:
az ad app permission list --id $APP_IDLook for consentType: "AllPrincipals" (admin consented)
Custom API Permissions
Exposing Your API
If you're building an API that other apps will call:
In your API's app registration, go to "Expose an API"
Set Application ID URI:
api://your-api-idClick "+ Add a scope"
Configure scope:
Scope name:
access_as_userWho can consent: Admins and users
Display name: "Access MyAPI as user"
Description: Clear description of what this allows
Click "Add scope"
Effective Permissions
User + App Permissions
Delegated permissions: Intersection of user's permissions and app's permissions
Example:
User can: Read all users
App granted: User.Read.All
Effective: Read all users ✅
User can: Only read their own profile
App granted: User.Read.All
Effective: Only read own profile (limited by user's rights)
Application permissions: Only app's permissions matter (no user context)
Troubleshooting Permissions
"Insufficient privileges" Error
Causes:
Permission not added to app registration
Admin consent not granted
User lacks permission in directory
Accessing resource outside permission scope
Solutions:
Check API permissions in portal
Grant admin consent if needed
Verify user has access to resource
Use correct permission scope
"Consent required" Error
Causes:
User hasn't consented to permissions
Admin consent required but not granted
Token obtained before permission added
Solutions:
Request user consent (interactive flow)
Admin grants consent (portal or CLI)
Acquire new token after adding permissions
Permission Appears Granted but Doesn't Work
Possible issues:
Using old cached token (get new one)
Permission is delegated but user lacks rights
API requires additional configuration
Permission deprecated (use new one)
Debug steps:
Decode access token: https://jwt.ms
Check
scpclaim (delegated) orrolesclaim (application)Verify permission is present in token
Check if permission is correct type (delegated vs application)
Permission Best Practices
Development
✅ Do:
Start with minimal permissions
Add incrementally as features require
Test with non-admin accounts
Document why each permission is needed
❌ Don't:
Request all permissions "just in case"
Use admin account for testing only
Forget to grant admin consent for app permissions
Production
✅ Do:
Review permissions quarterly
Remove unused permissions
Use least privilege principle
Monitor permission usage
Document all permissions in README
❌ Don't:
Grant excessive permissions for convenience
Use application permissions when delegated would work
Forget to rotate admin consent approvals
Security
✅ Do:
Prefer delegated over application permissions
Implement proper scope validation
Log permission usage
Handle consent errors gracefully
❌ Don't:
Hardcode permission scopes in multiple places
Skip token validation
Ignore scope mismatches
Cache permissions indefinitely
Reference Tables
Microsoft Graph Permission IDs
Delegated Permissions:
User.Read : e1fe6dd8-ba31-4d61-89e7-88639da4683d
User.ReadWrite : b4e74841-8e56-480b-be8b-910348b18b4c
User.ReadBasic.All : b340eb25-3456-403f-be2f-af7a0d370277
Mail.Read : 570282fd-fa5c-430d-a7fd-fc8dc98a9dca
Mail.ReadWrite : 024d486e-b451-40bb-833d-3e66d98c5c73
Mail.Send : e383f46e-2787-4529-855e-0e479a3ffac0
Calendars.Read : 465a38f9-76ea-45b9-9f34-9e8b0d4b0b42
Calendars.ReadWrite : 1ec239c2-d7c9-4623-a91a-a9775856bb36
Files.Read.All : df85f4d6-205c-4ac5-a5ea-6bf408dba283Application Permissions:
User.Read.All : df021288-bdef-4463-88db-98f22de89214
User.ReadWrite.All : 741f803b-c850-494e-b5df-cde7c675a1ca
Mail.Read : 810c84a8-4a9e-49e6-bf7d-12d183f40d01
Mail.Send : b633e1c5-b582-4048-a93e-9f11b44c7e96
Directory.Read.All : 7ab1d382-f21e-4acd-a863-ba3e13f7da61
Directory.ReadWrite.All : 19dbc75e-c2e2-444c-a770-ec69d8559fc7Note: Permission IDs may change. Always verify against the official Microsoft Graph Permissions Reference for the most current values.
Additional Resources
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Node.js
Security
What our scanner noticed· Low risk
- Instructions that use the network
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Microsoft
- Publisher
- Microsoft (Official)
- Source
- microsoft/skills · .github/plugins/azure-skills/skills/entra-app-registration · commit 0696600
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from .github/plugins/azure-skills/LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Also distributed in
- microsoft/azure-skills
AutoGineer is not affiliated with or endorsed by Microsoft.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download entra-app-registration.zip