FunctionsPublic/Remove-GraphMemberOfGroup.ps1
1 2 3 4 5 6 7 8 9 10 11 |
function Remove-GraphMemberOfGroup { param([psobject]$accessToken, [string]$groupID, [string]$userID) $responseBody = Invoke-RestMethod ` -Uri "https://graph.microsoft.com/v1.0/groups/$($groupID)/members/$($userID)/`$ref" ` -Headers @{"Authorization" = "Bearer $($accessToken.AccessTokenCredential.GetNetworkCredential().password)"} ` -ContentType "application/json" ` -Method DELETE } |