App Registration
π What is App Registration?
App Registration in Azure Active Directory (Azure AD) is the process of registering an application so that it can integrate with Azure AD for authentication, authorization, and access control.
When you register an application in Azure AD, it gets its own identity (including an Application (Client) ID) that allows it to securely access Azure AD resources and use various Microsoft identity and access management features.
π§ Why Register an App in Azure AD?
Authentication and Authorization: Allows the app to authenticate users via Azure AD (using OAuth 2.0, OpenID Connect, etc.), and grants the app permissions to access Microsoft services.
Secure Access to APIs: Provides access to APIs (like Microsoft Graph, Outlook, SharePoint, etc.) with proper access control.
Manage Permissions: Configure fine-grained permissions (like reading user data or accessing calendars) that control what the app can access.
SSO (Single Sign-On): Apps can use SSO for users, so they can log in once to Azure AD and access multiple apps without needing to authenticate each time.
π§° How Does App Registration Work?
When you register an app, Azure AD does several things:
Create an App Identity: This app gets a unique Application (Client) ID and a Directory (Tenant) ID.
Define Redirect URIs: You set the redirect URIs (for web apps) or other settings where the app should send authentication responses (tokens).
Configure Permissions: You configure the app’s permissions to specify what resources it can access (e.g., read user profile, send emails on behalf of the user).
Create Secret/Certificates: The app will use a client secret or certificate to authenticate securely against Azure AD.
Define Scopes: You define scopes (like
user.read
) to specify exactly what parts of Microsoft services the app can interact with.
π Key Components of App Registration:
Component | Description |
---|---|
Application (Client) ID | Unique identifier for your app in Azure AD. |
Directory (Tenant) ID | Unique identifier for your Azure AD tenant. |
Client Secret | A secret used by the app for authentication, similar to a password (must be kept secure). |
Certificates | You can use certificates instead of client secrets for more secure authentication (recommended for higher security apps). |
API Permissions | Defines which Microsoft APIs or resources the app can access (e.g., Microsoft Graph, SharePoint, Teams). |
Redirect URIs | The URIs where Azure AD will send authentication responses (tokens). |
Scopes | Define the level of access your app requires (e.g., User.Read to read user profile data). |
App Roles | Define roles within the app for assigning users/groups different levels of access within the app. |
π§° Steps for App Registration in Azure AD:
Go to Azure Portal → Azure Active Directory → App registrations → New registration.
Fill in app details:
Name: Give your app a meaningful name.
Supported account types: Choose the scope of accounts that can use the app (e.g., accounts in your organization, multi-tenant).
Redirect URI: For web apps, you need to specify where Azure AD will send the authorization code after successful login.
Register the app and take note of the Client ID and Tenant ID (you'll need them for authentication).
Configure Permissions: Under "API Permissions", add the permissions that your app needs (e.g., Microsoft Graph).
Create a Client Secret or Certificate: Under "Certificates & Secrets", generate a client secret or use a certificate for authentication.
π¦ Types of Applications You Can Register:
Web Apps: Apps that run on a server (e.g., internal apps, websites).
Mobile and Desktop Apps: Apps that run on users' devices (e.g., iOS, Android, or Windows applications).
Daemon Services (Background Apps): Apps that run in the background without user interaction and access resources with app permissions.
Single-page Apps (SPA): Web apps that run entirely in the browser (e.g., React or Angular apps).
π Example Scenario:
You’re building a web app that integrates with Microsoft Graph to show user calendar events.
Register the app in Azure AD to get a Client ID and Tenant ID.
Configure permissions like
Calendars.Read
to access the user's calendar.Set up client secrets to authenticate your app securely.
In your app’s backend, request an access token using the OAuth flow, which you can use to make requests to Microsoft Graph on behalf of the user.
π App Registration vs. Service Principal
App Registration: It is the definition of the app in Azure AD, which provides all the configuration settings and permissions.
Service Principal: This is the identity created in the Azure AD directory that allows the app to actually access resources in Azure. It’s like an instance of the app in the tenant that enforces permissions.
π Why Use App Registration?
Security: Centralized management of app identities and access control.
Granular Permissions: Assign specific permissions to apps, controlling access to data and services.
Seamless Integration: Allows apps to seamlessly integrate with Microsoft’s cloud services (Microsoft 365, Azure, etc.) and use features like SSO.
Cloud-Native: Supports cloud-native architectures and is ideal for modern web/mobile/daemon apps.