[Connect-MgGraph] -UseDeviceCode
parameter should write output to host console
#2798
Labels
-UseDeviceCode
parameter should write output to host console
#2798
Is your feature request related to a problem? Please describe the problem.
I utilize
Connect-MgGraph
within several helper scripts. These scripts redirect their object outputs to a variable, allowing for subsequent processing in the main script. In scenarios requiring device code authentication for interactive login, such as GitHub Codespaces, the device code fails to display to the user since the output is captured by the variable. Consequently, this prevents the completion of the authentication process.Describe the solution you'd like.
Similar to the
Connect-AzAccount
command, theConnect-MgGraph
command ought to direct its output to the host console rather than the output stream during device code authentication.This guarantees that users can consistently view the instructions and device code necessary to finalize the authentication process as intended.
Enhancing visibility, it would be beneficial to prepend a prefix to the authentication instructions, akin to the following:
This example demonstrates the behavior similar to that provided by the new
Az.Accounts
v3.0.0 module.It is sufficient to alter only the Device Code output behavior. Other text outputs should continue to be directed to the output stream, allowing individuals the choice to redirect or suppress them as they can currently.
Additional context?
For readers seeking a workaround, the following may serve as inspiration to tailor to your specific needs:
The text was updated successfully, but these errors were encountered: