Trendingat

02Home & Garden · Updated

App Permissions in Azure Explained

Short answer

Microsoft Graph permissions and Azure RBAC roles

Azure app permissions are managed through Microsoft Graph for API access and Azure Role-Based Access Control (RBAC) for resource management. These systems determine what data an application can read or write and which Azure services it can control.

Main ToolsMicrosoft Graph and Azure RBACExplained in: Azure RBAC Manages Resource Control
Permission TypesDelegated and Application permissionsExplained in: Assigning Permissions in the Portal
Control MethodConsent-based or Admin-assignedExplained in: Assigning Permissions in the Portal
Reading time6 min7 sections, about 1,480 words

Graph API Permissions Define Data Access

When you create an application in Azure, you often need it to interact with data in Microsoft 365, such as emails, calendar events, or user profiles. This is handled through the Microsoft Graph API. Permissions here are not a single toggle but a set of specific scopes that define exactly what the app can do. For example, an app that only needs to read a user’s profile requires a different permission than one that needs to send emails on their behalf.

Permissions are divided into two primary categories: Delegated and Application. Delegated permissions are used when a user is signed into the app. The app acts on behalf of that user, meaning it can only access what the user themselves has permission to see. If a user cannot read a specific folder in SharePoint, the app cannot read it either, even if the app has the correct delegated permission. This ensures that the app never exceeds the authority of the human operating it.

Application permissions are used by services that run without a signed-in user, such as background daemons or automated sync tools. These permissions allow the app to access data across the entire organization. Because this is a high-risk setup, application permissions always require an administrator to grant consent. A regular user cannot authorize an app to read every mailbox in the company. These permissions are broad and powerful, making them a primary target for security audits.

Azure RBAC Manages Resource Control

While Graph permissions handle data, Azure Role-Based Access Control (RBAC) handles the infrastructure. RBAC determines if an app can start a virtual machine, create a storage account, or change a network setting. This is a separate system from the API permissions mentioned above. An app might have permission to read a user’s email via Graph but have no permission to touch a single server in the Azure portal.

RBAC works through a system of assignments. An assignment consists of a security principal (the app), a role definition (the set of permissions), and a scope (the level at which the role applies). The scope can be the entire subscription, a specific resource group, or a single individual resource. By limiting the scope, you prevent an app from having more power than it needs. For example, if an app only needs to upload logs to one specific storage account, you assign the role only to that account rather than the whole resource group.

There are built-in roles that cover common needs. The Owner role gives full access to all resources, including the ability to grant access to others. The Contributor role allows the app to create and manage all types of Azure resources but does not allow it to assign roles in RBAC. The Reader role allows the app to view existing resources but not change them. Using these built-in roles is the standard practice for most deployments, though custom roles can be created for highly specific needs.

Matching Permission Types to Use Cases

Choosing the right permission depends on whether a human is present and what the app is trying to achieve. If you are building a tool for employees to manage their own tasks, you use delegated permissions. If you are building a nightly backup script that runs on a schedule, you use application permissions. Mixing these up can lead to security holes or apps that fail to authenticate because they lack a user token.

The following table shows how different requirements map to specific Azure permission types:

Use Case Permission Type Consent Required
User-facing dashboard Delegated User or Admin
Automated data sync Application Admin Only
Managing VM Power RBAC Role Owner/User Access Admin
Reading User Profile Delegated Graph User

A rule of thumb for security is the Principle of Least Privilege. This means you should always start with the most restrictive permission possible. If an app only needs to read data, do not give it write permissions. If it only needs access to one resource group, do not give it subscription-wide access. This limits the damage if the app’s credentials are ever leaked.

Assigning Permissions in the Portal

Adding permissions involves navigating the Azure portal and configuring the app registration. Labels may differ slightly by version, but the general path remains consistent. You must first register the application to get a Client ID and Tenant ID, which act as the app’s identity.

  1. Navigate to App Registrations Go to Microsoft Entra ID (formerly Azure Active Directory) and select App registrations. Choose your specific application from the list.
  2. Select API Permissions Click on the API permissions menu item. This is where you define what the app can access.
  3. Add a Permission Click Add a permission and select Microsoft Graph. Choose between Delegated permissions (for signed-in users) and Application permissions (for background services).
  4. Search and Select Scopes Find the specific permission you need, such as User.Read or Mail.Read. Check the box and click Add permissions.
  5. Grant Admin Consent For application permissions or sensitive delegated permissions, you must click the Grant admin consent for [Organization] button. Without this, the app will receive an error when it tries to call the API.
  6. Assign RBAC Roles If the app needs to manage Azure resources, go to the specific resource (like a Storage Account), select Access control (IAM), click Add > Add role assignment, and select the app’s name as the member.

A common mistake is adding permissions but forgetting to grant admin consent. This results in a “Consent required” error during the authentication flow. Another mistake is using Application permissions when Delegated permissions would suffice, which creates a security risk by giving the app access to all users’ data instead of just the active user’s data.

Managing Token Lifetimes and Security

Once permissions are granted, the app uses tokens to prove its identity. An access token is a short-lived string that the app sends with every API request. These tokens typically expire quickly to ensure that if a token is stolen, it cannot be used indefinitely. When a token expires, the app uses a refresh token to get a new one without asking the user to sign in again.

For applications using application permissions, the app uses a client secret or a certificate. A client secret is essentially a password for the app. These secrets have an expiration date, typically ranging from six months to two years. It is a common failure point in production environments when a secret expires and the app suddenly loses all access to Azure resources. You should set up alerts or use a key vault to manage these secrets automatically.

Certificates are more secure than client secrets because they use public-key cryptography. Instead of sending a password over the wire, the app proves it possesses a private key. This is the recommended method for high-security production environments. If you use certificates, you must upload the public key (.cer file) to the app registration in the portal so Azure can verify the signatures sent by the app.

Handling Permission Conflicts and Overlaps

Sometimes an app may be assigned multiple roles or permissions that overlap. Azure handles this by taking the union of all permissions. If an app is a Reader at the subscription level but a Contributor at the resource group level, it will have Contributor powers within that specific group and Reader powers everywhere else. Permissions are additive, meaning they cannot be used to “deny” a permission that was granted at a higher level.

If you find that an app has too much power, you must remove the permission at the highest level of the hierarchy first. For example, removing a subscription-level role will not remove a resource-group-level role. You must check every level of the scope to ensure the app is truly restricted. This is why auditing the Access control (IAM) tab on individual resources is just as important as checking the app registration settings.

When using Microsoft Graph, you might encounter “scopes” and “roles”. In the context of Graph, scopes refer to delegated permissions, while roles refer to application permissions. If you see a permission listed as both, you must choose the one that matches your authentication flow. Using a role in a delegated flow will not work, and using a scope in a daemon flow will result in an unauthorized error.

Further reading: Microsoft Support. Details can change, so check the official page for anything that matters to you. Spotted a mistake? Tell us. How we write an answer.