Add device-code auth fallback to Connect-FabricAccount - #201
Open
Theragus wants to merge 1 commit into
Open
Conversation
When interactive/broker (WAM) sign-in fails, e.g. because a terminal host (Warp on Windows was the reported case) can't provide WAM a window handle to parent its account picker to, Connect-AzAccount can throw instead of showing any UI, causing Connect-FabricAccount to fail silently. Wrap the interactive sign-in call in try/catch and retry with Connect-AzAccount -UseDeviceAuthentication on failure, so users get a usable device-code prompt instead of a hard failure. Also add a -UseDeviceAuthentication switch for explicit opt-in. Thanks for taking a look! Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Collaborator
|
Thanks for your contribution, @Theragus. Please look at the build errors and fix them if you can. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Pull Request (PR) description
Connect-FabricAccountcan fail silently in some terminal hosts when interactive/broker (WAM) sign-in can't display its account picker — e.g. Warp on Windows, which doesn't expose a window handle for WAM to parent its UI to.Connect-AzAccountthrows instead of showing anything, and that failure previously propagated straight out ofConnect-FabricAccountwith no recovery path.This PR adds an automatic fallback to device code authentication when the interactive sign-in attempt fails, plus a
-UseDeviceAuthenticationswitch for explicit opt-in.No related issue is linked — the underlying WAM failure turned out to be intermittent/hard to reproduce on demand across different terminal hosts (Warp, Git Bash/mintty both completed sign-in fine via Az.Accounts' own browser fallback once retried), so this is a proactive resiliency fix rather than a direct fix for a filed bug.
Added
-UseDeviceAuthenticationswitch toConnect-FabricAccountto force device code authentication instead of the interactive broker/browser flowFixed
Connect-FabricAccountnow automatically falls back to device code authentication when interactive/broker (WAM) sign-in fails, e.g. in terminal hosts such as Warp on Windows where the account picker cannot renderTask list
build.ps1 -ResolveDependency -Tasks build, test).Notes on unchecked items
Invoke-Pester ./tests/Unit/Connect-FabricAccount.Tests.ps1passes 10/10 against the built module. I did not check this box because the full suite (./build.ps1 -Tasks build,test) has pre-existing failures unrelated to this change: Integration tests require a live Fabric session/capacity (not available in this environment), andGet-FabricWorkspaceUser.Tests.ps1has a pre-existing mandatory-parameter mismatch unrelated to this PR.docs/en-US/Connect-FabricAccount.mdwas intentionally left untouched../build.ps1 -Tasks Generate_help_from_built_modulein my environment picks up a pre-installed higher-version copy ofFabricToolsinstead of the local build, which produces an unrelated repo-wide diff across all cmdlets' docs instead of just this one. Happy to add a manually-written doc update for justConnect-FabricAccountif maintainers would like one included before merge.