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: articles/active-directory-b2c/manage-user-accounts-graph-api.md
+40-56Lines changed: 40 additions & 56 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,24 +98,29 @@ Microsoft Graph API supports creating and updating a user with extension attribu
98
98
## Code sample
99
99
100
100
This code sample is a .NET Core console application that uses the [Microsoft Graph SDK](https://docs.microsoft.com/graph/sdks/sdks-overview) to interact with Microsoft Graph API. Its code demonstrates how to call the API to programmatically manage users in an Azure AD B2C tenant.
101
-
You can [download the sample archive](https://github.com/Azure-Samples) (*.zip), [browse the repository](https://github.com/Azure-Samples) on GitHub, or clone the repository:
101
+
You can [download the sample archive](https://github.com/Azure-Samples/ms-identity-dotnetcore-b2c-account-management/archive/master.zip) (*.zip), [browse the repository](https://github.com/Azure-Samples/ms-identity-dotnetcore-b2c-account-management) on GitHub, or clone the repository:
After you've obtained the code sample, configure it for your environment and then build the project:
108
108
109
-
1. Open the solution in [Visual Studio](https://visualstudio.microsoft.com) or [Visual Studio Code](https://code.visualstudio.com).
110
-
1. Open `appsettings.json`.
111
-
1. Under the `appSettings` section, replace `{your-b2c-tenant}` with the name of your tenant, and `{Application ID}` and `{Client secret}` with the values for your management application registration (see the [Register a management application](#register-a-management-application) section of this article).
112
-
1. The console application can be found in `bin\Debug\netcoreapp3.0` folder. To run the application, run following command:
109
+
1. Open the project in [Visual Studio](https://visualstudio.microsoft.com) or [Visual Studio Code](https://code.visualstudio.com).
110
+
1. Open `src/appsettings.json`.
111
+
1. In the `appSettings` section, replace `your-b2c-tenant` with the name of your tenant, and `Application (client) ID` and `Client secret` with the values for your management application registration (see the [Register a management application](#register-a-management-application) section of this article).
112
+
1. Open a console window within your local clone of the repo, switch into the `src` directory, then build the project:
113
+
```console
114
+
cd src
115
+
dotnet build
116
+
```
117
+
1. Run the application with the `dotnet` command:
113
118
114
-
```cmd
115
-
dotnet aad-b2c-graph.dll
119
+
```console
120
+
dotnet bin/Debug/netcoreapp3.0/b2c-ms-graph.dll
116
121
```
117
122
118
-
The application will show you list of commands you can use. For example: List users, Get a user, delete user, update user's password, and create bulk users.
123
+
The application displays a list of commands you can execute. For example, get all users, get a single user, delete a user, update a user's password, and bulk import.
119
124
120
125
### Code discussion
121
126
@@ -125,71 +130,50 @@ Any request to the Microsoft Graph API requires an access token for authenticati
125
130
126
131
The `RunAsync` method in the _Program.cs_ file:
127
132
128
-
1. Reads application settings from the _appSettings.json_ file
133
+
1. Reads application settings from the _appsettings.json_ file
129
134
1. Initializes the auth provider using [OAuth 2.0 client credentials grant](../active-directory/develop/v2-oauth2-client-creds-grant-flow.md) flow. With the client credentials grant flow, the app is able to get an access token to call the Microsoft Graph API.
130
-
1.Next, it sets up the Microsoft Graph service client with the auth provider:
135
+
1.Sets up the Microsoft Graph service client with the auth provider:
TheMicrosoftGraphSDKservicelibrariesprovideaclientclassthat you can use as the starting point for creating all API requests. Learn how to [Make API calls using the Microsoft Graph SDKs](https://docs.microsoft.com/graph/sdks/create-requests).
[Make API calls using the Microsoft Graph SDKs](https://docs.microsoft.comgraph/sdks/create-requests) includes information on how to read and write information from Microsoft Graph, use `$select` to control the properties returned, provide custom query parameters, and use the `$filter` and `$orderBy` query parameters.
0 commit comments