-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
How do I use the credentials in ~/.azure folder? #1310
Comments
Hi @apengwin This is an excellent question, and this has moved a lot recently. Today, my response would be:
In a few days, you will be able to save a authentication file and load it in the SDK like: from azure.common.client_factory import get_client_from_auth_file
from azure.mgmt.compute import ComputeManagementClient
client = get_client_from_auth_file(ComputeManagementClient) I will release that probably tomorrow, it's nothing but updating release notes and pushing to PyPI. However, this is not working for client not based on Service Principal authentication, like Storage. What you can do with Storage, is to use a service principal credentials to get the Storage credentials: client = get_client_from_auth_file(StorageManagementClient)
storage_keys = storage_client.storage_accounts.list_keys(resource_group_name, storage_account_name)
storage_keys = {v.key_name: v.value for v in storage_keys.keys}
storage_client = CloudStorageAccount(storage_account_name, storage_keys['key1'])
blob_service = storage_client.create_block_blob_service() FYI @yugangw-msft |
@apengwin can we close this issue or you think it does not respond correctly to it? |
@lmazuel yup. thanks! |
Hello! So I'm still pretty confused about this a few years later… I don't know where to ask the question but this issue seemed like the best lead I had but using the storage account keys directly is not what I want :( Can someone help me find the right approach? |
I'm playing around with Azure blob storage, and I currently pass in my authentication info manually in my python code.
I was wondering if there was to use the access tokens or credentials stored in the
~/.azure
folder to automatically populate the authentication credentials, similar to how boto3 searches in~/.aws/credentials
?For reference, this is the contents of the
~/.azure folder
The text was updated successfully, but these errors were encountered: