|
1 | 1 | ---
|
2 | 2 | services: active-directory
|
3 | 3 | platforms: dotnet
|
| 4 | +endpoint: Microsoft identity platform |
| 5 | +page_type: sample |
4 | 6 | author: TiagoBrenck
|
5 | 7 | level: 400
|
6 | 8 | client: ASP.NET Core Web App
|
7 |
| -endpoint: Microsoft identity platform |
| 9 | +service: Microsoft Graph |
| 10 | +languages: |
| 11 | + - CSharp |
| 12 | +products: |
| 13 | + - azure |
| 14 | + - azure-active-directory |
| 15 | + - dotnet |
| 16 | + - CSharp |
| 17 | + - office-ms-graph |
| 18 | +description: "Build a multi-tenant SaaS web application that calls Microsoft Graph using Azure AD & OpenID Connect" |
8 | 19 | ---
|
9 | 20 |
|
10 |
| - |
11 | 21 | # Build a multi-tenant SaaS web application that calls Microsoft Graph using Azure AD & OpenID Connect
|
12 | 22 |
|
13 | 23 | > This sample is for Azure AD, not Azure AD B2C.
|
14 | 24 |
|
15 | 25 | [](https://identitydivision.visualstudio.com/IDDP/_build/latest?definitionId=819)
|
16 | 26 |
|
17 |
| -## Scenario |
| 27 | +## About this sample |
18 | 28 |
|
19 |
| -This sample shows how to build a .NET Core MVC web application that uses OpenID Connect to sign in users from multi-tenants in Azure Active Directory. It leverages the ASP.NET Core OpenID Connect middleware. Additionally it also introduces developers to the concept of a [multi-tenant](https://docs.microsoft.com/en-us/azure/active-directory/develop/single-and-multi-tenant-apps) application. |
| 29 | +This sample shows how to build an ASP.NET Core MVC web application that usesOpenID Connect to sign in users from multiple Azure AD tenants. Additionally it also introduces developers to the concept of a [multi-tenant](https://docs.microsoft.com/azure/active-directory/develop/single-and-multi-tenant-apps) Azure Active Directory application. |
| 30 | + |
| 31 | +### Overview |
| 32 | + |
| 33 | +When it comes to developing apps, developers can choose to configure their app to be either single-tenant or multi-tenant during app registration in the [Azure portal](https://portal.azure.com). |
| 34 | + |
| 35 | +- `Single-tenant` apps are only available in the tenant they were registered in, also known as their home tenant. |
| 36 | +- `Multi-tenant` apps are available to users in both their home tenant and other tenants where they are provisioned. |
20 | 37 |
|
21 | 38 | For more information about apps and tenancy, see [Tenancy in Azure Active Directory](https://docs.microsoft.com/azure/active-directory/develop/single-and-multi-tenant-apps)
|
22 | 39 |
|
23 | 40 | 
|
24 | 41 |
|
| 42 | +## Scenario |
| 43 | + |
| 44 | +This sample shows how to build a .NET Core MVC web application that uses the [OpenID Connect](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-protocols-oidc) protocol to sign in users from multiple Azure AD tenants and acquire token for [Microsoft Graph](https://graph.microsoft.com) using the [Microsoft Authentication Library (MSAL)](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-overview). It leverages the ASP.NET Core OpenID Connect middleware. |
| 45 | + |
| 46 | +The application puts forward a scenario where a SaaS application invites the administrators of Azure AD tenants to `enrol` their tenants into this app. This process is analogous to a customer `buying` a SaaS product. |
| 47 | + |
| 48 | + 1. Once you start the application, it will ask you to sign-in as an administrator. If its your first time signing-in, you'd land on a page with a heading **Unauthorized Tenant**. Click on the **Take me to the onboarding process** button to onboard your tenant to this application. |
| 49 | + 1. Once you have **Registered your tenant** |
| 50 | + |
| 51 | +> Looking for previous versions of this code sample? Check out the tags on the [releases](../../releases) GitHub page. |
| 52 | +
|
| 53 | + |
25 | 54 | ## How to run this sample
|
26 | 55 |
|
27 | 56 | To run this sample:
|
28 | 57 |
|
29 | 58 | > Pre-requisites: Install .NET Core 2.2 or later (for example for Windows) by following the instructions at [.NET and C# - Get Started in 10 Minutes](https://www.microsoft.com/net/core). In addition to developing on Windows, you can develop on [Linux](https://www.microsoft.com/net/core#linuxredhat), [Mac](https://www.microsoft.com/net/core#macos), or [Docker](https://www.microsoft.com/net/core#dockercmd).
|
30 | 59 |
|
31 |
| -Ideally, you would want to have two Azure AD tenants so you can test the multi-tenant aspect of this sample. For more information on how to get an Azure AD tenant, see [How to get an Azure AD tenant](https://azure.microsoft.com/documentation/articles/active-directory-howto-tenant/). |
| 60 | +Ideally, you would want to have two Azure AD tenants so you can test all the aspects of this multi-tenant sample. For more information on how to get an Azure AD tenant, see [How to get an Azure AD tenant](https://azure.microsoft.com/documentation/articles/active-directory-howto-tenant/). |
32 | 61 |
|
33 | 62 | ### Step 1: Clone or download this repository
|
34 | 63 |
|
|
0 commit comments