Skip to content

Instantly share code, notes, and snippets.

Embed
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>.sharepoint.com/sites/TheCoolTeam" -Tenant "<id>"
$token = Get-PnPGraphAccessToken
# Create header
$header = @{
Authorization = "Bearer $($token)"
}
#v1.0/Beta
$uri = 'https://graph.microsoft.com/beta/groups?$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"
$response.Value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment