Batch account is set up with no user interaction except authentication
[x] Assigns a random identifier to use for the name of all components
[x] Creates a resource group
[x] Creates a batch account
[x] Creates a storage account and links it to the batch account
Notes
Borrow functionality from the Azure CLI 2.0 client. Note that the the Azure CLI 2.0 client is a Python app. To access the azure-cli modules, install them using pip install azure-cli. This will also install the CLI client itself, which can be run using the az command.
We will also need to install the matching v2.0 azure libraries. To do this, run pip install --pre azure (the --pre is required as v2.0 is still in pre-release). If you have already installed the non-preview v1.0 azure libraries, you will need to uninstall these using pip uninstall azure (you can check the version you have installed by running pip freeze.
Azure storage account names are limited to 24 character lower case + numbers, so we cannot use UUIDs for our random identifiers, as these are 32 characters even without hyphens. Use ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(N)) (see Stack Overflow).
Authentication is handled by the Azure CLU app (az login), so we can use this rather than implement it in the script itself.
Acceptance criteria
Batch account is set up with no user interaction except authentication
Notes
azure-cli
modules, install them usingpip install azure-cli
. This will also install the CLI client itself, which can be run using theaz
command.azure
libraries. To do this, runpip install --pre azure
(the--pre
is required as v2.0 is still in pre-release). If you have already installed the non-preview v1.0azure
libraries, you will need to uninstall these usingpip uninstall azure
(you can check the version you have installed by runningpip freeze
.''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(N))
(see Stack Overflow).az login
), so we can use this rather than implement it in the script itself.