How to: Restrict your app to a set of users
Applications registered in an Azure Active Directory (Azure AD) tenant are, by default, available to all users of the tenant who authenticate successfully.
Similarly, in case of a multi-tenant app, all users in the Azure AD tenant where this app is provisioned will be able to access this application once they successfully authenticate in their respective tenant.
Tenant administrators and developers often have requirements where an app must be restricted to a certain set of users. Developers can accomplish the same by using popular authorization patterns like Role Based Access Control (RBAC), but this approach requires a significant amount of work on part of the developer.
Azure AD allows tenant administrators and developers to restrict an app to a specific set of users or security groups in the tenant.
Supported app configurations
The option to restrict an app to a specific set of users or security groups in a tenant works with the following types of applications:
Applications configured for federated single sign-on with SAML-based authentication
Application proxy applications that use Azure AD pre-authentication
Applications built directly on the Azure AD application platform that use OAuth 2.0/OpenID Connect authentication after a user or admin has consented to that application.
This feature is available for web app/web API and enterprise applications only. Apps that are registered as native cannot be restricted to a set of users or security groups in the tenant.
Update the app to enable user assignment
There are two ways to create an application with enabled user assignment. One requires the Global Administrator role, the second does not.
Enterprise applications (requires the Global Adminstrator role)
Go to the Azure portal and sign in as a Global Administrator.
On the top bar, select the signed-in account.
Under Directory, select the Azure AD tenant where the app will be registered.
In the navigation on the left, select Azure Active Directory. If Azure Active Directory is not available in the navigation pane, follow these steps:
- Select All services at the top of the main left-hand navigation menu.
- Type in Azure Active Directory in the filter search box, and then select the Azure Active Directory item from the result.
In the Azure Active Directory pane, select Enterprise Applications from the Azure Active Directory left-hand navigation menu.
Select All Applications to view a list of all your applications.
If you do not see the application you want show up here, use the various filters at the top of the All applications list to restrict the list or scroll down the list to locate your application.
Select the application you want to assign a user or security group to from the list.
On the application's Overview page, select Properties from the application’s left-hand navigation menu.
Locate the setting User assignment required? and set it to Yes. When this option is set to Yes, users must first be assigned to this application before they can access it.
Select Save to save this configuration change.
- Go to the Azure portal.
- On the top bar, select the signed-in account.
- Under Directory, select the Azure AD tenant where the app will be registered.
- In the navigation on the left, select Azure Active Directory.
- In the Azure Active Directory pane, select App Registrations from the Azure Active Directory left-hand navigation menu.
- Create or select the app you want to manage. You need to be Owner of this app registration.
- On the application's Overview page, follow the Managed application in local directory link under the essentials in the top of the page. This will take you to the managed Enterprise Application of your app registration.
- From the navigation blade on the left, select Properties.
- Locate the setting User assignment required? and set it to Yes. When this option is set to Yes, users must first be assigned to this application before they can access it.
- Select Save to save this configuration change.
Assign users and groups to the app
Once you've configured your app to enable user assignment, you can go ahead and assign users and groups to the app.
Select the Users and groups pane in the application’s left-hand navigation menu.
At the top of the Users and groups list, select the Add user button to open the Add Assignment pane.
Select the Users selector from the Add Assignment pane.
A list of users and security groups will be shown along with a textbox to search and locate a certain user or group. This screen allows you to select multiple users and groups in one go.
Once you are done selecting the users and groups, press the Select button on bottom to move to the next part.
Press the Assign button on the bottom to finish the assignments of users and groups to the app.
Confirm that the users and groups you added are showing up in the updated Users and groups list.