msgraph-sdk-powershell
msgraph-sdk-powershell copied to clipboard
Include Environment used with Connect-MgGraph in the Get-MgContext output
When using the Connect-MgGraph -Environment, include the environment used on the output of Get-mgContext.
This can be used to identify the needed GraphEndpoints from Get-MgEnvironment dynamically based on connection context when issuing queries with Invoke-MgGraphRequest that don't support a relative URI.
IE $GraphEndpoint = (Get-MgEnvironment -Name ((Get-MgContext).Environment)).GraphEndpoint Invoke-MgGraphRequest -Method Get -URI "$GraphEndpoint/beta/me"
Hi @JefTek, we can include the configured environment to the output of Get-MgContext.
Invoke-MgGraphRequest is environment aware and should automatically change the host URL based on the configured environment when a relative URI is used. @georgend, why don't we support relative URI when using HTTP methods other than GET?