Feature Show Logged in account email or client ID for azd auth login and azd auth login --check-status#2856
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
ellismg
left a comment
There was a problem hiding this comment.
Still a little confused on how this ends up working. From your screenshot, it looks like you did the right thing, but I'm confused on how it works with the current diff.
My belief is that when you are logged in with a service principal, the call to readUserProperties in auth/manager is going to return a user properties struct that has a nil HomeAccountID and so GetSignedInAccount will return (nil, nil). I think that will cause a panic when we try to dereference the PerferredUsername.
Were there additional commits that fixed this up that you just missed pushing? Or is my mental model on how this code works incorrect?
This comment was marked as outdated.
This comment was marked as outdated.
azd auth login --check-statusazd auth login and azd auth login --check-status
azd auth login and azd auth login --check-statusazd auth login and azd auth login --check-status
|
@ellismg @vhvb1989 are we still looking into this enhancement and is the PR still valid? @john0isaac can we close this and open a new one incorporating feedback? |
|
@john0isaac Thanks for keeping this PR alive, our maintainers will push on this to get this merged. @SophCarp Thoughts on this from a UX perspective? I have some suggestions below:
For service principals, I feel like we should display name and the ID:
^ For the App ID, we might benefit from grey / less emphasized text -- the italics is meant to demonstrate this. |
|
@weikanglim can you help me with the service principle display name? as i'm not sure where to obtain it from. And I changed it for the email to make it bold and use the same wording you suggested. @vhvb1989 I applied your suggestion as it's way much better that what i did i think i was being lazy when i said to wait for Matt 😆 but internally I just wanted to avoid rework as he may have wanted something different. |
0020bd3 to
5ccd731
Compare
1282f52 to
a9b3ae3
Compare
a9b3ae3 to
1507cc2
Compare
|
Can you try using the claims from the access token returned by I'd recommend not making any changes to I was able to print out what's available from the claims using the code below: claims, err := auth.GetClaimsFromAccessToken(token.Token)
log.Printf("claims: %+v", claims)I think |
use ux struct item
For my personal account these are the claims: {PreferredUsername: UniqueName:live.com#johnaziz269@gmail.com GivenName:John FamilyName:Aziz MiddleName: Name: Oid: TenantId:f8cdef31-a31e-****-****-**** Subject:************ Upn: Email:johnaziz269@gmail.com AlternativeId: Issuer:https://sts.windows.net/f8cdef31-****-****-****/ Audience:https://management.azure.com/ ExpirationTime:1737228383 IssuedAt:1737223568 NotBefore:1737223568}For my Ambassadors (Consider it a work account.. kinda) these are the claims: {PreferredUsername: UniqueName:John.Aziz@studentambassadors.com GivenName:John FamilyName:Aziz MiddleName: Name:John Aziz Oid:d27c9994-*****-*****-***** TenantId:84c31ca0-*****-*****-***** Subject:************* Upn:John.Aziz@studentambassadors.com Email: AlternativeId: Issuer:https://sts.windows.net/84c31ca0-************/ Audience:https://management.azure.com/ ExpirationTime:1737229048 IssuedAt:1737223774 NotBefore:1737223774}For service principal login these are the claims: {PreferredUsername: UniqueName: GivenName: FamilyName: MiddleName: Name: Oid:81b42351-f2f7-******-****-***** TenantId:80c273e6-*****-*****-**** Subject:******-******-*****-***** Upn: Email: AlternativeId: Issuer:https://sts.windows.net/80c273e6-*****-*****-******/ Audience:https://management.azure.com/ ExpirationTime:1737227895 IssuedAt:1737223995 NotBefore:1737223995}There isn't a single property for the claims we can use as for the personal account it's |
|
/azp run azure-dev cli |
|
No pipelines are associated with this pull request. |
|
/azp run azure-dev - cli |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|



This pull request updates to the login functionality in the Azure CLI. The main changes involve improving the login status messaging and adding detailed account information after a successful login.
closes #1745
azd auth loginandazd auth login --check-statuswith normal accountazd auth login --check-statuswith service principal