FunctionsPublic/Remove-GraphMemberOfGroup.ps1

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

}