Azure CLI 2.0 – Azure Container Service for Docker Swarm Deployment Script (Part 1)

In today’s post, I’m going to talk a little about a script I wrote that automates the deployment of a Docker Swarm Cluster using Azure Container Service. The script uses Azure CLI 2.0, which is now GA. If you’re not yet using it, stop here, download it, come back. I’ll wait.

Everything for your ACS Docker Swarm deployment can be found on my GitHub here. This is part 1 of a 3 series post discussing how to use each piece of the repository. Part 1, the post you’re currently reading, will focus on the ACS Swarm Cluster deployment – I.E. the acs_deploy.sh located in the deployment folder.

Note: In order to use this script, as commented out on line 2, you will need to have already created an SPN. See my previous post for more info. Next, you will be asked to set variables for the following:

Don’t worry, the script itself will set them for you. The script will then log you in with your SPN, create a resource group for you, and proceed with the deployment. To learn more about the ‘az acs create’ command and the switches you can use, check out the Microsoft documentation here.

By default, this script will generate a private and public key pair for you via the –generate-ssh-keys switch. At the end of a successful deployment, you will be presented with an output of important information, including your Master and Agents FQDN using the Dnsprefix you set at the start of the script. While the script can be found on my GitHub provided above, I also included an example of the script below:

In my next post (part 2), we will talk about how we can use this deployment with an SSH tunnel as part of a Dockerfile!

Reminder: All of my posts are provided "AS IS", imply no warranties, and confer no rights or special privileges. Use of included postings, code samples and other works are subject to the terms specified at Microsoft. For more information, click here.

Leave a Reply

Your email address will not be published. Required fields are marked *