Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get a list of groups that is associated to a team
Connect-PnPOnline -ClientId c53eb8da-8bdf-44f9-8718-1fb1bbbbbb `
-Thumbprint EC1E61510AEC35624AF78FEA763D00000000 `
-Tenant "tenant.co.uk" -Url "https://tenant.sharepoint.com"
$token = Get-PnPGraphAccessToken
# Create header with the access token
$header = @{ Authorization = "Bearer $($token)" }
#v1.0/Beta
$uri = 'https://graph.microsoft.com/Beta/groups' + `
'?$filter=resourceProvisioningOptions/Any(x:x eq ''Team'')' +
'&select=id,displayName'
# Make a simple rest call
$response = Invoke-RestMethod -Uri $uri -Headers $header -Method Get -ContentType "application/json"
# Lets see the result
$response.Value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.