Working with Microsoft GraphAPI using Powershell part 1

If you are an admin who is managing office 365 you must already know Graph API, but if you not I would suggest that you explore Graph API before it is too late.  Graph API is available in version 1.0 and beta phase, for more details you can go through the overview here.

You can also explore the possibility with the Graph Explorer here

In this post, I will walk you through a step by step process on how to work with Graph API using Powershell.

Prerequisites: Before you begin make sure you met the following requirement.

  • Install the Azure AD module
  • Register an APP in Azure Portal
  • Adequate rights for the API you are going to call
Step 1: Install the Azure AD module

>Install-Module AzureAD

Step 2: Register an APP in Azure Portal
  • login to https://portal.azure.com/#home , Click on "Azure Active Directory" >> "App registrations" >> New Application Registration
  • Provide the name, select application type as "Native" redirect URI as "https://localhost"
  • Click on Settings icon, and "RequiredPermissionss" click on "Windows Azure Active Directory" 
  • Select the Directory permissions which does not "require admin", you can go there once you well understand each permission scope.
  • Select and then click on save. 
  • Next click on Grant Permissions.

  • Next, click on Owners and add your admin ID as the app owner.

Once done copy the "Application ID" this we will use in the PowerShell script we are going to discuss in my next post.

This completes my first post of using Graph API, where we learned how to register the app in Azure AD in the next post we will learn how to get the auth token and get data from office 365 using PowerShell.

Comments