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

Enable authentication via environment variables #10241

Open
garymoon opened this issue Aug 14, 2019 · 18 comments
Open

Enable authentication via environment variables #10241

garymoon opened this issue Aug 14, 2019 · 18 comments
Assignees
Labels
Account az login/account customer-reported Issues that are reported by GitHub users external to the Azure organization. Feature Candidate feature-request
Milestone

Comments

@garymoon
Copy link

garymoon commented Aug 14, 2019

Is your feature request related to a problem? Please describe.
I'm concerned that I cannot use the CLI without having my credentials written to disk in the clear.

Describe the solution you'd like
I would like the CLI to accept credentials from the environment (e.g. AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET).

Describe alternatives you've considered
I've yet to find a way to authenticate that doesn't involve secrets being written to ~/.azure.

Additional context
I came across this issue which seems to describe the same thing, but was closed following an apparent misunderstanding. While the AWS CLI does indeed write secrets in the clear to disk when configured via aws configure, it also allows for configuration via environment variables.

I've also found examples in both the Ruby SDK here, and the Go SDK here where authentication via environment variables is enabled.

This issue is particularly problematic in a dockerized environment where it's common for the home directory to be mapped on the host.

@mmyyrroonn mmyyrroonn added the Account az login/account label Aug 15, 2019
@jiasli jiasli self-assigned this Aug 15, 2019
@jiasli
Copy link
Member

jiasli commented Aug 15, 2019

Hi @garymoon, thank you for raising this issue. We will consider this as a feature request and discuss internally.

@garymoon
Copy link
Author

garymoon commented Aug 15, 2019

@jiasli Thank you for the update. Please be sure to consider the implications of unintended credential leakage also. IMO this issue represents a security concern.

In the meantime, for anyone coming across this ticket, I suggest either using the microsoft/azure-cli docker image and mounting the config dir as tmpfs with --tmpfs [home_dir]/.azure, or adding AZURE_CONFIG_DIR=/dev/shm/.azure to your shell if you're on Linux.

@jiasli
Copy link
Member

jiasli commented Mar 23, 2020

Python SDK - Azure Identity also supports environment variables here. Maybe we can implement this independently of Azure Identity integration. Even after the Azure Identity integration, this won't be a breaking change.

@kostyay
Copy link

kostyay commented Aug 4, 2020

Any update on this? It will be super useful for us as well.

@jiasli
Copy link
Member

jiasli commented Aug 5, 2020

We are currently implementing this feature in the Azure Identity Integration process and it will be included in the next Beta release. But we can't provide a solid ETA yet.

@azure-sdk azure-sdk added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Sep 24, 2020
@etaham
Copy link

etaham commented Dec 10, 2020

Hi @jiasli,

Is there any update or a workaround? We need to use the CLI in a pipeline and do not want to post the password on a command line.

Thanks!

@jiasli
Copy link
Member

jiasli commented Dec 11, 2020

This will be released in the next Beta version which uses MSAL. Hopefully it can satisfy your needs.

@jiasli
Copy link
Member

jiasli commented Oct 15, 2021

Because we dropped Azure Identity in the MSAL migration process (#19853), this feature is temporarily removed from MSAL-based CLI.

Marking it as a Feature Candidate for future planning.

@etaham
Copy link

etaham commented Mar 31, 2022

Any updates here? MSAL has been out for quite some time. Other tools, such as terraform, do not require the login call and are therefore more secure in this context.

@jiasli
Copy link
Member

jiasli commented Mar 31, 2022

Nope. We'll make sure to update this thread when there is. In the meantime, might I recommend the Subscribe button?

image

That way you'll be notified of any updates to this thread, without needlessly pinging everyone on this thread. :)

@jiasli
Copy link
Member

jiasli commented Apr 18, 2023

@skorobogatydmitry
Copy link

Any updates on this ?

@prem-mukherji
Copy link

Any updates on this?

@arunkumar611
Copy link

arunkumar611 commented Feb 15, 2024

@jiasli - When the enhancement goes live, will it also support OIDC? There are the variables that are used by other providers.

"AZURE_OIDC_REQUEST_TOKEN": "[secret]",
"AZURE_OIDC_REQUEST_URL": "https://api.x.com/oidc",
"AZURE_OIDC_TOKEN": "[secret]",
"AZURE_USE_OIDC": "true"

@jiasli
Copy link
Member

jiasli commented Feb 18, 2024

There are the variables that are used by other providers.

@arunkumar611, could you share more information on these "providers"? I am not able to find any reference to these environment variables on the internet: https://www.bing.com/search?q=AZURE_OIDC_REQUEST_URL , https://www.google.com/search?q=AZURE_OIDC_REQUEST_URL

@tspearconquest
Copy link
Contributor

There are the variables that are used by other providers.

@arunkumar611, could you share more information on these "providers"? I am not able to find any reference to these environment variables on the internet: https://www.bing.com/search?q=AZURE_OIDC_REQUEST_URL , https://www.google.com/search?q=AZURE_OIDC_REQUEST_URL

I think that commenter may have meant ARM_* instead of AZURE_* as I do see these 4 on google:

"ARM_OIDC_REQUEST_TOKEN": "[secret]",
"ARM_OIDC_REQUEST_URL": "https://api.x.com/oidc",
"ARM_OIDC_TOKEN": "[secret]",
"ARM_USE_OIDC": "true"

@ringods
Copy link

ringods commented Oct 23, 2024

@tspearconquest I thought so too, but proposed PR #27938 implements it with the AZURE_ prefix.

@Speeddymon
Copy link

It's not the same variables at all. Those are strictly related to SP auth with secrets whereas this poster asked about OIDC vars but appears to have mistakenly used the AZURE_ prefix. That's all I was trying to say, but thank you. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Account az login/account customer-reported Issues that are reported by GitHub users external to the Azure organization. Feature Candidate feature-request
Projects
None yet
Development

Successfully merging a pull request may close this issue.