Sometimes you will find that you need a cloud environment for working on a project. In some cases, you need the environment to perform a task that would take too long when you run it locally (for example, downloading a large file to transfer to Azure Blob Storage). Perhaps you need a mobile environment to make progress on a current project. You might just want a clean space to test a plugin or integration.
In these cases, you might consider setting up a temporary workspace in Azure on a virtual machine. This allows you to work via remote desktop in a clean environment on Azure, taking advantage of the performance gains from being on that environment. Let’s see how easy this it is to create your own personal environment.
Creating Your Resource Group
To begin, you’re going to want to create a new resource group (RG). A resource group is a way of grouping together Azure resources that are being used together. When a resource group is deleted, everything in the group is deleted. This makes cleanup fast and easy. Begin by opening the Resource groups blade. Press the Add button to create a new group.
Name your group in a way that makes it easy to understand the purpose. Select a location that is close to you if you plan to use the machine as a workspace. If you are needing to interact with resources in the Azure cloud, pick a location that is in the same region as the resources you want to work with to minimize charges. Press Create to create the new resource group. Special note: you may need to press the Refresh menu item in the Resource groups blade in order to see the new group.
Now that we have a resource group, we need to begin creating our workspace. For this demo, we’re going to create a Visual Studio 2017 Enterprise Edition environment. Click the newly created resource group to open it. Once it’s open, press the Add button to start creating new resources.
After pressing Add, the marketplace will open. Type Visual Studio. You will see several options available. For this demo, I’m going to select Visual Studio Enterprise 2017 on WIndows Server 2016 (x64). This will bring me to a screen where I can select a specific image. Let’s choose Visual Studio Enterprise 2017 (version 15.2) on Windows Server 2016 (x64). If you don’t have an MSDN account or a VS Enterprise license, make sure to choose the free Community Edition.
Make sure that the image is being created using the newer Resource Manager deployment model instead of the legacy Classic model. This will ensure you can use the latest features. Press Create.
You will now be guided through a wizard that will help you create the virtual machine. Most of the options are fairly intuitive. Make sure that the machine is being created within our resource group. I recommend leaving the disk selection as SSD for the best performance when you plan to use applications like Visual Studio that need to use the disks frequently. Once you have filled in the first page, press OK to move to Step 2. Make sure to remember the user name and password you create here. You’ll need those credentials to log in to your virtual machine later.
In Step 2, we choose the size for our VM. You can read the specifics about the various machine sizes in the Azure docs ( here). I recommend starting with a DS2_V2. You can always increase the size if necessary. Some tips on this screen:
- You can start with a large machine (such as a DS4) and scale down after the machine is created. Bigger machines are always available sooner because they launch faster.
- If you need extra bandwidth for network activities, use bigger machines. The performance differences can be very noticeable as you scale up.
- If you don’t see the machine size you want, it may not be available in the selected region. Go back to Step 1 and change the location for the machine. Just be sure to keep it in the resource group.
You won’t need to change anything when you get to Step 3. All of the defaults will work for our example. Just press OK.
Step 4 is a final validation and gives you the option to download the template and parameters that are being used to create this virtual machine in Azure Resource Manager. This allows you to recreate this environment quite easily from Powershell or the Azure portal without having to go through this wizard a second time. Press OK to build your VM.
You will now be returned to the main landing page in your portal where you will see a special tile that shows you the status of this deployment.
When your virtual machine is finished deploying, you can jump to it by using Search, opening the resource group, or opening the virtual machines blade. Click on the virtual machine to open the Overview blade.
On the Overview blade, you can find out the Public IP address to use to Remote Desktop into your new machine. If you want to download a pre-configured RDP file for connecting to the virtual machine, click the Connect button in the upper left.
Now, it’s time to connect to our new machine. Open Remote Desktop using either the downloaded RDP or the public IP address and press Connect. Then enter the user name and password you specified when you created the virtual machine to connect to the desktop.
You have arrived. Sign in with your MSDN credentials to enable all of the features in the Enterprise Edition and to allow you to use the application. Congratulations!
While the virtual machine is running, you will be billed for the time. If you aren’t going to need the virtual machine, you can stop the instance to avoid paying the Compute charges. Because the managed disk is still allocated, you will pay for that storage. To stop the instance, click the Stop button on the Overview blade. It’s important to note that because a stopped instance de-allocates the resources, when you choose to restart the machine you will most likely be assigned a new public IP address.
When you are done, you can delete the resource group to permanently remove the virtual machine and all of its resources. The Delete option is found in the Resource group’s overview blade.
Wait — what about the costs?
If you visit the pricing guide, the numbers can seem quite high. For example, at the time of this writing a dual-core D2v2 machine is $183/month and a quad-core D3v2 is $365/month. Remember that with Azure, you pay for what you use … and you won’t be using this machine 24×7. Azure billing on virtual machines rounds to the nearest minute, so the pricing can be very effective. Using a D2v2 instance for 4 hours will cost you just under $1 in compute charges. To use the more powerful D3v2 instance, you will pay less than $2. If you make sure to stop the VM when it is not in use, you can minimize the compute charges. And if you delete all of the resources when you are finished with the VM, then you can stop the billing entirely. As you become more experienced with deploying in Azure, you can use the templates you created earlier with Powershell to quickly create an environment, then remove the resource group via Powershell when you are finished. This can make it even easier to just use the resources you need.
Enjoy your new environment and happy DevOp’ing!