In the Previous Article, we have used Graph Explorer to interact with Microsoft Cloud Workloads.
Introduction to Microsoft Graph API – Part 1
Introduction to Microsoft Graph API – Part 3
Let’s start using the cmdlets which is an ideal way for many things. So get it started
Registering An App for Auth Token for Microsoft Graph
Before we proceed with Application Registration, We should know why we need it. In the previous method, we signed in using Office 365 Account, which helped Graph Explorer to get the Auth token. How?
In the browser that has logged in to Graph Explorer, Click on Developer Tools or F12
In the Console, Type tokenPlease() to see the Auth token supplied to the Graph Explorer by the Browser.
Likewise, we need to provide the Auth token even using the Codes, to do that, we need to authenticate to the Azure Active Directory using the Access token which will help us to get the Auth Token. To generate the Access token using the codes, we are registering the application using the Azure Active Directory.
Login to https://portal.azure.com and click on Azure Active Directory
Click on App registrations
Click on New Registration
Enter the Name for the Application and select Accounts in this Organizational directory only
Enter the Redirect URI
Note: Since it is used for the Graph, we are not going to use the redirect URL for now, Hence it is not mandatory but still you can enter the web URL as http://localhost
Click on Register after all the required information has been provided
Now, it started creating the Application
Now you can see the application registration completed, copy the Application ID and Directory ID
Click on API permissions
Click on Add a permissions
Click on Microsoft Graph
Since we are going to Application to connect to call the reports without a signed-in user, Click on Application permissions
Now, It is time to provide the required permissions based on the requirements and the connections you need for your applications.
For now, we need user details, so provided only the read permissions for all users. Since it is given for all users, we require Administrator Consent
Introduction to Microsoft Graph API – Part 1