Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] az login with cookie or bearer token #28815

Closed
recolic opened this issue Apr 23, 2024 · 4 comments
Closed

[Feature request] az login with cookie or bearer token #28815

recolic opened this issue Apr 23, 2024 · 4 comments
Assignees
Labels
Account az login/account Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. feature-request
Milestone

Comments

@recolic
Copy link

recolic commented Apr 23, 2024

Related command

We need them:

az login --cookies "xxx=xxx; xxx=xxx; xxx=xxx;"
az login --auth-header "bearer xxxxxxxxxxxxxxxxxxxxxxxx"

Is your feature request related to a problem? Please describe.

Currently our organization requires az login multiple times EVERY DAY, and we must use az login --use-device-code and copy-paste code into customized browser for auth.

I have been doing authentication again and again, day and day, month after month, I'm so tired.

WHY NOT SIMPLY ACCEPT auth-header or cookie, so we have freedom to extract things from browser directly?

Describe the solution you'd like

az login --cookies "xxx=xxx; xxx=xxx; xxx=xxx;"
az login --auth-header "bearer xxxxxxxxxxxxxxxxxxxxxxxx"

Describe alternatives you've considered

Do az login --use-device-code again and again, day and day, month after month, I'm so tired.

I have a dirty tampermonkey script to make it easier, but still pissed off after doing such boring work for years.

Additional context

I'M SO TIRED.

@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot Account az login/account labels Apr 23, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 23, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Apr 23, 2024

Thank you for opening this issue, we will look into it.

@yonzhan yonzhan added this to the Backlog milestone Apr 23, 2024
@yonzhan yonzhan added feature-request and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Apr 23, 2024
@jiasli
Copy link
Member

jiasli commented Apr 24, 2024

Azure REST API uses OAuth2 for authentication, so cookies are not supported.

As for accepting bearer tokens, this is tracked by #16459. The bearer token usually expires after 1 hour. You have to log in again after it expires.

@recolic
Copy link
Author

recolic commented Apr 24, 2024

Got it.. Thanks for your information.

@recolic recolic closed this as completed Apr 24, 2024
@jiasli
Copy link
Member

jiasli commented Apr 24, 2024

If you want to get rid of logging in again and again, it is best to leverage a service principal: https://learn.microsoft.com/en-us/cli/azure/authenticate-azure-cli-service-principal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Account az login/account Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. feature-request
Projects
None yet
Development

No branches or pull requests

3 participants