Skip to content

Instantly share code, notes, and snippets.

@lmazuel
Created January 30, 2020 22:36
Show Gist options
  • Save lmazuel/be0b03d67ea8c9b003714d2e57c4db72 to your computer and use it in GitHub Desktop.
Save lmazuel/be0b03d67ea8c9b003714d2e57c4db72 to your computer and use it in GitHub Desktop.
azure-identity and new autorest
from azure.identity import ClientSecretCredential
from azure.mgmt.storage import StorageManagementClient
def get_credentials_identity():
subscription_id = os.environ.get(
'AZURE_SUBSCRIPTION_ID',
'11111111-1111-1111-1111-111111111111') # your Azure Subscription Id
credentials = ClientSecretCredential(
client_id=os.environ['AZURE_CLIENT_ID'],
client_secret=os.environ['AZURE_CLIENT_SECRET'],
tenant_id=os.environ['AZURE_TENANT_ID']
)
return credentials, subscription_id
def run_example():
credentials_identity, subscription_id = get_credentials_identity()
storage_client = StorageManagementClient(credentials_identity, subscription_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment