You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 2-WebApp-graph-user/2-4-Sovereign-Call-MSGraph/README.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,18 +18,17 @@ Starting from a .NET Core 2.2 MVC Web app that uses OpenID Connect to sign in us
18
18
19
19

20
20
21
+
## How to run this sample
21
22
22
-
<!-- ## How to run this sample -->
23
-
24
-
<!-- To run this sample:
23
+
To run this sample:
25
24
26
25
> Pre-requisites:
27
26
>
28
-
> go through the previous phase of the tutorial showing how the [WebApp signs-in users with Microsoft Identity (OIDC) / with work and school or personal accounts](../../1-WebApp-OIDC/1-3-AnyOrgOrPersonal). This page shows the incremental change required to call the Microsoft Graph API on behalf of a user that has successfully signed in to the web app.
27
+
> go through the previous phase of the tutorial showing how the [WebApp signs-in users with Microsoft Identity (OIDC) / with work and school](../../1-WebApp-OIDC/1-2-AnyOrg). This page shows the incremental change required to call the Microsoft Graph API on behalf of a user that has successfully signed in to the web app.
29
28
30
29
### Step 1: Register the sample with your Azure AD tenant
31
30
32
-
You first need to [register](https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/tree/aspnetcore2-2#step-1-register-the-sample-with-your-azure-ad-tenant) your app as described in [the first tutorial](https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/tree/aspnetcore2-2)
31
+
You first need to [register](https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/tree/master/1-WebApp-OIDC/1-4-Sovereign#step-2-register-the-sample-with-your-azure-ad-tenant) your app as described in [Web app signing-in users in Sovereign](hhttps://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/tree/master/1-WebApp-OIDC/1-4-Sovereign#scenario)
33
32
34
33
Then follow the following extra set of steps:
35
34
@@ -51,29 +50,30 @@ If you have not already, clone this sample from your shell or command line:
51
50
52
51
```
53
52
54
-
Go to the `"2-WebApp-graph-user\2-1-Call-MSGraph"` folder
53
+
Go to the `"2-WebApp-graph-user\2-4-Sovereign-Call-MSGraph"` folder
In the appsettings.json file, replace, if you have not already:
61
60
62
61
- the `ClientID` value with the *Application ID* from the application you registered in Application Registration portal,
63
-
- the `TenantId` by `common`, as here you chose to sign-in users with their work or school or personal account. In case you want to sign-in different audiences, refer back to the first phase of the tutorial
62
+
- the `TenantId` by `organizations`, as here you chose to sign-in users with their work or school account. In case you want to sign-in different audiences, refer back to the first phase of the tutorial
64
63
- and the `ClientSecret` by the client secret you generated in Step 1.
65
64
66
-
- In case you want to deploy your app in Sovereign or national clouds, ensure the `GraphApiUrl` option matches the one you want. By default this is Microsoft Graph in the Azure public cloud
65
+
- The `GraphApiUrl`for US Government cloud is
67
66
68
67
```JSon
69
-
"GraphApiUrl": "https://graph.microsoft.com"
68
+
"GraphApiUrl": "https://graph.microsoft.us"
70
69
```
70
+
In case you want to deploy your app in other sovereign or national clouds, go to [Microsoft Graph service root endpoints](https://docs.microsoft.com/en-us/graph/deployments#microsoft-graph-and-graph-explorer-service-root-endpoints).
71
71
72
72
### Step 3: Run the sample
73
73
74
74
1. Build the solution and run it.
75
75
76
-
2. Open your web browser and make a request to the app. The app immediately attempts to authenticate you via the Microsoft identity platform (fomerly Azure AD v2.0) endpoint. Sign in with your personal account or with a work or school account.
76
+
2. Open your web browser and make a request to the app. The app immediately attempts to authenticate you via the Microsoft identity platform (formerly Azure AD v2.0) endpoint. Sign in with your personal account or with a work or school account.
77
77
78
78
3. Go to the **Profile** page, you should now see all kind of information about yourself as well as your picture (a call was made to the Microsoft Graph */me* endpoint)
79
79
@@ -103,7 +103,7 @@ The two new lines of code:
103
103
104
104
### Add additional files to call Microsoft Graph
105
105
106
-
Add the `Services\Microsoft-Graph-Rest\*.cs` files. This is an implementation of a custom service which encapsultes the call to the Microsoft Graph /me endpoint. Given an access token for Microsoft Graph, it's capable of getting the user information and the photo of the user.
106
+
Addthe `Services\Microsoft-Graph-Rest\*.cs` files. Thisisanimplementationofacustomservice,whichencapsulatesthecalltotheMicrosoftGraph/meendpoint. GivenanaccesstokenforMicrosoftGraph, it's capable of getting the user information and the photo of the user.
107
107
108
108
```CSharp
109
109
publicinterfaceIGraphApiOperations
@@ -115,7 +115,7 @@ public interface IGraphApiOperations
115
115
116
116
### Update the `Startup.cs` file to enable the Microsoft Graph custom service
117
117
118
-
Still in the `Startup.cs` file, add the following lines just after the following. This lines ensures that the GraphAPIService benefits from the optimized `HttpClient` management by ASP.NET Core.
0 commit comments