Environment for working with Azure Python SDK
-
Ensure Python 3.8+ is installed on your system
-
Create an Azure Active Directory application
-
Create a secret for the application
-
Create a resource group
-
Assign the application to the Contributor or Reader role on the subscription or resource group
-
In
.envfill in theAZURE_CLIENT_IDandAZURE_CLIENT_SECRETto match your Service Principal. Be sure to escape the JSON. Avoid using online tools to do this due to the sensitive nature of what you are escaping. The resultingenvmap will resemble:{ "AZURE_SUBSCRIPTION_ID": "12345678-1234-1234-1234-123456789012", "AZURE_CLIENT_ID": "abcdefab-abcd-abcd-abcd-abcdefabcdef", "AZURE_CLIENT_SECRET": "AL8)RxYQzCf./dF!y5EN13eqdg3T!qwh", "AZURE_TENANT_ID": "1234abcd-1234-1234-1234-1234abcd1234" } -
Run
init.shto set up the environment for the Python environment -
Add the following line to
.gitignoreto avoid committing any sensitive information:.vscode/ -
Develop and debug functions using the
Current File (Integrated Terminal)configuration (press F5 with the file open)
- Azure SDK for Python (Unit test code in particular)