Skip to content

Conversation

@VeryEarly
Copy link
Collaborator

Description

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Copilot AI review requested due to automatic review settings December 23, 2025 04:23
@azure-client-tools-bot-prd
Copy link

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Copy link
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 fixes the -ExposeToken parameter behavior in the Connect-AzContainerRegistry cmdlet. Previously, when using -ExposeToken, the cmdlet would still perform a docker login and call the Authenticate() method. The fix changes the behavior to only return the access token as a SecureString without performing the login, allowing users to manually authenticate with containerization tools like docker.

Key changes:

  • Modified the ExposeToken logic to return the password (refresh token) as a SecureString instead of calling Authenticate()
  • Removed the status field from the returned credential object when ExposeToken is used
  • Added Example 4 to the help documentation demonstrating how to use the ExposeToken feature with docker login

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/ContainerRegistry/ContainerRegistry/Commands/ConnectAzureContainerRegistry.cs Updated ExposeToken logic to convert password to SecureString and removed the status field from the returned object
src/ContainerRegistry/ContainerRegistry/help/Connect-AzContainerRegistry.md Added Example 4 showing how to use ExposeToken with docker login
src/ContainerRegistry/ContainerRegistry/ChangeLog.md Added changelog entry documenting the ExposeToken fix

- Additional information about change #1
-->
## Upcoming Release
* Fixed `-ExposeToken` with `Connect-AzContainerRegistry`
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

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

The ChangeLog entry needs to be more descriptive and user-facing. It should explain what the issue was and how it affects users, not just state that something was fixed. Additionally, it should reference the related GitHub issue if one exists. For example: "Fixed -ExposeToken parameter in Connect-AzContainerRegistry to properly return the access token without performing docker login" or similar.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines 69 to 73
var cred = new
{
status = this.ExecuteScript<object>(LoginScript),
loginServer = Name + ".azurecr.io",
accessToken = this.RegistryDataPlaneClient.Authenticate()
accessToken = this.Password.ConvertToSecureString()
};
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

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

The removal of the status field from the returned credential object is a breaking change. The previous implementation included a status field that contained the result of the docker login script execution. Removing this field without documentation could break existing scripts that depend on this return value. Consider whether this field should be retained for backward compatibility, or if this is an intentional breaking change, it should be clearly documented in the ChangeLog with the breaking change format.

Copilot uses AI. Check for mistakes.
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.

1 participant