In recent months, Microsoft has made some tremendous strides in improving the overall user experience for administrators working with the Azure Cloud Platform. As I have transitioned from AWS over to Microsoft Azure, I have quickly learned how easy it is manage an IaaS through their latest management portal. However, one functionality I struggled to find in the user interface was the ability to take virtual snapshots. Looking through tons of documentation, I eventually discovered the only way to take a snapshot was through the ARM (Azure Resource Manager) REST API. Despite being completely capable of writing a quick powershell script to handle this, I couldn’t help shake the feeling that their had to be an easier way to do this. Long and behold, there was! (sorta…)
The Azure Resource Explorer is system capable of providing convenient access to the REST API through a simple web interface. If you are interested in seeing it for yourself and you have an active Azure account, head over to https://resources.azure.com/. After authenticating with your Azure Credentials, expand subscriptions, the associated account name, resourceGroups, the resource group your virtual instance is apart of, providers, Microsoft Computer, virtualMachines, and finally select the virtual instance. In our example below, Jenkins is the name of our virtual machine. Another easy option is to search at the top by your instance name and select the entry with Microsoft.Compute/virtualMachines.
The Azure Resource Explorer will then automatically populate the page with information gathered through the ARM Rest API in reference to your virtual instance. If you wished to quickly change a property of your virtual environment, select the EDIT button, change the corresponding field and hit the PUSH button. The Azure Resource Explorer will automatically take care of the rest (no-pun intended). Now, if you are interested in taking a vm snapshot select the tab labeled Actions(POST, DELETE). A series of buttons will load which function to automatically make ARM REST calls for some basic functions. To snapshot your vm, begin by selecting the deallocate button. This task will take a few minutes to complete as the machine shuts down so please be patient. To check the status, return to the Data(GET, PUT) tab and hit the GET button until the status shows deallocated. Once completed return to the Actions(POST, DELETE) and select the generalize button. After this action completes (it’ll happen instantly) fill in the json template to the right of the capture button as depicted below. Ensure to remember the information typed as you will need it to leverage your snapshot in the future. Finally, hit the capture button to begin taking a snapshot.
That’s it! If you’re wondering how to access your new virtual instance snapshot, start by grabbing the storage account name where your vm is stored. This can be easily retrieved by returning to the Data(GET, PUT) tab and looking for the “StorageAccount” key within the json response. Now navigate to https://portal.azure.com/#blade/HubsExtension/Resources/resourceType/Microsoft.Storage%2FStorageAccounts. Select the storage account name you found previously, select containers and choose the system container. Drill down into the Microsoft.Compute folder followed by Images and lastly the container name you specified in json during capture stage.
In this folder you’ll find your newly created snapshot and a baseline ARM json template which can be used to spin up a new virtual machine using your image. To view your template, simply select the json file in the directory and hit the download button. And that’s all! If you or your team are interested in learning more about Microsoft Azure, contact us today!