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
get_access_token_from_cli should be able to use cached service principal tokens #31
Comments
Thanks @nickraptis. When you have a service principal, why don't you call get_access_token()? Is it to make the Python code more portable? E.g. re-use the same code in any CLI environment without needing any additional config files? That makes sense. Please go ahead a submit a PR for this. |
@gbowerman Our use case is that we are using azurerm alongside azure-cli in a cicd pipeline. I had overlooked the documentation's suggestion to use |
@nickraptis thanks the use case makes sense. I'll leave this open in case anyone wants to take on implementing it, or catching the exception and returning a meaningful message. |
BTW a recent change improved get_access_token_from_cli() so it works in Azure cloud shell (getting token from MSI endpoint). May not be useful in your case, but adding it to this issue as an FYI. |
I have a setup where
azure-cli
logs in as a service principal and would like to use theget_access_token_from_cli
functionality.The cached tokens file looks like this:
Resulting in this error:
I've also seen setups where the cached tokens are both user and service principal ones.
Should be easy to be able to retrieve both kinds of tokens from the cache file.
PS: This is something I'll probably work on anyway. Opening this issue mostly to judge interest for a PR.
The text was updated successfully, but these errors were encountered: