Skip to main content

Simple tutorial about configuring and using a virtual machine in Microsoft Azure

Lately while doing some kind of homework for my master's degree I wanted to try something which I haven't done in a long time. So I bough a virtual machine on Microsoft Azure using their pay-as-you-go billing scheme.

I forgot how easy it was and useful is to do this, so I decided to write this simple tutorial. If you just want an extra machine to use from time to time with a bit of power this is the way to go. People that do 3D graphics and stuff can benefit a LOT from this. Imagine having a 16 core powerhouse at your disposal. Actually the people at Azure made some dedicated cloud services just for rendering. Currently only Maya and 3D Max are supported. You can find more information about the service here: https://rendering.azure.com/

Their pay-as-you-go billing scheme is brilliant. You just pay the time the virtual machine is online. When you don't need it anymore you just can stop it and you won't be billed anymore.If you don't use it that often it is actually pretty cheap per hour, something like 0.2 euros for a quad core machine. If you don't want to use it anymore, you just stop it and that's it. If you need it again you just start it again. If you make any changes to the operating system on the virtual machine like installing some new programs, they will be saved when stopping and starting the virtual machine.

One thing to remember is the fact that a virtual machine must be stopped and deallocated in order not to bill you. A virtual machine can be stopped without being deallocated and it will still bill you. Also I am not too sure that you won't be billed a small fee even if the machine is deallocated. There are still some resources like disk space, network IP and so on which are still used.

So how do you create your own virtual machine in Microsoft Azure? It is very simple actually. Just login into the Azure portal at the address: https://portal.azure.com/

Once logged in the portal, click on the hamburger menu on the top left corner and a list of possible actions will expand on the left like in the screenshot bellow:



In my example I already have 2 machines created that you can see in the list. To add a new machine just click on the  Add button above the virtual machines list.

A new list with supported operating systems will appear. I recommend using either a Linux distribution or a Windows Client machine because they are a bit cheaper and do pretty much around 95% of what you really need.

Once you click an operating system a new form will appear on the right side to select a version of the operating system like bellow. In my case I used Windows Client


Once you click on the operating system version you will be prompted with a license agreement that you have to agree with which I won't be posting here.

After that a new page will appear which has some steps about how to configure the virtual machine. The first step is just about the name of the machine, if it has a SSD or HDD (I recommend a HDD to save some money, don't need SSD for this). One important detail here is the region which I recommend of course to be as close to you as possible.


 After you click OK on the bottom you will move to the next step.

At step 2 you need to select how powerful you want your virtual machine to be. This list initially contains just one machine type like bellow. You need to click on the View All button too see all the possible machine types:


I recommend getting a slower machine in the beginning.
Once you made up your mind, just click on the machine type you want and the select button bellow will become available. Click it to move to the next step.


At step 3 you can configure some basic things about the machine. I recommend here selecting a public static IP address like in the screenshot bellow:


Click on the Public IP Address setting. A new frame will appear on the right from which you can select an existing public IP address or create a new one. Click on Create New to add a new one. I recommend to use a static IP address instead of dynamic IP address. When you restart a virtual machine it will get a new address if you haven't selected a static IP address at this step.

If for example you actually want to run some background workers on this machine from an external environment other than Azure you might need to update the IP address each time if it's not static. For example you can host some web services and the consumer of the services might crash because the address of the services has changed.

Or you can event host a website on a virtual machine. If you have a static IP address you can register a domain name and enter that IP address. On the virtual machine you just need to set up your website and it will work with the registered domain name. Of course you might need more than this like a database and various other services. Actually a website hosted on Azure is just this, a virtual machine with a public static IP set up for you and a preconfigured web server.

Back on track. Once you click OK bellow the settings pane you will move to the final step which is pretty much just a summary of the virtual machine options you selected like in the pictures bellow:


Once you click OK your machine will start to be created also known as provisioning.
It will take a while for it to be created. You will be moved back to the list of virtual machines that you have but this time it won't be empty. You can see the status of the virtual machine will be creating.

After a while, around 20 minutes the virtual machine will become available. This is kind of an disadvantage but it happens just the first time you do this.

Once the machine is allocated and it has the status Running you can log remotely on to it. This is only the case if you use a Windows Client. I actually don't know how the Linux based virtual machines work.

To connect just click on the 3 dots to the right of the virtual machine entry in the list of virtual machines. A new menu will appear with some options like bellow:


Once you click connect, a new file will be downloaded immediately which will be opened with the Remote Desktop Connection Client.

After you open it a new window will appear requesting your password that you configured in the configuration pane at step 1.

When the remote desktop connection is established you can see on the connection bar the actual public IP of your cloud machine.

And that's about it. You have now a new PC on the cloud on Azure with which you can do whatever you want. Remember, you need to have pay-as-you-go subscription enabled on your account.

This is just a manually create and allocated machine for when you need it. You can actually dynamically create new machines as you need them or as your website or service needs them. I think they are hidden behind a load balancer. So the public IP will be that of the load balanced. You can configure to trigger the creation of new machines behind the load balancer once the existing machine reach a given usage. I am not too sure about this though. I am just saying what I heard and understood from other people. But I am 100% sure you can have a load balancer and configure it with a number of virtual machines.

Comments

Popular posts from this blog

Some software development common sense ideas

 I haven't really written here in a long time so it's time to write some new things. These are just some random common sense things that seemed to short to write about individually but seem really interesting and useful to me or other people 1. There is nothing fixed in software development, all things vary by circumstances and time Remember the documentation that didn't seem that important when you started the project, well after a couple of years one the application has grown and become really complicated, no one actually knows everything about the application anymore. So now you really need that documentation. What happens if you suddenly need much more people to develop the application because of some explosive growth? Without documentation, new developers will just look at the application like they look at a painting. This actually happened to me. Maybe in the beginning of a project, a technology really helped you a lot but as the project grew, it started making things

My thoughts as an experienced developer in this field.

To be honest, I would have never guessed that      I would end up saying these these things, especially jn the beginning of my career. As you become more experienced, you kind of get to see everything and you become less impressed by new things. Honestly there is some sort of repetitiveness in this field and we kind of like to reinvent the wheel quite often, because well, we become a bit too easily bored. Take for example how the web looks now, a lot of it has been borrowed from other places, mostly desktop development, especially the parts about making custom reusable components.  Or from older frameworks, like state management in the UI which actually was first properly implemented in Asp .Net Webforms, as far as I know, something like 20 years ago, where you used to have the dreaded view state.  But most likely something similar existed before that too. I was not that surprised when React adopted initially this idea. Or even less surprised when hooks where introduced that seemed a b

Some things which are often blindly applied and followed by developers which are not always good

This is probably one of the most controversial things that I have written so far but I am just tired of hearing about these things and discussing these things. Other developers that I know share part of my feelings. I would rather hear more about how people built things, overcame challenges or what new interesting ideas and concepts they implemented. Those things are really interesting and innovative, not hearing about the same theoretical things over and over again. I can just read and learn those things from 100 sources on the internet. Firstly, one of the most discussed and promoted things is agile/scrum development. I think I have been through 5-8 workshops about agile development methodology. And each time, some things differed. There is no 100% standard approach to this. Everyone uses their own version of this development methodology and seem to argue a lot that their approach is right and everyone else is doing it wrong. You go to an interview, this will be one of the first 10 t