Closed unloadedroe closed 4 years ago
To be explicit about this, use
def get_token():
# this url is hard-code and only available to services with identity.
oauth_token = requests.get(
'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fmanagement.azure.com%2F',
headers={'Metadata': True}
).json()
return oauth_token['access_token']
service = BlockBlobService(account, token_credential=get_token())
this can be integrated to a "AutoUpdatedTokenCredential", like @zezha-msft suggested.
Which service(blob, file, queue) does this issue concern?
Blob
Which version of the SDK was used? Please provide the output of
pip freeze
.2.1.0
What problem was encountered?
The constructor for the BlockBlobService does not allow the usage of MSI authentication. It was also requested in here.
Have you found a mitigation/solution?
Note: for table service, please post the issue here instead: https://github.com/Azure/azure-cosmosdb-python.