Public/Graph/Get-GraphUser.ps1
function Get-GraphUser { [CmdletBinding()] param ( [Parameter()] $UserId ) if ([datetime]::UtcNow -ge $TimeToRefresh) { Connect-PoshGraphRefresh } $RestSplat = @{ Uri = 'https://graph.microsoft.com/beta/users/{0}' -f $UserId Headers = @{ "Authorization" = "Bearer $Token" } Method = 'Get' } Invoke-RestMethod @RestSplat -Verbose:$false } |