Open john0isaac opened 7 months ago
@ellismg I learned about service principal and handled their exception.
(L343) This is the line that gets triggered to print the service principal client ID note that in the screen shot that I shared before I was trying to log in not trying to check-status that's why it's not consistent in the code.
Let me think about it and get back to you, I found that there is a difference between logging in and checking the status so, I will try to make the whole code more consistent as it's as confusing to me as it is to you.
In this commit https://github.com/Azure/azure-dev/pull/2856/commits/dc1b59bcc0835c288f84974d0118f747b1cbf195 I added the feature to display the logged in user email or service principal on successful login to make the code consistent
output of command azd auth login
for normal account
output of command azd auth login
for service principal
Currently trying to figure out how to get the service principal client id from something other than the flags to display it on the ---check-status
output
I couldn't get the client id when a service principal account loggs in so, I implemented a new function in the auth.Manager to get it. https://github.com/Azure/azure-dev/pull/2856/commits/f3f830a379dd806d63229df40a83e57f24356c21 Suggestion: In the auth.Manager.GetSignedInAccount(ctx) we can return the currentUser.ClientID instead of returning nil but I didn't know the implications of doing this so, I opted for the safe path which is to leave it as it us and create a new function. (Can't we return it in the GetSignedInAccount?)
azd auth login
and azd auth login --check-status
with normal accountazd auth login
and azd auth login --check-status
with service principal
closes #1745
Full flow of
azd auth login
andazd auth login --check-status
with normal accountFull flow of
azd auth login
andazd auth login --check-status
with service principal