Last time I talked about how to build a Django app that can connect to Azure AD. This time, I’m going to cover how to extend that sample to have a multi-tenant application.
The coolest thing? You don’t have to make any code changes to get multi-tenant up and running. All we have to do is make a couple configuration changes in Azure.
1. Navigate to the Applications on your directory and click on the Application you configured last time. Then, click on the Configure tab up top. You’ll want to turn on the switch for “Application is Multi-Tenant”, as seen below:
Don’t click save yet, because it probably won’t work! You need to make sure your App ID URI is valid and unique. You want the format to be [your tenant]/[some unique identifier for your app]. You can see my example below:
Under permissions to other applications, you’ll want to click on Delegated Permissions, and click “Sign in and read user profile”.
Click Save, and your app is already ready to be multi-tenant! You can test this out by creating another tenant in Azure AD, creating a user for that tenant, and attempt to log in to your app. It will ask for your permission to access user data.
Click Accept, and you should then be logged in to your application with an ID from another tenant!
Let me know if you have any comments or questions!