Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jun 25, 2025

Adds optional fields to the contracts.LoginResult struct and updated the authentication logic to populate these fields when the user is authenticated.

The JSON response now includes account information:

{
  "status": "success",
  "expiresOn": "2025-07-08T20:20:26Z",
  "principal": {
    "name": "useremail",
    "type": "User"
  }
}

Fixes #5402

…-check-status

Co-authored-by: weikanglim <2322434+weikanglim@users.noreply.github.com>
Copilot AI changed the title [WIP] [Issue] Account name not included in JSON response when running azd auth login --check-status -o json Add account name and login type to JSON response for azd auth login --check-status Jun 25, 2025
Copilot AI requested a review from weikanglim June 25, 2025 22:48
@vhvb1989
Copy link
Member

/azp run azure-dev - cli

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

…eck-status

Co-authored-by: weikanglim <2322434+weikanglim@users.noreply.github.com>
Copilot AI requested a review from weikanglim June 25, 2025 23:32
Copilot AI requested a review from vhvb1989 June 25, 2025 23:38
@vhvb1989 vhvb1989 marked this pull request as ready for review June 26, 2025 17:49
… PrincipalType

Co-authored-by: weikanglim <2322434+weikanglim@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jun 27, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • downloads.bicep.azure.com
    • Triggering command: /tmp/go-build448698095/b001/bicep.test -test.testlogfile=/tmp/go-build448698095/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.short=true (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)
    • Triggering command: /tmp/go-build2962273189/b001/bicep.test -test.testlogfile=/tmp/go-build2962273189/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.run=TestPromptForParameter -test.short=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from weikanglim June 27, 2025 23:58
Comment on lines 15 to 17
UserLoginType LoginType = "User"
ServicePrincipalLoginType LoginType = "ServicePrincipal"
)
Copy link
Contributor

@weikanglim weikanglim Jun 30, 2025

Choose a reason for hiding this comment

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

@copilot Move the login type declarations to login.go in contracts package

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved the LoginType declarations from ux/logged_in.go to the contracts package as requested. This centralizes the login type definitions and removes duplication across packages. Commit 4de5daa

ExpiresOn *time.Time `json:"expiresOn,omitempty"`
// When status is `LoginStatusSuccess`, the account name the user is logged in as.
Account *string `json:"account,omitempty"`
// When status is `LoginStatusSuccess`, the type of login (email or clientId).
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot update this documentation to reflect the actual values (User or ServicePrincipal)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the documentation to reflect the actual values (User or ServicePrincipal) in commit 4de5daa

Co-authored-by: weikanglim <2322434+weikanglim@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jun 30, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • downloads.bicep.azure.com
    • Triggering command: /tmp/go-build734126665/b001/bicep.test -test.testlogfile=/tmp/go-build734126665/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.short=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

import "time"

// LoginType represents the type of authentication used
type LoginType string
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot change this to PrincipalType to reflect the type of principal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed LoginType to PrincipalType and updated all references throughout the codebase. Also renamed the constants to UserPrincipalType and ServicePrincipalPrincipalType for consistency. Commit 1f023b0

Comment on lines 37 to 38
// When status is `LoginStatusSuccess`, the type of login (User or ServicePrincipal).
LoginType *LoginType `json:"loginType,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot make the new fields principal.name and principal.type to be more consistent with the current contracted usage in azd env variables AZURE_PRINCIPAL_xx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the JSON structure to use nested principal.name and principal.type fields to be consistent with the AZURE_PRINCIPAL_* environment variable naming convention. Commit 81fb55b

Co-authored-by: weikanglim <2322434+weikanglim@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jul 1, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • downloads.bicep.azure.com
    • Triggering command: /tmp/go-build871652250/b893/bicep.test -test.testlogfile=/tmp/go-build871652250/b893/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.short=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

…type fields

Co-authored-by: weikanglim <2322434+weikanglim@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service bot added the no-recent-activity identity issues with no activity label Sep 12, 2025
@microsoft-github-policy-service
Copy link
Contributor

Hi @@copilot. Thank you for your interest in helping to improve the Azure Developer CLI experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days.

@microsoft-github-policy-service
Copy link
Contributor

Hi @@copilot. Thank you for your contribution. Since there hasn't been recent engagement, we're going to close this out. Feel free to respond with a comment containing "/reopen" if you'd like to continue working on these changes. Please be sure to use the command to reopen or remove the "no-recent-activity" label; otherwise, this is likely to be closed again with the next cleanup pass.

@rajeshkamal5050 rajeshkamal5050 removed the no-recent-activity identity issues with no activity label Jan 5, 2026
@rajeshkamal5050
Copy link
Contributor

@JeffreyCA @weikanglim can we review and move this PR along?

@weikanglim
Copy link
Contributor

@rajeshkamal5050 This will be merged with the new auth status command #6377.

@weikanglim
Copy link
Contributor

Superseded by #6377

@weikanglim weikanglim closed this Jan 6, 2026
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.

[Issue] Account name not included in JSON response when running azd auth login --check-status -o json

5 participants