I have previously used the Azure Python SDK module AADCredentials to authenticate a client such as SubscriptionClient from azure-mgmt-resource. As azure-identity is being rolled out, I find that I cannot use AADCredentials with azure-identity clients such as SecretClient to access a KeyVault. In a nutshell, I am trying to figure out a way to use an externally generated auth token for a service principal to create a credential that SecretClient can use without re-writing AADCredentials to add a get_token method e.g.
from azure.keyvault.secrets import SecretClient
from msrestazure.azure_active_directory import AADTokenCredentials
token={'tokenType':'Bearer','accessToken':'BLAH'}
client_id='123'
cred=AADTokenCredentials(cred,client_id=client_id)
secret_client=SecretClient(vault_url=vault_url, credential=creds)
#Errors with 'AADTokenCredentials has no attribute 'get_token'
retrieved_secret=secret_client.get_secret('secretname')
I'm trying to do this so that Python does not get access to the service principal certificate and therefore cannot copy it elsewhere along with the password.
Any thoughts would be appreciated