Scripts · PowerShell

SimpleGraph

A lightweight PowerShell module for calling any Microsoft Graph endpoint with simple GET, POST, PATCH, and DELETE cmdlets.

View on GitHub

What it is

A single-file PowerShell module (SimpleGraph.psm1) that makes web calls to the Microsoft Graph REST API. It provides Connect-SimpleGraph for delegated, client-secret, or client-certificate sign-in through the MSAL.PS module, plus Get-, New-, Set-, and Remove-SimpleGraphObject, Invoke-SimpleGraphRequest, and Get-SimpleGraphReport for reading, creating, updating, deleting, sending custom calls, and pulling usage reports.

Why use it

  • Call any Graph endpoint without waiting for a matching Microsoft Graph PowerShell SDK cmdlet.
  • Use the same few cmdlets for reads, creates, updates, deletes, and custom requests, with inline help for each.
  • Pull Microsoft 365 usage reports from Graph, such as active user counts by workload for the last 7, 30, 90, or 180 days, as PowerShell objects.

How to use it

  1. Install MSAL.PS (Install-Module MSAL.PS) and register an Entra application with the redirect URI https://login.microsoftonline.com/common/oauth2/nativeclient for delegated sign-in.
  2. Download SimpleGraph.psm1 and import it, then connect with the scopes your calls need:
Import-Module "C:\Users\you\Scripts\SimpleGraph.psm1"
Connect-SimpleGraph -ClientId "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" -TenantId "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" -Scopes "User.Read.All", "Group.Read.All"
Get-SimpleGraphObject users/you@domain.com

Prerequisites

  • MSAL.PS PowerShell module
  • Microsoft Entra application registration (a client secret or certificate plus Graph application permissions for app-only use)
  • Graph permissions that match the calls you make