Introduction to Microsoft Graph API – Part 2

In 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 ideal way for many things. So get it started

Registering An App for Auth Token

Before we proceed with Application Registration, We should know why do we need it?. In Previous method, we have signed in using Office 365 Account, which helped Graph Explorer to get the Auth token.. How?

In the browser which have logged in to the 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 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 web url as http://localhost

Click on Register after all the required information as 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 to user details, so provided only the read permissions for all users. Since it given for all users, we required Administrator Consent

Introduction to Microsoft Graph API – Part 1

Introduction to Microsoft Graph API – Part 2

Leave a Reply

Your email address will not be published. Required fields are marked *