Alrighty. Now for getting this docker vm up on Azure.

I'm mostly follwing Microsoft's Azure-Docker tutorial for the cli for the windows azure part of this post and for the azure-cli install I used Squillace's azure cli tutorial:

Making some certificates and permissions as decribed by Microsoft:

$ openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem
$ openssl pkcs12 -export -out mycert.pfx -in mycert.pem -name "My Certificate"
$ openssl x509 -inform pem -in mycert.pem -outform der -out mycert.cer

After creating the mycert.cer file it was just like Microsoft described in their tutorial. Scroll down to settings in the azure table of contents, and in settings click on the Management Certificates. There should be an upload button at the bottom of the screen. Upload your created certificate.

Now I need to be using the Azure CLI. And according to this blog post from Microsoft you need Node.js and npm to install it. Also, it sounds like you might need some legacy Node.js for azure-cli to load properly. I'm doing this all on an Ubunut VM, so if it is a screwed up version of node, I don't give a rip. It just has to work. Here are the commands:

$ sudo apt-get install nodejs-legacy
$ sudo apt-get install npm
$ sudo npm install -g azure-cli

Now to login:

$ azure login
info:    Executing command login  
/info:    To sign in, use a web browser to open the page https://aka.ms/devicelogin. Enter the code DJAJJS49PP to authenticate. If you're signing in as an Azure AD application, use the --username and --password parameters.

Open up the browser for authentication goodness. For some reason I had to do the above authentication twice before I could get azure account list to work.

List the accounts associated with your id

$ azure account list
info:    Executing command account list  
data:    Name      Id                                    Current  State  
data:    --------  ------------------------------------  -------  -------  
data:    BizSpark  8c2345q5g-345r-2345f-345d-as455dfsdf  true     Enabled  
info:    account list command OK  

Now for installing docker-machine. First we install curl:

$ sudo apt-get install curl

WARNING, I think the below call wiped out my previous docker images...
Then, as described on docker's install instruction page for docker-machine:

$ curl -L https://github.com/docker/machine/releases/download/v0.5.0/docker-machine_linux-amd64.zip >machine.zip && \
unzip machine.zip && \  
rm machine.zip && \  
mv docker-machine* /usr/local/bin  

Because I haven't chmod'd the /usr/local/bin I had to run the mv with sudo:

$ sudo mv docker-machine* /usr/local/bin/

Now to create the vm on Azure with all the good docker bits and the credentials we've made. Azure has the process described on their web page as follows (but this didn't work for me):

$ docker-machine_linux-amd64 create \
-d azure \
--azure-subscription-id="<subscription ID acquired above>" \
--azure-subscription-cert="mycert.pem" \
machine-name  

Instead I needed to replace docker-machine_linux-amd64 with docker-machine. The below sample uses the id we collected from the call to azure account list(although, this one is totally false). You'll want to replace geometry-client with the name of the vm you'll be creating:

$ docker-machine create \ 
-d azure \
--azure-subscription-id="8c2345q5g-345r-2345f-345d-as455dfsdf" \
--azure-subscription-cert="mycert.pem" geometry-client

The build process will take a while, but once it's done you can make a call to azure vm list and you'll get a print out of all your VMs, including the one you've just created with docker-machine. Here's my printout:

info:    Executing command vm list  
+ Getting virtual machines                                                     
data:    Name             Status     Location    DNS Name                      IP Address  
data:    ---------------  ---------  ----------  ----------------------------  -------------  
data:    geometry-client  ReadyRole  West US     geometry-client.cloudapp.net  120.65.152.45  
info:    vm list command OK

There is some discussion of environment variables in the microsoft blog. I don't know if it's necessary, but I did it anyways. Honestly, there's a few mentions of this in the blog and I don't really know the significance (this might be more my inexperience with bash):

$ docker-machine env geometry-client

Now to play with different docker VMs!! But first I need to run stop and start to get docker to behave:

sudo service docker stop  
sudo service docker start  

Now, now is the time for play! Microsoft suggests running a quick nginx test:

$ docker run --name machinenginx -P -d nginx
$ docker ps -a

The port printout allows you to map the incoming tcp traffic appropriately.

$ azure vm endpoint create machine-name 80 49153

After the above command I was able to visit my azure site and see the nginx welcome page.

Next to try with a rabbitmq worker on Azure!