FunctionsPublic/Find-GraphUserByEmailAddress.ps1
function Find-GraphUserByEmailAddress { param( [psobject]$accessToken, [string]$emailAddress ) # # Get user by email address # $responseBody = Invoke-RestMethod -Uri "https://graph.microsoft.com/v1.0/users/$($emailAddress)" -Headers @{"Authorization" = "Bearer $($accessToken.AccessTokenCredential.GetNetworkCredential().password)"} $jsonResponse = $responseBody | ConvertTo-JSON $users = ConvertFrom-Json -InputObject $jsonResponse return $users } |