When adding Images, save them in the Images folder for your day
To complete this sample you need the following:
- Complete the Base Console Application Setup
- Visual Studio Code installed on your development machine. If you do not have Visual Studio Code, visit the previous link for download options. (Note: This tutorial was written with Visual Studio Code version 1.52.1. The steps in this guide may work with other versions, but that has not been tested.)
- .Net Core SDK. (Note This tutorial was written with .Net Core SDK 5.0.101. The steps in this guide may work with other versions, but that has not been tested.)
- C# extension for Visual Studio Code
- Either a personal Microsoft account with a mailbox on Outlook.com, or a Microsoft work or school account.
If you don't have a Microsoft account, there are a couple of options to get a free account:
- You can sign up for a new personal Microsoft account.
- You can sign up for the Office 365 Developer Program to get a free Office 365 subscription.
As this exercise requires new permissions the App Registration needs to be updated to include the <New-Permission-Here> permission using the new Azure AD Portal App Registrations UI.
-
Open a browser and navigate to the App registrations page within the Azure AD Portal. Login using a personal account (aka: Microsoft Account) or Work or School Account with permissions to create app registrations.
Note: If you do not have permissions to create app registrations contact your Azure AD domain administrators.
-
Click on the .NET Core Graph Tutorial item in the list
Note: If you used a different name while completing the Base Console Application Setup select that instead.
-
Click API permissions from the current blade content.
-
Click Add a permission from the current blade content.
-
On the Request API permissions flyout select Microsoft Graph.
-
Select [Application|Delegated] permissions.
-
In the "Select permissions" search box type "<Start of permission string>".
-
Select <New-Permission-Here> from the filtered list.
-
Click Add permissions at the bottom of flyout.
-
-
Back on the API permissions content blade, click Grant admin consent for <name of tenant>. need new screenshot here

- Click Yes.
In this step you will create a UserHelper class that encapsulates the logic for creating users and finding user objects by alias and then add calls to the console application created in the Base Console Application Setup to provision a new user.
-
Create a new file in the
Helpersfolder calledMyHelperFileName.cs. -
Replace the contents of
MyHelperFileName.cswith the following code:// Your code here
This class contains the code to ....
-
Inside the
Programclass add a new methodYourMethodwith the following definition. This method creates a new User in Azure Active Directory using the UserHelper class. This user will enableded and be required to change their password upon their next login.// Your code hereImportant Any key things to note where the developer might run into issues.
-
Continuing in the
Mainmethod add the following code to call the new method.YourMethod();
-
Save all files.
The console application is now able to <do some new thing>. In order to test the console application run the following commands from the command line:
dotnet build
dotnet run
Summary of what the thing that can be done is.
