Skip to main content

Azure Virtual Machines (Day 15 of 31)

List of all posts from this series:

Short Description 
On Microsoft Azure you have the ability to run, manage and use your own Virtual Machine. In this case you have full control to the OS and different configuration at that level. The hardware virtualization give you the possibility to install and run any kind of OS from Windows to different Linux distributions.

Main Features 
Not only Windows OS
Even if we are talking about a cloud solution from Microsoft, we have the ability to run different Linux distributions like Ubuntu or Suse. On top of this there are also other OS that can be used like Openlogic.
Custom VM Image
You have the ability to create your own Virtual Machine image and upload it. The custom image can contains not only the OS, but also the software that you need for your use case.
There is support for scaling from 1 or 2 VM to 500 or event 1000 Virtual Machines.
Per Minute billing
Because money are very important, the billing is per minute and not per hours. In this way you will pay only what you use, nothings more.
Load Balancing
There is an out of the box load balancer in front of Virtual Machine that can be used with success to distribute the load cross multiple virtual machines.
Intensive I/O Storage
With the new storage, based on SSDs, you can have a minimum latency (less than 1 millisecond) with 50.000 IOPS.
Large storage
The current infrastructure give us the possibility to have disks that can have in total 32TB of storage.
Pre-Configured VM Images
When you create a VM, you have the ability to use a pre-configured VM, where SharePoint, Oracle, SQLServer, Visual Studio is already installed.
Pay OS or software license on the fly
There are images with different configuration that allow you to use them without having the license of the software that is installed on them. This is possible because the cost of the software license is included in per minute billing.
Auto Scale
There are different ways to scale up or down automatically. For example you ca configure to scale up based on CPU level or at a specific time. Of course the scaling is not only in one way and you can configure rules that allow you to scale also down.
Because usually ITPros are responsible for Virtual Machine and the infrastructure, the configuration and management API is not only exposed as REST API, but it is also exposed as PowerShell commands.
Disaster Recovery Plan
All the content of VM is replicated automatically in a second data center from the same geographical region. In this way if something happens with the first data center the content is available on the second one.
Different tiers
There is a wide range of tiers configurations that can be used for Virtual Machines. From the small one to the one that are CPU intensive or memory intensive. Because of this you can start from 768MB of memory and go to 112GB of memory and 32 CPU cores.
Run the same image on Azure or on-premises
The same image can be run on Azure or on-premises. You even have the possibility to migrate an existing VM image from one environment to the other one.  

Custom images configuration 
When you need to create your own custom image with different configuration, you will need to manually create an image where you install all the software that you need.

Applicable Use Cases 
Below you can find 3 use cases when I would use VMs.
Migration to cloud
For existing legacy system, there is the possibility to migrate the existing VM to Azure without having to change the software that runs on them. In this way you can reduce the hosting costs and scale more easily without having to rewrite your systems.
Run custom software
If you have custom software to run, than Azure VMs can be the perfect solution for you. You can run a wide variety of OS and configurations on them.
Optimize Cost
If you need VM only for a limited time period, than this may be a good solution for you. When you don’t need to run VMs, you can keep only the image of them on Azure Storage and use it only when you need it.

Code Sample 

Pros and Cons 

  • Scalable
  • PowerShell support
  • Linux and Oracle support
  • Different hardware configuration based on you needs
  • Auto-Scale


When you are calculating  the costs of VM you should take into account:

  • Number of VMs and there configuration
  • Storage size
  • Outbound traffic
  • Licensing cost

Azure VMs are a great solution when you need a place to run and manage your own Virtual Machine.


Popular posts from this blog

ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded

Today blog post will be started with the following error when running DB tests on the CI machine:
threw exception: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See for more information. at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName) This error happened only on the Continuous Integration machine. On the devs machines, everything has fine. The classic problem – on my machine it’s working. The CI has the following configuration:

TeamCity.NET 4.51EF 6.0.2VS2013
It seems that there …

Entity Framework (EF) TransactionScope vs Database.BeginTransaction

In today blog post we will talk a little about a new feature that is available on EF6+ related to Transactions.
Until now, when we had to use transaction we used ‘TransactionScope’. It works great and I would say that is something that is now in our blood.
using (var scope = new TransactionScope(TransactionScopeOption.Required)) { using (SqlConnection conn = new SqlConnection("...")) { conn.Open(); SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Connection = conn; sqlCommand.CommandText = ... sqlCommand.ExecuteNonQuery(); ... } scope.Complete(); } Starting with EF6.0 we have a new way to work with transactions. The new approach is based on Database.BeginTransaction(), Database.Rollback(), Database.Commit(). Yes, no more TransactionScope.
In the followi…

GET call of REST API that contains '/'-slash character in the value of a parameter

Let’s assume that we have the following scenario: I have a public HTTP endpoint and I need to post some content using GET command. One of the parameters contains special characters like “\” and “/”. If the endpoint is an ApiController than you may have problems if you encode the parameter using the http encoder.
using (var httpClient = new HttpClient()) { httpClient.BaseAddress = baseUrl; Task<HttpResponseMessage> response = httpClient.GetAsync(string.Format("api/foo/{0}", "qwert/qwerqwer"))); response.Wait(); response.Result.EnsureSuccessStatusCode(); } One possible solution would be to encode the query parameter using UrlTokenEncode method of HttpServerUtility class and GetBytes method ofUTF8. In this way you would get the array of bytes of the parameter and encode them as a url token.
The following code show to you how you could write the encode and decode methods.