Requirements:
- Azure identity package : pip install azure-identity
- azure storage blob package: pip install azure-storage-blob
- Azure cli, after installing the cli you have to log in using the command : az login.
- An Azure account with a subscription and a storage account already created via the interface
The goal is to create containers in an Azure storage account using a simple Python script. The container names (months) to be created are located in a .txt file :
- Import the librairies
These are the two needed classes.
2. Define the account url
The account url is a unique url defining the path to the storage account, it has the following format :
account_url = “https://<nameOfYourStorageAccount>.blob.core.windows.net”
3. A Python function to loop over the containers to be created and call the create_container function
Execute the python function to see the containers created in the azure interface:
Thanks for reading.
Othmane.