Skip to content

Add darc login command for interactive Maestro authentication#5986

Merged
premun merged 11 commits intomainfrom
copilot/add-darc-login-command
Feb 23, 2026
Merged

Add darc login command for interactive Maestro authentication#5986
premun merged 11 commits intomainfrom
copilot/add-darc-login-command

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 19, 2026

Implementation Plan for darc login Command

  • Create LoginCommandLineOptions.cs with verb "login" and help text
  • Create LoginOperation.cs to handle login flow:
    • Trigger interactive browser authentication
    • Obtain Maestro token via AppCredential
    • Store authentication record in ~/.darc directory
    • Add error handling with pointer to darc authenticate on failure
  • Register the new command in Program.cs GetOptions()
  • Update documentation in docs/Darc.md:
    • Add login command to index
    • Add login command reference section
    • Add scenario for setting up authentication
  • Write unit tests for LoginOperation
  • Build and test the implementation
  • Manual validation with darc CLI
  • Code review and security scan
  • Address feedback: Refactor to reuse credential classes
  • Address PR review comments:
    • Fix documentation to match actual output
    • Update constructor to use GetAppIdForUri() for consistency

Summary

Successfully implemented the darc login command. Latest changes:

  • Fixed documentation examples to match actual log output from the implementation
  • Refactored ProductConstructionServiceApiOptions constructor to use GetAppIdForUri() instead of directly accessing the dictionary, ensuring consistent error handling
  • All 184 Darc tests pass
Original prompt

This section details on the original issue you should resolve

<issue_title>Add darc login command</issue_title>
<issue_description>We need a darc login command which would be used locally and would obtain Maestro token and store the credentials in the auth record so that MCP agents can rely on the user running this command and being signed in.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits February 19, 2026 09:57
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>
Copilot AI changed the title [WIP] Add darc login command to obtain Maestro token Add darc login command for interactive Maestro authentication Feb 19, 2026
Copilot AI requested a review from premun February 19, 2026 10:05
Comment thread src/Microsoft.DotNet.Darc/Darc/Operations/LoginOperation.cs Outdated
…tions

Co-authored-by: premun <7013027+premun@users.noreply.github.com>
Copilot AI requested a review from premun February 19, 2026 12:09
@premun premun marked this pull request as ready for review February 19, 2026 12:24
Copilot AI review requested due to automatic review settings February 19, 2026 12:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 LoginCommandLineOptions class with --bar-uri parameter for specifying Maestro environment
  • Implemented LoginOperation class 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

Comment thread docs/Darc.md
Comment on lines +1636 to +1652
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.
```
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot fix the documentation to match the expected output

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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)

Comment thread src/Microsoft.DotNet.Darc/Darc/Operations/LoginOperation.cs
Comment thread src/Microsoft.DotNet.Darc/Darc/Options/LoginCommandLineOptions.cs
Comment thread src/Microsoft.DotNet.Darc/Darc/Operations/LoginOperation.cs
Co-authored-by: premun <7013027+premun@users.noreply.github.com>
@premun premun merged commit 969d11c into main Feb 23, 2026
9 checks passed
@premun premun deleted the copilot/add-darc-login-command branch February 23, 2026 10:26
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.

Add darc login command

4 participants