Add darc login command for interactive Maestro authentication#5986
Add darc login command for interactive Maestro authentication#5986
darc login command for interactive Maestro authentication#5986Conversation
Co-authored-by: premun <7013027+premun@users.noreply.github.com>
Co-authored-by: premun <7013027+premun@users.noreply.github.com>
Co-authored-by: premun <7013027+premun@users.noreply.github.com>
darc login command for interactive Maestro authentication
…tions Co-authored-by: premun <7013027+premun@users.noreply.github.com>
Removed unnecessary summary comments and adjusted logging messages for clarity.
There was a problem hiding this comment.
Pull request overview
This PR implements a new darc login command that enables interactive browser-based authentication with Maestro. The command stores authentication credentials in the ~/.darc directory for reuse by the darc CLI and automation tools like MCP agents. The implementation refactors authentication logic to expose a public GetAppIdForUri() method that maps Maestro URIs to Entra app IDs.
Changes:
- Added
GetAppIdForUri()public method to expose Entra app ID mapping functionality - Created
LoginCommandLineOptionsclass with--bar-uriparameter for specifying Maestro environment - Implemented
LoginOperationclass with interactive browser authentication flow using Azure.Identity
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ProductConstructionService/Microsoft.DotNet.ProductConstructionService.Client/ProductConstructionServiceApiOptions.cs | Added public GetAppIdForUri() method to expose existing URI-to-app-ID mapping |
| src/Microsoft.DotNet.Darc/Darc/Program.cs | Registered new LoginCommandLineOptions in command list |
| src/Microsoft.DotNet.Darc/Darc/Options/LoginCommandLineOptions.cs | Created command-line options with --bar-uri parameter |
| src/Microsoft.DotNet.Darc/Darc/Operations/LoginOperation.cs | Implemented interactive authentication flow with error handling |
| docs/Darc.md | Added documentation for login command with usage examples |
| PS D:\enlistments\arcade> darc login | ||
| Authenticating with Maestro at https://maestro.dot.net/ | ||
| Opening browser for authentication... | ||
| Successfully authenticated with Maestro! | ||
| Authentication credentials have been stored in /Users/username/.darc | ||
| These credentials will be used by automation tools and the darc CLI. | ||
| ``` | ||
|
|
||
| To authenticate with staging Maestro: | ||
| ``` | ||
| PS D:\enlistments\arcade> darc login --bar-uri https://maestro.int-dot.net/ | ||
| Authenticating with Maestro at https://maestro.int-dot.net/ | ||
| Opening browser for authentication... | ||
| Successfully authenticated with Maestro! | ||
| Authentication credentials have been stored in /Users/username/.darc | ||
| These credentials will be used by automation tools and the darc CLI. | ||
| ``` |
There was a problem hiding this comment.
The documentation examples show console output that doesn't match the actual implementation. The code logs "Authenticating with Maestro at {barUri} (a browser window might open)" but the documentation shows "Opening browser for authentication..." Additionally, the documentation shows messages about credentials being stored ("Authentication credentials have been stored in /Users/username/.darc" and "These credentials will be used by automation tools and the darc CLI.") that are not present in the actual code. Update the documentation to match the actual log messages produced by the implementation.
There was a problem hiding this comment.
@copilot fix the documentation to match the expected output
There was a problem hiding this comment.
Fixed the documentation to match the actual log output. Removed the messages about "Opening browser for authentication..." and credential storage location that don't exist in the implementation. (commit dee42b6)
Co-authored-by: premun <7013027+premun@users.noreply.github.com>
Implementation Plan for
darc loginCommandLoginCommandLineOptions.cswith verb "login" and help textLoginOperation.csto handle login flow:darc authenticateon failureProgram.csGetOptions()docs/Darc.md:Summary
Successfully implemented the
darc logincommand. Latest changes:ProductConstructionServiceApiOptionsconstructor to useGetAppIdForUri()instead of directly accessing the dictionary, ensuring consistent error handlingOriginal prompt
darc logincommand #5985💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.