Generated banner for Entra App Registration
Generated logo for Entra App Registration

Entra App Registration

MicrosoftOfficialCreated by Microsoft

  • Skill
  • Tool integration
  • Security
  • MIT
  • Low risk

From the author

Guides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.
— the description by Microsoft

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

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/microsoft/entra-app-registration/download
  2. Unzip 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
ConceptDescription
App RegistrationConfiguration that allows an app to use Microsoft identity platform
Application (Client) IDUnique identifier for your application
Tenant IDUnique identifier for your Azure AD tenant/directory
Client SecretPassword for the application (confidential clients only)
Redirect URIURL where authentication responses are sent
API PermissionsAccess scopes your app requests
Service PrincipalIdentity created in your tenant when you register an app
Application Types
TypeUse Case
Web ApplicationServer-side apps, APIs
Single Page App (SPA)JavaScript/React/Angular apps
Mobile/Native AppDesktop, mobile apps
Daemon/ServiceBackground services, APIs

Core Workflow

Step 1: Register the Application

Create an app registration in the Azure portal or using Azure CLI.

Portal Method:

  1. Navigate to Azure Portal → Microsoft Entra ID → App registrations

  2. Click "New registration"

  3. Provide name, supported account types, and redirect URI

  4. 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://localhost or custom URI scheme

  • Services: 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 profile

  • User.ReadWrite.All - Read and write all users

  • Directory.Read.All - Read directory data

  • Mail.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:

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
CommandPurpose
az ad app createCreate new app registration
az ad app listList app registrations
az ad app showShow app details
az ad app permission addAdd API permission
az ad app credential resetGenerate new client secret
az ad sp createCreate 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.Client

  • JavaScript/TypeScript - @azure/msal-browser, @azure/msal-node

  • Python - msal

Examples: See references/console-app-example.md

Security Best Practices

PracticeRecommendation
Never hardcode secretsUse environment variables, Azure Key Vault, or managed identity
Rotate secrets regularlySet expiration, automate rotation
Use certificates over secretsMore secure for production
Least privilege permissionsRequest only required API permissions
Enable MFARequire multi-factor authentication for users
Use managed identityFor Azure-hosted apps, avoid secrets entirely
Validate tokensAlways validate issuer, audience, expiration
Use HTTPS onlyAll redirect URIs must use HTTPS (except localhost)
Monitor sign-insUse Entra ID sign-in logs for anomaly detection

SDK Quick References

References

External Resources

Files

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/.default

When to use:

  • Client credentials flow (always)

  • Want all pre-configured permissions

  • Migrating from v1.0 endpoint

Microsoft Graph Permissions

Common Delegated Permissions
PermissionWhat it allowsAdmin Consent Required
User.ReadRead signed-in user's profileNo
User.ReadWriteRead and update user profileNo
User.ReadBasic.AllRead basic info of all usersNo
User.Read.AllRead all users' full profilesYes
Mail.ReadRead user's mailNo
Mail.ReadWriteRead and write user's mailNo
Mail.SendSend mail as userNo
Calendars.ReadRead user's calendarsNo
Calendars.ReadWriteRead and write calendarsNo
Files.Read.AllRead all files user can accessNo
Sites.Read.AllRead items in all site collectionsYes
Directory.Read.AllRead directory dataYes
Directory.ReadWrite.AllRead and write directory dataYes
Common Application Permissions
PermissionWhat it allowsAdmin Consent Required
User.Read.AllRead all users' full profilesYes (Always)
User.ReadWrite.AllRead and write all users' profilesYes (Always)
Mail.ReadRead mail in all mailboxesYes (Always)
Mail.SendSend mail as any userYes (Always)
Calendars.ReadRead calendars in all mailboxesYes (Always)
Directory.Read.AllRead directory dataYes (Always)
Directory.ReadWrite.AllRead and write directory dataYes (Always)
Group.ReadWrite.AllRead and write all groupsYes (Always)

Adding Permissions

Azure Portal Method
  1. Navigate to your app registration

  2. Click "API permissions" in left menu

  3. Click "+ Add a permission"

  4. Choose API source:

    • Microsoft APIs (Graph, Office 365, etc.)

    • APIs my organization uses (custom APIs)

    • My APIs (your own APIs)

  5. Select permission type:

    • Delegated permissions (user context)

    • Application permissions (app context)

  6. Search and select permissions

  7. Click "Add permissions"

See cli-commands.md for az cli commands to add API permissions programmatically.

Finding Permission IDs

Method 1: Azure Portal
  1. Go to Microsoft Entra ID → Enterprise applications

  2. Search for "Microsoft Graph"

  3. Click on it → Permissions

  4. Browse available permissions and copy IDs

Method 2: Microsoft Graph Explorer
  1. Visit https://developer.microsoft.com/graph/graph-explorer

  2. Click "Modify permissions"

  3. 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 json

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)

Portal Method:

  1. Go to API permissions

  2. Click "Grant admin consent for [Your Org]"

  3. Confirm the action

  4. Check for green checkmarks next to permissions

CLI Method:

az ad app permission admin-consent --id $APP_ID

Portal: Look for green checkmarks in "Status" column

CLI:

az ad app permission list --id $APP_ID

Look for consentType: "AllPrincipals" (admin consented)

Custom API Permissions

Exposing Your API

If you're building an API that other apps will call:

  1. In your API's app registration, go to "Expose an API"

  2. Set Application ID URI: api://your-api-id

  3. Click "+ Add a scope"

  4. Configure scope:

    • Scope name: access_as_user

    • Who can consent: Admins and users

    • Display name: "Access MyAPI as user"

    • Description: Clear description of what this allows

  5. 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:

  1. Check API permissions in portal

  2. Grant admin consent if needed

  3. Verify user has access to resource

  4. Use correct permission scope

Causes:

  • User hasn't consented to permissions

  • Admin consent required but not granted

  • Token obtained before permission added

Solutions:

  1. Request user consent (interactive flow)

  2. Admin grants consent (portal or CLI)

  3. 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:

  1. Decode access token: https://jwt.ms

  2. Check scp claim (delegated) or roles claim (application)

  3. Verify permission is present in token

  4. 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-6bf408dba283

Application 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-ec69d8559fc7

Note: 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 or Microsoft.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download entra-app-registration.zip