Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes subsequent failures after first successful Invoke-MgGraphRequest run when using national cloud environments #2971

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

timayabi2020
Copy link
Contributor

Fixes #2950
The fix provided here only works once when an absolute uri is passed to Invoke-MgGraphRequest cmdlet after connecting to a national cloud environment. Subsequent requests after the first successful one fails.

Changes proposed in this pull request

  • Added Microsoft graph context check in Find-MgGraphPermission in order to get the correct environment and extract the correct graph endpoint instead of using the default graph one (https://graph.microsoft.com) assigned to global environment.
  • Reset GraphSession environment back to its original state defined by the user.

Test scenarios.

  • Check that Find-MgGraphPermission does not default the session to the global graph endpoint after connecting to a national cloud environment.
  • Subsequent calls to graph endpoints do not fail after connecting to a national cloud environment.

NB: See attached image below for the above tests
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invoke-MGGraphRequest fails after first call as of v2.21.0 with USGov Environment
1 participant