beckmarkwith - Fotolia
Modern cloud platforms provide speed, agility and automation, which, in turn, provides lots of possibilities for testing software and performing disaster recovery exercises.
IT teams can use cloud providers' infrastructure-as-code and deployment-automation services to easily spin up complex app environments in minutes. Because of this flexibility, cloud administrators often ask if there is a way to clone an entire application environment and its dependencies. Unfortunately, there's no one-click fix that will do this seamlessly. But, for Microsoft's cloud users, there are methods that can help close the gap and replicate Azure resources.
Azure Resource Manager templates
Microsoft's Azure Resource Manager (ARM) is the foundational layer of the platform upon which the web-based portal, command-line interface and client software development kits are built. Resource Manager also supports template deployments, which serve as a native Azure option for infrastructure as code.
Azure Resource Manager templates are a great place to start for teams that want to clone existing resource groups, which are sets of related Azure resources. Admins can repeatedly deploy templates and consistently build workflows via an API call or button-click in the Azure Portal. While infrastructure as code may sound complex, you don't have to start from scratch; instead, export a resource group to an Azure Resource Manager template, as shown in Figure 1.
There are some caveats with this approach. I recently found that the access policies for an Azure Key Vault resource are not included when you export the automation script for the parent resource group. Other users have reported similar situations with other resources as well. In these cases, you'll need to use the Resource Explorer or template documentation to find the correct syntax in order to manually declare those resources in your template.
Templates simply declare resources and will not replicate data. When you deploy the exported template, it will build a new VM with the same configuration, but the resources -- such as the virtual disks -- will be completely new.
Virtual machine images
Technically, there isn't a cloning process for VMs in Azure. It's possible to capture a VM into a new image, but there are limitations to this approach.
When you review the properties of a VM in the Azure Portal, you'll see a "capture" button on the Overview screen. The VM-capture process builds a new disk image based on the source. This makes it possible to build an identical VM with preinstalled software that's baked into the image.
Multiple steps are required to prepare the source VMs, and these steps vary based on whether an organization runs Windows or Linux. For example, you must generalize Windows servers, which limits support for particular server roles installed on VMs.
Capturing a VM image will make the source VM unusable, so don't use it with production servers. However, you can deploy custom images with an ARM template, which you could generate based on an existing Azure resource group.
SQL Databases and web apps
Microsoft also offers ways to make copies of Azure resources, including databases and web apps.
For example, the Azure SQL database service provides a few flexible options to make database copies. You can deploy these copies on the same managed server or on a new one. Enterprises can create database copies for Azure SQL database with the Azure portal, PowerShell or through T-SQL commands.
This is a good option for teams that want to cobble together their own cloning process for database-driven web applications. IT teams can clone the front end of a web app that runs in Azure App Service to a new resource and configure that application to point to a new database copy via Azure SQL database copy support.
Developers can also use Azure App Service -- through the portal or any of the command-line tools -- to create a replica of an existing Azure web app.
This feature may be useful if your applications are hosted as managed web apps on App Service. One major caveat is that the web app must run on a premium App Service plan. However, it's a quick and easy way to clone a web app into a region.