Skip Ribbon Commands
Skip to main content

Quick Launch

Todd Klindt's home page > Todd Klindt's Office 365 Admin Blog > Posts > Calling Microsoft Graph with PnP PowerShell
April 15
Calling Microsoft Graph with PnP PowerShell

As an M365 Admin it’s not tough to see that the future is hidden somewhere in the Microsoft Graph. And this particular M365 Admin would like to get there using his favorite tool, PowerShell. Microsoft released the Graph SDK, but it didn’t really scratch the itch for me. I found it confusing and really tough to use. But, as much as I ignored it, the Graph didn’t go away. With increased frequency there would be some little tidbit of information I’d want and the answer would be, “It’s in the Graph.” Grrrrr.

I was poking the M365 PnP Samples and stumbled across this little gem, Authenticate with and call the Microsoft Graph. That looked promising, I can work with that. I fired up PowerShell, loaded the PnP.PowerShell, fired up the Graph Explorer and started working.

It went well enough that I wrote a little wrapper function around it and published it to GitHub. It’s called Get-TKPnPGraphURI and it looks like this:

image

Get-TKPnPGraphURI -uri https://graph.microsoft.com/v1.0/me/

Get-TKPnPGraphURI -uri https://graph.microsoft.com/v1.0/users | select displayName,userPrincipalName,id

It uses PnP.PowerShell, so you’ll need that module installed, and you’ll need to connect with Connect-PnPOnline. From there you can pass it any Graph endpoint, v1.0 or beta. You can find out what the endpoints are at the Graph Explorer.  Right now this only supports Gets. You’ll also have to manually put in any parameters or filters. I’ve added help and examples. I hope to expand them both in the future.

The output is a stand PSCustomObject, so you can send its output down the pipeline however you’d like. Select-Object, Where-Object, Sort-Object, the world is your oyster.

Let me know if this is useful and what you’re doing with it.

tk

ShortURL: https://www.toddklindt.com/PoshMSGraph

Comments

Bot blocker

Too bad the comment bots can't be blocked. ;(
 on 6/10/2022 3:16 PM

Microsoft

I was looking for types of referencing style and found a team of experts who helped me out and gave me quality work, their link is given below. PnP PowerShell is a . NET Core 3.1 / . NET Framework 4.6. 1 based PowerShell Module providing over 600 cmdlets that work with Microsoft 365 environments such as SharePoint Online, Microsoft Teams, Microsoft Project, Security & Compliance, Azure Active Directory, and more.
 on 7/8/2022 2:17 AM

Delhi Escorts

At Delhi Call girls, we understand the need for privacy and discretion. Our services are tailored to ensure your complete satisfaction while maintaining the utmost confidentiality. https://www.ayushikapoor.com/ Our escorts are well-versed in the art of companionship, and they’re here to make your fantasies a reality.
 on 9/30/2023 7:36 AM

Delhi Escorts Service

Jobs in Delhi Escort Agency will take money from you and you will find your partner after sucking you. As far as the company for customers is concerned. The company will provide you with a very good partner. Now it depends on you which partner you like. You can do this process by looking at the profile of the girl. https://www.preetkaur.in/  There is no point in cheating someone, if you want, you will get the same.
 on 10/3/2023 2:50 AM

Delhi Escorts Service

An idea to change lifestyle! Erotic moments to discover pleasure in life provided by beautiful escort services in Delhi ta Mayur Vihar If living these moments with her while dating, partying, playing, or have a sensual discovery of touch and feel. https://www.hotelescortsnearme.com/ Offer secure cuddle according to escort in Delhi choice keep patience, discover most relaxed moments to find the thrilling, exciting, intimate experiences.
 on 10/3/2023 5:03 AM

Service  Provider

Mahipalpur  Female Escort Services, wherein you may come upon good-looking unbiased call women of all paperwork, dimensions, length, body weight, man or woman. https://www.classykajol.com/mahipalpur-escorts-service.html We take into account in imparting the fine without any bargain.
 on 12/1/2023 2:20 AM

service

Indian girls are among the most attractive in India. This is a fact that you can easily find in any search engine. In our  Escorts in Delhi, girls get recruited based on their ability and field of interest. You can trust that the girl you choose will be your friend and make your dreams come true. Our  Delhi  Escorts girls are beautiful and perfect and honest and will give you genuine love and satisfaction.
https://www.alpanaroy.com/
 on 12/7/2023 1:54 AM

Great

The code is working. Thanks. https://sellmyhousenj.com/
 on 12/18/2023 11:25 PM

Great

Sell My House OK is the premier destination for homeowners in Oklahoma seeking a professional and trustworthy solution to sell their homes quickly and hassle-free. https://sellmyhouseok.com/
 on 12/19/2023 12:07 AM

Awesome!

Affordable Fence Installation Oklahoma City has served hundreds of families from El Reno and Yukon to Midwest City. https://affordablefenceok.com/
 on 12/19/2023 12:11 AM
1 - 10Next

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Today's date *

Select a date from the calendar.
Please enter today's date so I know you are a real person

Twitter


Want a message when I reply to your comment? Put your Twitter handle here.

Attachments

 

 SysKit