Last active
May 25, 2018 19:47
-
-
Save smereczynski/2bfcac4532c6b0c3576d9b54946d2761 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from azure.common.credentials import ServicePrincipalCredentials | |
| from azure.mgmt.resource import ResourceManagementClient | |
| import os | |
| import keyring.backend | |
| from keyrings.alt.file import PlaintextKeyring | |
| keyring.set_keyring(PlaintextKeyring()) | |
| TENANT_ID = os.getenv('TENANT_ID') | |
| CLIENT = os.getenv('CLIENT') | |
| KEY = os.getenv('KEY') | |
| SUBSCRIPTION = os.getenv('SUBSCRIPTION') | |
| credentials = ServicePrincipalCredentials( | |
| client_id=CLIENT, | |
| secret=KEY, | |
| tenant=TENANT_ID | |
| ) | |
| client = ResourceManagementClient(credentials, SUBSCRIPTION) | |
| rgs = client.resource_groups.list() | |
| for rg in rgs: | |
| print(rg.name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment