In continuation of my previous blog – Register an app with the Azure Active Directory v2.0 endpoint – demonstrating how to create an Application Type: Native app within Azure.
Create a Native app
-
- Step 1: Create
-
-
-
- Login to portal.azure.com
- Go to Azure Active Directory > App registrations > New Application Registration
- In the Name field, give a descriptive name
- Choose Native
- For Sign-on Url: Here it doesn’t matter – give http://localhost:12345
- Click on Create.
-
-
-
- Step 2: Configure
-
-
-
- Once the App is created, click on Settings
- Please note that here there is no way to set a Key as a Client Secret – why? the explanation is given on the difference between Native app & Web app
- Under Required permissions, based on all available API, set all necessary permissions you need to, please note here that after settings up permissions, you/AAD Admin need to “Grant” them explicitly otherwise, it will not work.
-
-
-
- Step 3: Take Note
-
-
-
- Application ID – which is the Client ID
- Tenant ID => Azure Active Directory > Properties > Directory ID
-
-
Native App – Usage
Here the code is straightforward:
A. Get Access Tokenpublic static string GetAccessToken() |
B. Get GraphServiceClientpublic static GraphServiceClient GetGraphClient(string graphToken) |