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/microsoft-graph-operations.md
+1-55Lines changed: 1 addition & 55 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -218,62 +218,8 @@ You can manage Microsoft Graph in two ways:
218
218
> [!NOTE]
219
219
> Delegated permissions for users signing in through user flows or custom policies can't be used against delegated permissions for Microsoft Graph API.
220
220
221
-
## Code sample: How to programmatically manage user accounts
222
-
223
-
This code sample is a .NET Core console application that uses the [Microsoft Graph SDK](/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.
224
-
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:
231
-
232
-
1. Open the project in [Visual Studio](https://visualstudio.microsoft.com) or [Visual Studio Code](https://code.visualstudio.com).
233
-
1. Open `src/appsettings.json`.
234
-
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. For more information, see [Register a Microsoft Graph Application](microsoft-graph-get-started.md).
235
-
1. Open a console window within your local clone of the repo, switch into the `src` directory, then build the project:
236
-
237
-
```console
238
-
cd src
239
-
dotnet build
240
-
```
241
-
242
-
1. Run the application with the `dotnet` command:
243
-
244
-
```console
245
-
dotnet bin/Debug/netcoreapp3.1/b2c-ms-graph.dll
246
-
```
247
-
248
-
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.
249
-
250
-
> [!NOTE]
251
-
> For the application to update user account passwords, you need to [grant the user administrator role](microsoft-graph-get-started.md#optional-grant-user-administrator-role) to the application.
252
-
253
-
### Code discussion
254
-
255
-
The sample code uses the [Microsoft Graph SDK](/graph/sdks/sdks-overview), which is designed to simplify building high-quality, efficient, and resilient applications that access Microsoft Graph.
256
-
257
-
Any request to the Microsoft Graph API requires an access token for authentication. The solution makes use of the [Microsoft.Graph.Auth](https://www.nuget.org/packages/Microsoft.Graph.Auth/) NuGet package that provides an authentication scenario-based wrapper of the Microsoft Authentication Library (MSAL) for use with the Microsoft Graph SDK.
258
-
259
-
The `RunAsync` method in the _Program.cs_ file:
260
-
261
-
1. Reads application settings from the _appsettings.json_ file
262
-
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.
263
-
1. Sets up the Microsoft Graph service client with the auth provider:
264
-
265
-
The previously published sample code isn't available at this time.
The initialized _GraphServiceClient_ is then used in _UserService.cs_ to perform the user management operations. For example, getting a list of the user accounts in the tenant:
269
-
270
-
The previously published sample code isn't available at this time.
[Make API calls using the Microsoft Graph SDKs](/graph/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.
274
-
275
221
## Related content
276
-
- For code samples in JavaScript and Node.js, please see: [Manage B2C user accounts with MSAL.js and Microsoft Graph SDK](https://github.com/Azure-Samples/ms-identity-b2c-javascript-nodejs-management)
222
+
-Explore [Microsoft Graph API](/graph/overview)
277
223
- Explore [Graph Explorer](https://aka.ms/ge) that lets you try Microsoft Graph APIs and learn about them.
0 commit comments