Developing and testing the applications we build is difficult enough without worrying about setting up and managing servers and infrastructure needed to power our development and testing efforts. Getting new hardware purchases approved, racking and stacking servers, and waiting to get virtual machines set up can be big time drains in our dev/test workflows. These obstacles could be removed if we developers could provision our own servers without needing time from our infrastructure and operation teams. And, wouldn't it also be great if we could automate the setup of these environments? Well, guess what? Developers can now do this in the cloud with Microsoft Azure.
Microsoft Azure is a brilliant solution for developers and testers. To begin, Microsoft Azure provides massive amounts of infrastructure you can utilize to run your applications and systems, with the ability to run your largest workloads. And, you always can scale up or out whenever you like. This is big news for our dev/test workloads; we now can set up an environment that closely resembles our production environment, and it won't cost a small fortune because you only pay for the resources and time that you use!
One of the ways the cloud really shines is in its scalability. You may have predictable times when the usage of your apps and services spike or drop off, or your usage may be completely unpredictable. In both cases, Azure can scale out and up to meet demand, or scale back in and down when the load decreases. This scalability enables your applications and technology to grow as fast as your business. And, if you want to turn your systems off for a period of time, maybe you don't have any new deliverables to test, you won't be spending money on wasted and underutilized resources.
Microsoft Azure services can be broken down into three major areas: compute, data, and application services. This five-part series will focus primarily on compute and data services. We will be storing Virtual Machine (VM) disks in an Azure data service, and running our VMs on Azure compute services. What about application services? Azure application services are a great bonus feature. Because you only pay for services you use in Azure, if you find that you need the ability to stream media or robust messaging in your applications, you can easily integrate those prebuilt Azure services into your apps.
Get Started with Azure for FREE
To get started with dev/test in the cloud, you will need an active Microsoft Azure subscription. If you don't currently have a subscription, you can get a free one-month trial with $200 that you can spend on whatever Azure services you want to use. If you have an MSDN subscription, you get up to $150/month of Azure services.
To set up an account, go to http://azure.microsoft.com/en-us/pricing/free-trial/ and click the Try it now button, as shown in Figure 1.
Figure 1: Azure's free trial offer
To sign up for a Microsoft Azure account, you'll need to log in with your Microsoft Account (previously known as Live ID). If you don't yet have a Microsoft Account, find the link in the blue box on the left that reads Don't have a Microsoft account? Sign up now and click it. This will navigate you to the signup form. Fill out your information and create a Microsoft Account, as shown in Figure 2.
Figure 2: Signing in to Azure
Now that you've created and/or signed in with your Microsoft Account, you'll be taken to the free trial form, displayed in Figure 3.
Figure 3: The Microsoft account information
The phone number you enter will be used to verify you are real, either through a text message or a phone call.
Figure 4: Completing the sign-up information
After you are verified, you will be asked to fill out your credit card information. Don't worry; this is not so Microsoft can bill you for your free trial. This is to make sure you are not creating multiple free accounts, and should you decide you want start paying for Azure and use more than the $200 in the free trial, you'll be able to easily do that. Billing doesn't automatically start after your free month is over. Instead, your account will be turned off after the free trial, and if you want to continue using Azure by paying for it, you can choose to do that and Microsoft will keep your account active.
Now that your account is set up, you will be directed to your Account portal with a list of your subscriptions, as shown in Figure 5.
Figure 5: Your free trial period has now started
To get started creating servers and managing Azure services, click the Portal button in the upper right corner. This will take you to the Azure Management Portal. The first time you log in, you will be shown a wizard that shows you around. You can skip this step if you'd like, or step through it to learn a little about the Azure Management Portal.
We are now ready to accelerate our development and testing! Let's begin by provisioning a server. Because we need a SQL Server for our database that we will create in the second part of this series, let's create the server now.
Creating a SQL Server
In order for us to test our applications, we need a test environment, with servers to run our applications. The Azure Infrastructure as a Service (IaaS) services allows us create virtual machines on demand by using the Management Portal. Azure provides a gallery of pre-built server templates that we can use to accelerate setting up both Windows and Linux servers. There are also templates that have application servers like SQL Server installed and configured. For our SQL Server, will we start with a pre-built SQL Server 2012 template from the Azure VM Image Gallery.
Azure Virtual Machines are hosted on servers in the Azure data center, and the disks that are used by Azure Virtual Machines are stored in the Azure Storage service—Blob Storage to be specific. To achieve the best performance, and reduce latency between compute and storage, you need to optimize the distance between them. Affinity Groups in Azure are the solution. You can associate the Azure services that you create with an Affinity Group. Azure will keep the services in the same Affinity Group close to reduce latency and provide optimal performance.
To create an Affinity Group, navigate to Settings towards the bottom of the list of Azure services that is on the left side of the Azure Management Portal. On the Settings screen, click the Affinity Groups link at the top. Click the Add button in the toolbar at the bottom, as shown in Figure 6. (The buttons in this toolbar change based on where you are in the Portal.)
Figure 6: Going to Affinity Groups
You will be shown the Create Affinity Group dialog. Enter devtestGroup for the name, enter a brief description if you'd like, and choose the data center you want to use for your Virtual Machines, such as East US, and click the checkmark to create your Affinity Group.
Cloud Services provide the public endpoint, load balancer, and network boundary for Virtual Machines. You can create a Cloud Service for your Virtual Machines when you create your VMs, or you can select an existing Cloud Service during the creation of your VMs.
To create a Cloud Service prior to creating your VMs, click Cloud Services in the list of Azure service on the left side of the Azure Management Portal, as shown in Figure 7.
Figure 7: Selecting Cloud Services
Click the New button in the toolbar at the bottom. The New button is context-aware, and because you have Cloud Services selected, it will open the New toolbar at the bottom with Cloud Services selected. Click Custom Create, as shown in Figure 8, to launch the New Cloud Service dialog.
Figure 8: Launching the New Cloud Service dialog
In the New Cloud Service dialog, enter a unique URL for your Cloud Service, select your devtestGroup Affinity Group, and click the checkmark, as shown in /figure 9 to create your Cloud Service.
Figure 9: Creating a Cloud Service
You now have an Affinity Group and a Cloud Service for your Virtual Machine; there's only one more thing to do before you create your first VM. All of the disks for your VMs will be stored in a Storage Account; the New Virtual Machine wizard will create a storage account for you if you don't have an existing one to use. But, if you'd like to control the name of the Storage Account, you will need to create it in advance.
Click Storage from the list of services on the left side of the Azure Management Portal, and click the New button, as shown in Figure 10.
Figure 10: Choosing Storage, New
The New toolbar is expanded at the bottom of the Azure Management Portal. Because the Storage service was selected when you clicked the New button, Data Services | Storage is selected. Click Quick Create and enter a unique URL for your Storage Account, select your devtestGroup Affinity Group, leave Geo-Redundant replication selected, and click the Create Storage Account checkmark as shown in Figure 11 to create your storage account.
Figure 11: Creating your Storage Account
You have now created an Affinity Group, Cloud Service. and Storage Account. You now are ready to create your first VM.
To create a Virtual Machine, click Virtual Machines in the list of Azure services on the left side of the Azure Management Portal. Click the New button at the bottom, as shown in Figure 12.
Figure 12: Creating a Virtual Machine
The New toolbar is expanded at the bottom of the Azure Management Portal with Compute | Virtual Machine selected. Click From Gallery to launch the Create Virtual Machine wizard. Find and select SQL Server 2012 SP1 Enterprise and click the next arrow, as shown in Figure 13.
Figure 13: Choosing a VM image
On the second page of the Create Virtual Machine wizard, leave the latest Version Release Date selected, enter sqlvm1 for the Name, select A1 for the VM size, enter an Administrator user name and password, and click the next arrow at the bottom, as shown in Figure 14, to proceed to the next page.
Figure 14: Configuring the VM
The A1 VM size has very limited resources for a real-world SQL Server workload, and you would likely need a larger VM size, such as an A3 or larger. To learn more about the available VM sizes and their associated cost, visit http://azure.microsoft.com/en-us/pricing/details/virtual-machines/.
On the third page of the Create Virtual Machine wizard, select the Cloud Service you created in the earlier steps; this will default the Affinity Group to the one associated with your Cloud Service. Next, select the Storage Account you created in the earlier steps. Leave None selected for Availability Set, leave the default Remote Desktop and PowerShell endpoints configured, and click the next arrow, as shown in Figure 15.
Figure 15: Continuing the VM configuration
The last page of the Create Virtual Machine wizard allows you to install the VM agent and VM extensions. Leave the defaults set on this page, as shown in Figure 16, and click the checkmark at the bottom to create your VM.
Figure 16: Finishing the VM configuration
Your SQL Server Virtual Machine is now being created; it will take several minutes to complete. You can monitor its progress in the toolbar at the bottom.
In Part 1 of this series, you have learned how the cloud provides a flexible and affordable infrastructure to help us overcome common challenges of developing and testing software. We learned about some of the advantages of using Microsoft Azure for dev/test, and how to setup a VM configured with SQL Server, which we will continue to use in Part 2 of this series. Throughout the rest of this series, you will set up a database on your SQL Server, set up IIS web servers, deploy applications to your Azure VMs, and more.