Graph Week – Getting Started with Graph and PowerShell!

Welcome to Graph week! This week we are going to look at how we can automate common tasks with PowerShell and Microsoft Graph. To help us out, I am working on cmdlets called the MSGraphAPI cmdlets. They are in beta now, but far enough along to do anything you need to do in Graph!

What is Microsoft Graph? Graph is one endpoint to manage multiple Microsoft APIs. What do I mean by that? In the Graph cmdlets, you can simply run the Get-GraphAuthenticationToken once, and are then able to pull information from Intune, Azure AD, SharePoint, Office 365, and any other service Graph ties into! The purpose of the Graph cmdlets is to let you access this information without having to install and learn multiple cmdlets!

So, how do you get started with these cmdlets? First, install them from the PowerShell Gallery. If you are on Windows 10 or have PowerShell 5 installed, you can run this command to install them:

Now that you have them installed, you can begin using them! You’ll first need to log into the cmdlets with the Get-GraphAuthenticationToken. You’ll need the credentials of a user who can do what you want to do (imagine that!) and your Azure AD tenant name. Here’s the code I always use to call this function:

Now that you’re authenticated, try using the cmdlets! Give Get-GraphUsers a shot and see it spit out a list of all your Azure AD users!

And that’s where I’ll leave you for today! Join us tomorrow when we explore the Graph cmdlets more in-depth and take a look at the objects you’re getting back!

Bookmark the permalink.

One Comment

  1. Pingback: Graph Week - Exploring the MSGraphAPI Cmdlets - EphingAdmin

Leave a Reply

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