Link Search Menu Expand Document (external link)

Register an application for Microsoft identity platform authentication

To be able to authenticate with the Microsoft identity platform and get an access token for Microsoft Graph, you will need to create an application registration. You can install the Microsoft Graph PowerShell SDK and use it to create the app registration, or register the app manually in the Azure Active Directory admin center.

The following instructions register an app and enable device code flow for authentication. This is the authentication method used by the guides in this section.

Use PowerShell

Note: The PowerShell script requires an account with the Application administrator, Cloud application administrator, or Global administrator role. If your account has the Application developer role, you can register manually.

Connect-MgGraph -Scopes "Application.ReadWrite.All"
$app = New-MgApplication -displayName "NativeGraphApp" -IsFallbackPublicClient

Save the value of the AppId property of the $app object.

> $app.AppId
1cddd83e-eda6-4c65-bccf-920a86f220ab

Register manually

  1. Open a browser and navigate to the Azure Active Directory admin center. Login with your Azure account.
  2. Select Azure Active Directory in the left-hand navigation, then select App registrations under Manage.
  3. Select New registration. On the Register an application page, set the values as follows.

    • Set Name to NativeGraphApp.
    • Set Supported account types to Accounts in any organizational directory and personal Microsoft accounts.
    • Leave Redirect URI blank.
  4. Select Register. On the Overview page, copy the value of the Application (client) ID and save it.
  5. Select Authentication under Manage.
  6. Locate the Advanced settings section. Set the Allow public client flows toggle to Yes, then select Save.