r/PowerShell • MVP, Community Blogger • Oct 13 '26

Solved How to Retrieve SharePoint Sites with the Microsoft Graph PowerShell SDK

If you use the Microsoft Graph PowerShell SDK, you might know that the Graph APIs for SharePoint sites sometimes need a little help. For instance, finding a set of sites to process can be problematic because the APIs do not support extensive filtering capabilities. The solution is to use other Microsoft 365 cmdlets to find objects associated with sites. Inserting an intermediate step might seem crazy, but it can be the most effective way of solving the problem.

https://office365itpros.com/2026/10/13/get-sharepoint-sites/

19 Upvotes

12 comments sorted by

10

u/AdeelAutomates Oct 13 '26

SharePoint is when I ditched the sdk.

I will use graph for basic entra work but everything else... I am fully on board to just get to the source (API) then go through cmdlets that are a second thought (most of them are auto generated) as you can see from this monstrosity:

Get-MgBetaIdentityGovernanceCatalogAccessPackageResourceScopeAccessPackageResourceAccessPackageResourceRoleAccessPackageResource

lolll

2

u/Unlikely_Tie1172 MVP, Community Blogger Oct 13 '26

Yep. That's what happens when an automatic generation process reads Graph metadata and constructs cmdlet names from that data. Humans couldn't be that silly, could they?

1

u/BlackV Oct 13 '26

and how is it so bad at generating help on top of that

1

u/Unlikely_Tie1172 MVP, Community Blogger Oct 13 '26

Same reason. A lot of the help is auto-generated based on the metadata and documentation for the Graph APIs. Some of the critical stuff is hand-edited, but the rest isn't. And you can tell.

1

u/BlackV Oct 13 '26

Absolutely, that was the supposed advantage of the entra module, but I don't know how actively that is maintained by Microsoft i don't know

1

u/Unlikely_Tie1172 MVP, Community Blogger Oct 14 '26

The Entra module is maintained by Microsoft, but how much TLC the module received is doubtful. It was conceived to solve a problem - to help tenants move from the old Azure AD modules - and that time is long gone.

1

u/BlackV Oct 14 '26

Ya it was long gone before they released the module too

But it was good that one of the goals was to use graph underneath and still provide real curated help

1

u/Unlikely_Tie1172 MVP, Community Blogger Oct 14 '26

True, but given the lack of resources assigned by Microsoft to do anything but Copilot, it seems like less focus is on projects like the Entra module.

2

u/BlackV Oct 13 '26

What a bad day to have eyes.....

2

u/purplemonkeymad Oct 14 '26

Don't forget the much useful help there is for this specific command:

Get accessPackageResource from identityGovernance

And also the ever useful notes in the input and output sections:

{{ Fill in the Description }}

1

u/FeleaseRpseineEiles Oct 13 '26

and now with even moar copilot

2

u/Cadder Oct 13 '26

Yeah. Sharepoint by Powershell is weird all round.