Skip to content

Instantly share code, notes, and snippets.

@danielscholl
Last active May 5, 2017 23:18
Show Gist options
  • Save danielscholl/527272f50c2d3cd54dee2a04b19ba147 to your computer and use it in GitHub Desktop.
Save danielscholl/527272f50c2d3cd54dee2a04b19ba147 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [[ ! $1 ]]; then
echo "\$1 Argument required for Virtual Machine Name"
exit 1
fi
VM=$1
GROUP=$1
# Create a resource group.
az group create --name ${GROUP} --location centralus
# Create a new virtual machine, this creates SSH keys if not present.
az vm create --resource-group ${GROUP} --name ${VM} --image UbuntuLTS
# Open port 80 to allow web traffic to host.
az vm open-port --port 80 --resource-group ${GROUP} --name ${VM}
# Install Docker and start container.
az vm extension set \
--resource-group ${GROUP} \
--vm-name ${VM} \
--name DockerExtension \
--publisher Microsoft.Azure.Extensions \
--version 1.1 \
--settings '{}'
# --settings '{"docker": {"port": "2375"},"compose": {"web": {"image": "nginx","ports": ["80:80"]}}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment