Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Making Graph calls with PnP PowerShell via App-Only Certificates
Connect-PnPOnline -ClientId "<AppId>" -CertificatePath "<C:\...\Cert\cerificate.pfx>" `
-CertificatePassword (ConvertTo-SecureString -AsPlainText "<pw>" -Force) `
-Url "https://<tenant>" -Tenant "<id>"
$token = Get-PnPGraphAccessToken
# Create header
$header = @{
Authorization = "Bearer $($token)"
$uri = '$filter=resourceProvisioningOptions/Any(x:x eq ''Team'')&select=id,resourceProvisioningOptions'
# Make a simple rest call
$response = Invoke-RestMethod -Uri $uri -Headers $header -Method Get -ContentType "application/json"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment