A quick hack to run an Azure Development Instance with a few tools pre-installed and accessible via TailScale.
This is an Azure Resource Manager template that automatically deploys a development instance running Ubuntu 22.04 and a small set of development tools, namely pyenv
, nodenv
, Go and Docker CE.
The template defaults to deploying a Standard_B8ms
VM with a relatively large Premium SSD disk size (P10, 128GB). It also deploys (and mounts) an Azure File Share on the machine with (very) permissive access at /srv
, which makes it quite easy to keep copies of your work between VM instantiations.
After the first login, you can add your own SSH key (do not use the generated one other than for initial login - it won't pollute your config, and is meant for single-shot use) and remove both the public IP address and the NSG rule that allows SSH access (which defaults to your current outbound public IPv4 address) and use TailScale to access the instance.
I needed a baseline template for remote development sandboxes, and I wanted it done purely through the CLI with reproducible results.
- Make
Makefile
self-documenting - Automatically set up Tailscale with
--authkey
to remove need for open SSH port in NSG - tweak some defaults
- remove unused packages from
cloud-config
- tweak
Makefile
- remove unnecessary files from repo and trim history
- fork from
azure-stable-diffusion
, newREADME
make help
- shows a list of available commandsmake keys
- generates an SSH key for provisioningmake deploy-storage
- deploys shared storagemake params
- generates ARM template parametersmake deploy-compute
- deploys VMmake view-deployment
- view deployment statusmake watch-deployment
- watch deployment progressmake ssh
- opens an SSH session to the instance and sets up TCP forwarding tolocalhost
make tail-cloud-init
- opens an SSH session and tails thecloud-init
logmake list-endpoints
- list DNS aliasesmake destroy-environment
- destroys the entire environment (should not be the default)make destroy-compute
- destroys only the compute resources (should be the default if you want to save costs)make destroy-storage
- destroys the storage (should be avoided)
az login
make keys
make deploy-storage
AZURE_TAILSCALE_AUTHKEY=<your auth key> make params
make deploy-compute
make view-deployment
# Go to the Azure portal and check the deployment progress
# Clean up after we're done working for the day, to save costs (preserves storage)
make destroy-compute
# Clean up the whole thing (destroys storage as well)
make destroy-environment
Azure Cloud Shell (which includes all the below in bash
mode) or:
- Python 3
- The Azure CLI (
pip install -U -r requirements.txt
will install it) - GNU
make
(you can just read through theMakefile
and type the commands yourself)
Pro Tip: You can set
STORAGE_ACCOUNT_GROUP
andSTORAGE_ACCOUNT_NAME
inside an.env
file if you want to use a pre-existing storage account. As long as you usemake
to do everything, the value will be automatically overridden.
Keep in mind that this is not meant to be used as a production service.