Python and Azure CLI environment in docker
Deploying an Azure target architecture from Microsoft required running python to upload data to an Azure SQL database using the Azure CLI az
. This turned out to be a bit of a mission one way or another (windows box didn't have a python environment, mac box had errors building pymssql).
Simplest way was to use docker.
Open terminal
Open git bash and navigate to the directory with the python scripts, requirements.txt etc
Start container
Run a docker container with python preinstalled, mounting the current directory into the container (note the strange backtick notation to specify the working directory - for further details / ideas see: https://github.com/docker-archive/toolbox/issues/673)
docker run -it -v `pwd -W`:/code --name python-with-az python bash
Install prerequisties
apt update
apt install freetds-dev # required to build package pymssql
apt install azure-cli
pip install --upgrade pip
cd /code
pip install pur # required to update the pkgs in requirements.txt
pur -r requirements.txt
pip install -r requirements.txt
az login