Skip to content

Commit 263f299

Browse files
committed
2 parents 2629286 + 3e0b29c commit 263f299

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

2-WebApp-graph-user/2-1-Call-MSGraph/Services/GraphServiceClientFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace WebApp_OpenIDConnect_DotNet.Services
99
public class GraphServiceClientFactory
1010
{
1111
public static GraphServiceClient GetAuthenticatedGraphClient(Func<Task<string>> acquireAccessToken,
12-
string baseUrl = null)
12+
string baseUrl)
1313
{
1414

1515
return new GraphServiceClient(baseUrl, new CustomAuthenticationProvider(acquireAccessToken));

2-WebApp-graph-user/2-4-Sovereign-Call-MSGraph/README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,17 @@ Starting from a .NET Core 2.2 MVC Web app that uses OpenID Connect to sign in us
1818

1919
![Sign in with the Microsoft identity platform for developers (formerly Azure AD v2.0)](ReadmeFiles/sign-in.png)
2020

21+
## How to run this sample
2122

22-
<!-- ## How to run this sample -->
23-
24-
<!-- To run this sample:
23+
To run this sample:
2524

2625
> Pre-requisites:
2726
>
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.
2928
3029
### Step 1: Register the sample with your Azure AD tenant
3130

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)
3332

3433
Then follow the following extra set of steps:
3534

@@ -51,29 +50,30 @@ If you have not already, clone this sample from your shell or command line:
5150

5251
```
5352

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
5554

5655
```Sh
57-
cd "2-WebApp-graph-user\2-1-Call-MSGraph"
56+
cd "2-WebApp-graph-user\2-4-Sovereign-Call-MSGraph"
5857
```
5958

6059
In the appsettings.json file, replace, if you have not already:
6160

6261
- 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
6463
- and the `ClientSecret` by the client secret you generated in Step 1.
6564

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
6766

6867
```JSon
69-
"GraphApiUrl": "https://graph.microsoft.com"
68+
"GraphApiUrl": "https://graph.microsoft.us"
7069
```
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).
7171

7272
### Step 3: Run the sample
7373

7474
1. Build the solution and run it.
7575

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.
7777

7878
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)
7979

@@ -103,7 +103,7 @@ The two new lines of code:
103103

104104
### Add additional files to call Microsoft Graph
105105

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+
Add the `Services\Microsoft-Graph-Rest\*.cs` files. This is an implementation of a custom service, which encapsulates 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.
107107

108108
```CSharp
109109
public interface IGraphApiOperations
@@ -115,7 +115,7 @@ public interface IGraphApiOperations
115115

116116
### Update the `Startup.cs` file to enable the Microsoft Graph custom service
117117

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.
118+
Still in the `Startup.cs` file, add the following lines just after the following. This line ensures that the GraphAPIService benefits from the optimized `HttpClient` management by ASP.NET Core.
119119

120120
```CSharp
121121
// Add Graph
@@ -210,9 +210,9 @@ HTML table displaying the properties of the *me* object as returned by Microsoft
210210
## Next steps
211211

212212
- Learn how to enable distributed caches in [token cache serialization](../2-2-TokenCache)
213-
- Learn how the same principle you've just learnt can be used to call:
213+
- Learn how the same principle you've learnt can be used to call:
214214
- [several Microsoft APIs](../../3-WebApp-multi-APIs), which will enable you to learn how incremental consent and conditional access is managed in your Web App
215-
- 3rd party, or even [your own Web API](../../4-WebApp-your-API), which will enable you to learn about custom scopes
215+
- Third party, or even [your own Web API](../../4-WebApp-your-API), which will enable you to learn about custom scopes
216216

217217
## Learn more
218218

0 commit comments

Comments
 (0)