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

Fix AAD 401 authentication errors against GCC high tenants #1266

Merged
merged 14 commits into from
Aug 8, 2024

Conversation

tkol2022
Copy link
Collaborator

@tkol2022 tkol2022 commented Aug 7, 2024

🗣 Description

This PR fixes the problem when running AAD against GCC high tenants with newer versions of the Graph dependency modules. We started getting 401 Unauthorized errors against GCC high because there was some problem with the token that we traced to Invoke-MgGraphRequest. The fix was to pass the MS graph FQDN prefix when calling that cmdlet and that seems to rectify the issue.

Closes #1265

🧪 Testing

  • Test against all tenants, including GCC high.
  • Run AAD with other products and by itself.
  • Run ScubaGear with a config file as well.

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • PR targets the correct parent branch (e.g., main or release-name) for merge.
  • Changes are limited to a single goal - eschew scope creep!
  • Changes are sized such that they do not touch excessive number of files.
  • All future TODOs are captured in issues, which are referenced in code comments.
  • These code changes follow the ScubaGear content style guide.
  • Related issues these changes resolve are linked preferably via closing keywords.
  • All relevant type-of-change labels added.
  • All relevant project fields are set.
  • All relevant repo and/or project documentation updated to reflect these changes.
  • Unit tests added/updated to cover PowerShell and Rego changes.
  • Functional tests added/updated to cover PowerShell and Rego changes.
  • All relevant functional tests passed.
  • All automated checks (e.g., linting, static analysis, unit/smoke tests) passed.

✅ Pre-merge checklist

  • PR passed smoke test check.

  • Feature branch has been rebased against changes from parent branch, as needed

    Use Rebase branch button below or use this reference to rebase from the command line.

  • Resolved all merge conflicts on branch

  • Notified merge coordinator that PR is ready for merge via comment mention

✅ Post-merge checklist

  • Feature branch deleted after merge to clean up repository.
  • Verified that all checks pass on parent branch (e.g., main or release-name) after merge.

…nd added the M365Environment command line parameter to support changing the endpoint FQDN based on the type of tenant
@tkol2022 tkol2022 added the bug This issue or pull request addresses broken functionality label Aug 7, 2024
@tkol2022 tkol2022 requested a review from dagarwal-mitre August 7, 2024 17:29
@tkol2022 tkol2022 self-assigned this Aug 7, 2024
@tkol2022 tkol2022 linked an issue Aug 7, 2024 that may be closed by this pull request
@schrolla schrolla self-requested a review August 8, 2024 13:51
Copy link
Collaborator

@schrolla schrolla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some minor requests to remove a debug statement and comment fixes. But the functional testing I did showed SG worked as expected. As requested, I ran:

  • ScubaGear with just the AAD product against all test tenants (passed)
  • ScubaGear using a config file for parameters with AAD as well as other products (passed)
  • ScubaGear with all pairings of other products (passed)
  • ScubaGear with all products against all test tenants (passed)
  • ScubaGear
  • Ran workflow unit tests (including those for Initialize-SCuBA) manually using Pester and all passed as expected.

PowerShell/ScubaGear/Modules/Support/Support.psm1 Outdated Show resolved Hide resolved
PowerShell/ScubaGear/Modules/Support/Support.psm1 Outdated Show resolved Hide resolved
@schrolla schrolla changed the title Fixes AAD 401 authentication errors against GCC high Fix AAD 401 authentication errors against GCC high tenants Aug 8, 2024
@tkol2022
Copy link
Collaborator Author

tkol2022 commented Aug 8, 2024

Functional tests ran against the branch.

image

tkol2022 and others added 2 commits August 8, 2024 12:03
Co-authored-by: Addam Schroll <108814318+schrolla@users.noreply.github.com>
Co-authored-by: Addam Schroll <108814318+schrolla@users.noreply.github.com>
Copy link
Collaborator

@dagarwal-mitre dagarwal-mitre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, checked with different tenants and SP.

@james-garriss
Copy link
Collaborator

FYI...the changes made to support.psm1 are in response to a previous PR (#1261) that attempted to fix a problem when initializing SG. Unfortunately, it created a new problem with the functional tests that was only now discovered. The changes in support fix both problems, ensuring that the right module path is used no matter where SG is initialized from.

@nanda-katikaneni
Copy link
Collaborator

One more data point in testing for this PR/branch: aad tests on gccchigh ran fine with this branch (with rc there 401 failure); functional tests also running fine on gcchigh with this branch.

@schrolla schrolla added this to the Iceberg milestone Aug 8, 2024
@nanda-katikaneni nanda-katikaneni merged commit 2e945ba into main Aug 8, 2024
22 checks passed
@nanda-katikaneni nanda-katikaneni deleted the 1265-aad-generates-a-401-against-gcc-high branch August 8, 2024 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue or pull request addresses broken functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AAD generates a 401 unauthorized when running against GCC High tenants
5 participants