Azure: Setup a development environment part 1

Why an Azure development environment?
The main problem I always have is that time is short and development is done in many different moment of the week. For myself a person that can be chaotic, Ansible + file revision with Git was the solution.

The problem

After 4 years of coding I realized that much of my automation was mostly done by Ansible, but the tricky bits where always done by hand. There’s always that easy excuse for ‘a quick fix’. Specially when you want to go out to a gig, training or you did not had your coffee in the morning.

Another problem is that all my VM’s in the cloud or colocation are production. VM’s or hypervisors are expensive. However, there is always the need to develop, learn and of course just playing around and there is where Azure comes in. With a few Ansible scripts and maybe 1 minute we can deploy a fully fledged development environment. This comes cheap. We’re talking about Euro cents per hour,minutes. Just do not forget to remove all used resources.

The solution: Force yourself

If you build everything from scratch, tear it down, build it up again and iterate many times, you can not get around with manual ‘quick fixes’. This enforces yourself a truly ‘infra by code’ way of thinking.

Prerequisites

Step 1:
Let get the party started. Before anything at all you need to create an Azure account. The first year comes with a nice free Tier. The only down site is you will need to have a credit card.

Step 2:
2.0. Install Azure Cli by following this document: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest
2.1 If you happen to use Centos or Fedora you can use my Ansible script: https://github.com/maikell/azure/blob/master/azure_cli/azure.yml
and execute it as: $ ansible-playbook azure.yml -K

Step 3:
Install pip + pip modules
3.0 $ sudo yum install python-pip (or something similar) in Debian with APT.
3.1 $ sudo pip install pip install azure

Now you are ready to play <3. Part 2: Deploying a development environment in Azure with 2 scripts.

Remove all resources and the VM

I can’t stress this part enough: When ever you are done with playing around and want to stop: Remove all resources. This prevents unforeseen costs. A resource group can be deleted within the Azure portal or fairly easily. Just be aware this will throw away the complete resources and the group: development.

$ ansible-playbook vm_provision/destroy_all.yml


Leave a Comment