Introduction to Microsoft Graph API

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

Graph

In the Console, Type tokenPlease() to see the Auth token supplied to the Graph Explorer by the Browser.

Graph

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

Graph

Click on App registrations

Graph

Click on New Registration

Graph

Enter the Name for the Application and select Accounts in this Organizational directory only

Graph

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

Graph

Now, it started creating the Application

Graph

Now you can see the application registration completed, copy the Application ID and Directory ID

Graph

Click on API permissions

Graph

Click on Add a permissions

Graph

Click on Microsoft Graph

Graph

Since we are going to Application to connect to call the reports without a signed-in user, Click on Application permissions

Graph

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

Graph
Graph
Graph

Introduction to Microsoft Graph API – Part 1

Introduction to Microsoft Graph API – Part 2

#AzureAD #MicrosoftGraph #powershell

Leave a comment

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