Deploying 20 CentOS VMs in 4 Minutes!

I recently started to toy around with scenarios that required me to deploy multiple duplicates of the same CentOS Virtual Machine configuration. Working on this scenario got me curious. So I decided to build a template that would allow me to deploy 20 CentOS Virtual Machines each with one 1TB data disk and one public IP addresses.

To my surprise, deploying these 20 Standard A1 CentOS Virtual Machines on Microsoft Azure took 4 minutes!

Building the ARM Template

Let’s start by taking a CentOS ARM Template from a previous post. It will be our starting point for this exercise. Now, let’s removed the extra data disk and removed the Custom Script for Linux Virtual Machine Extension.

To duplicate a resource, we must use the copy operation. It enables us to use an index number or to iterate through an array of values that can be used when deploying a resource.

"copy": {
          "name": "nodeCopy",
          "count": "[parameters('vmCount')]"
}

In this specific scenario, we want all our Virtual Machines to belong to the same Virtual Network and Subnet. Therefore, we need to duplicate each Virtual Machine, their Network Interface Cards (NIC) and their Public IP Addresses.

The following template, demonstrates the use of copyIndex() and concat(), to generate predictable identifiers for each copy.

DeploymentTemplate.json

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "newStorageAccountName": {
            "type": "string",
            "metadata": {
                "description": "Unique DNS Name for the Storage Account where the Virtual Machine's disks will be placed."
            }
        },
        "adminUsername": {
            "type": "string",
            "metadata": {
                "description": "User name for the Virtual Machine."
            }
        },
        "adminPassword": {
            "type": "securestring",
            "metadata": {
                "description": "Password for the Virtual Machine."
            }
        },
        "dnsPrefixNameForPublicIP": {
            "type": "string",
            "metadata": {
                "description": "Unique DNS Name for the Public IP used to access the Virtual Machine."
            }
        },
        "OSVersion": {
            "type": "string",
            "defaultValue": "7.1",
            "allowedValues": [
                "7.1"
            ]
        },
        "vmCount": {
            "type": "int",
            "defaultValue": 1
        },
        "virtualNetworkName": {
            "type": "string",
            "metadata": {
                "description": "Virtual Network Name"
            }
        },
        "vmNamePrefix": {
            "type": "string",
            "metadata": {
                "description": "Virtual Machine Name Prefix"
            }
        },
        "vmSize": {
            "type": "string",
            "defaultValue": "Standard_A1",
            "metadata": {
                "description": "Virtual Machine Size"
            }
        },
        "location": {
            "type": "string",
            "defaultValue": "West US",
            "metadata": {
                "description": "Location"
            }
        }
    },
    "variables": {
        "addressPrefix": "10.0.0.0/16",
        "dataDiskSize": "1023",
        "imageOffer": "CentOS",
        "imagePublisher": "OpenLogic",
        "nicName": "NIC",
        "OSDiskName": "osdisk",
        "publicIPAddressType": "Dynamic",
        "storageAccountType": "Standard_LRS",
        "subnetName": "Subnet",
        "subnetPrefix": "10.0.0.0/24",
        "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
        "vmStorageAccountContainerName": "vhds",
        "vnetID": "[resourceId('Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]"
    },
    "resources": [
        {
            "type": "Microsoft.Storage/storageAccounts",
            "name": "[parameters('newStorageAccountName')]",
            "apiVersion": "2015-05-01-preview",
            "location": "[parameters('location')]",
            "tags": {
                "displayName": "StorageAccount"
            },
            "properties": {
                "accountType": "[variables('storageAccountType')]"
            }
        },
        {
            "apiVersion": "2015-05-01-preview",
            "type": "Microsoft.Network/publicIPAddresses",
            "name": "[concat(parameters('dnsPrefixNameForPublicIP'),copyIndex())]",
            "location": "[parameters('location')]",
            "tags": {
                "displayName": "PublicIPAddress"
            },
            "properties": {
                "publicIPAllocationMethod": "[variables('publicIPAddressType')]",
                "dnsSettings": {
                    "domainNameLabel": "[concat(parameters('dnsPrefixNameForPublicIP'),copyIndex())]"
                }
            },
            "copy": {
                "name": "publicIpCopy",
                "count": "[parameters('vmCount')]"
            }
        },
        {
            "apiVersion": "2015-05-01-preview",
            "type": "Microsoft.Network/virtualNetworks",
            "name": "[parameters('virtualNetworkName')]",
            "location": "[parameters('location')]",
            "tags": {
                "displayName": "VirtualNetwork"
            },
            "properties": {
                "addressSpace": {
                    "addressPrefixes": [
                        "[variables('addressPrefix')]"
                    ]
                },
                "subnets": [
                    {
                        "name": "[variables('subnetName')]",
                        "properties": {
                            "addressPrefix": "[variables('subnetPrefix')]"
                        }
                    }
                ]
            }
        },
        {
            "apiVersion": "2015-05-01-preview",
            "type": "Microsoft.Network/networkInterfaces",
            "name": "[concat(variables('nicName'),copyIndex())]",
            "location": "[parameters('location')]",
            "tags": {
                "displayName": "NetworkInterface"
            },
            "dependsOn": [
                "[concat('Microsoft.Network/publicIPAddresses/', concat(parameters('dnsPrefixNameForPublicIP'),copyIndex()))]",
                "[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]"
            ],
            "properties": {
                "ipConfigurations": [
                    {
                        "name": "[concat('ipconfig', copyIndex())]",
                        "properties": {
                            "privateIPAllocationMethod": "Dynamic",
                            "publicIPAddress": {
                                "id": "[resourceId('Microsoft.Network/publicIPAddresses',concat(parameters('dnsPrefixNameForPublicIP'),copyIndex()))]"
                            },
                            "subnet": {
                                "id": "[variables('subnetRef')]"
                            }
                        }
                    }
                ]
            },
            "copy": {
                "name": "nicCopy",
                "count": "[parameters('vmCount')]"
            }
        },
        {
            "apiVersion": "2015-05-01-preview",
            "copy": {
                "name": "nodeCopy",
                "count": "[parameters('vmCount')]"
            },
            "dependsOn": [
                "[concat('Microsoft.Storage/storageAccounts/', parameters('newStorageAccountName'))]",
                "[concat('Microsoft.Network/networkInterfaces/', concat(variables('nicName'),copyIndex()))]"
            ],
            "location": "[parameters('location')]",
            "name": "[concat(parameters('vmNamePrefix'),copyIndex())]",
            "properties": {
                "hardwareProfile": {
                    "vmSize": "[parameters('vmSize')]"
                },
                "osProfile": {
                    "computername": "[concat(parameters('vmNamePrefix'),copyIndex())]",
                    "adminUsername": "[parameters('adminUsername')]",
                    "adminPassword": "[parameters('adminPassword')]"
                },
                "storageProfile": {
                    "imageReference": {
                        "publisher": "[variables('imagePublisher')]",
                        "offer": "[variables('imageOffer')]",
                        "sku": "[parameters('OSVersion')]",
                        "version": "latest"
                    },
                    "osDisk": {
                        "name": "osdisk",
                        "vhd": {
                            "uri": "[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',concat(variables('OSDiskName'),copyIndex()),'.vhd')]"
                        },
                        "caching": "ReadWrite",
                        "createOption": "FromImage"
                    },
                    "dataDisks": [
                        {
                            "name": "datadisk1",
                            "diskSizeGB": "[variables('dataDiskSize')]",
                            "lun": 0,
                            "vhd": {
                                "Uri": "[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net/vhds/',concat(parameters('vmNamePrefix'),copyIndex()),'dataDisk1' ,'.vhd')]"
                            },
                            "caching": "None",
                            "createOption": "Empty"
                        }
                    ]
                },
                "networkProfile": {
                    "networkInterfaces": [
                        {
                            "id": "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nicName'),copyIndex()))]"
                        }
                    ]
                }
            },
            "tags": {
                "displayName": "VirtualMachine"
            },
            "type": "Microsoft.Compute/virtualMachines"
        }
    ]
}

Publishing the ARM Template

Prepare the Template Parameter File a.k.a DeploymentTemplate.param.dev.json

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "newStorageAccountName": {
            "value": "briseboiscentos"
        },
        "adminUsername": {
            "value": "briseboiscentos"
        },
        "dnsPrefixNameForPublicIP": {
            "value": "centosdns"
        },
        "virtualNetworkName": {
            "value": "centosvnet"
        },
        "vmNamePrefix": {
            "value": "briseboiscentos"
        },
        "vmSize": {
            "value": "Standard_A1"
        },
        "vmCount": {
            "value": 20
        },
        "location": {
            "value": "East US"
        }
    }
}

Then deploy the Azure Resource Manager Template and Parameters using PowerShell.

Switch-AzureMode AzureResourceManager

New-AzureResourceGroup -Name 'centosbrisebois' `
                       -Location 'eastus' `
                       -TemplateFile 'DeploymentTemplate.json' `
                       -TemplateParameterFile 'DeploymentTemplate.param.dev.json' `
                       -Force -Verbose 

# New-AzureResourceGroup VERBOSE Log

VERBOSE: 7:17:09 PM - Created resource group 'centosbrisebois' in location 'eastus'
VERBOSE: 7:17:09 PM - Template is valid.
VERBOSE: 7:17:11 PM - Create template deployment 'DeploymentTemplate'.
VERBOSE: 7:17:16 PM - Resource Microsoft.Network/virtualNetworks 'centosvnet' provisioning status is running
VERBOSE: 7:17:16 PM - Resource Microsoft.Storage/storageAccounts 'briseboiscentos' provisioning status is running
VERBOSE: 7:17:21 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns16' provisioning status is running
VERBOSE: 7:17:21 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns17' provisioning status is running
VERBOSE: 7:17:21 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns9' provisioning status is running
VERBOSE: 7:17:21 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns6' provisioning status is running
VERBOSE: 7:17:21 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns1' provisioning status is running
VERBOSE: 7:17:21 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns0' provisioning status is running
VERBOSE: 7:17:21 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns14' provisioning status is running
VERBOSE: 7:17:21 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns5' provisioning status is running
VERBOSE: 7:17:21 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns2' provisioning status is running
VERBOSE: 7:17:21 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns12' provisioning status is running
VERBOSE: 7:17:24 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns15' provisioning status is running
VERBOSE: 7:17:24 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns11' provisioning status is running
VERBOSE: 7:17:24 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns18' provisioning status is running
VERBOSE: 7:17:24 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns19' provisioning status is running
VERBOSE: 7:17:24 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns8' provisioning status is running
VERBOSE: 7:17:24 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns3' provisioning status is running
VERBOSE: 7:17:24 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns10' provisioning status is running
VERBOSE: 7:17:24 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns7' provisioning status is running
VERBOSE: 7:17:24 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns13' provisioning status is running
VERBOSE: 7:17:24 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns4' provisioning status is running
VERBOSE: 7:17:28 PM - Resource Microsoft.Network/virtualNetworks 'centosvnet' provisioning status is succeeded
VERBOSE: 7:17:33 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns15' provisioning status is succeeded
VERBOSE: 7:17:33 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns7' provisioning status is succeeded
VERBOSE: 7:17:33 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns4' provisioning status is succeeded
VERBOSE: 7:17:33 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns16' provisioning status is succeeded
VERBOSE: 7:17:33 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns1' provisioning status is succeeded
VERBOSE: 7:17:33 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns14' provisioning status is succeeded
VERBOSE: 7:17:33 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns5' provisioning status is succeeded
VERBOSE: 7:17:33 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns2' provisioning status is succeeded
VERBOSE: 7:17:33 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns12' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/networkInterfaces 'NIC14' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/networkInterfaces 'NIC18' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/networkInterfaces 'NIC9' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/networkInterfaces 'NIC8' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/networkInterfaces 'NIC4' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/networkInterfaces 'NIC13' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/networkInterfaces 'NIC12' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/networkInterfaces 'NIC15' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/networkInterfaces 'NIC5' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/networkInterfaces 'NIC1' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/networkInterfaces 'NIC7' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/networkInterfaces 'NIC16' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/networkInterfaces 'NIC2' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns18' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns19' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns8' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns10' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns13' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns9' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns6' provisioning status is succeeded
VERBOSE: 7:17:36 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns0' provisioning status is succeeded
VERBOSE: 7:17:38 PM - Resource Microsoft.Network/networkInterfaces 'NIC10' provisioning status is succeeded
VERBOSE: 7:17:38 PM - Resource Microsoft.Network/networkInterfaces 'NIC19' provisioning status is succeeded
VERBOSE: 7:17:43 PM - Resource Microsoft.Storage/storageAccounts 'briseboiscentos' provisioning status is succeeded
VERBOSE: 7:17:46 PM - Resource Microsoft.Network/networkInterfaces 'NIC0' provisioning status is succeeded
VERBOSE: 7:17:46 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos10' provisioning status is running
VERBOSE: 7:17:46 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos1' provisioning status is running
VERBOSE: 7:17:46 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos19' provisioning status is running
VERBOSE: 7:17:46 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos2' provisioning status is running
VERBOSE: 7:17:46 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos12' provisioning status is running
VERBOSE: 7:17:46 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos7' provisioning status is running
VERBOSE: 7:17:46 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos16' provisioning status is running
VERBOSE: 7:17:48 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos6' provisioning status is running
VERBOSE: 7:17:48 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos0' provisioning status is running
VERBOSE: 7:17:48 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos15' provisioning status is running
VERBOSE: 7:17:48 PM - Resource Microsoft.Network/networkInterfaces 'NIC6' provisioning status is succeeded
VERBOSE: 7:17:55 PM - Resource Microsoft.Network/networkInterfaces 'NIC11' provisioning status is succeeded
VERBOSE: 7:17:55 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns11' provisioning status is succeeded
VERBOSE: 7:18:03 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos11' provisioning status is running
VERBOSE: 7:18:05 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos4' provisioning status is running
VERBOSE: 7:18:05 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos14' provisioning status is running
VERBOSE: 7:18:08 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos13' provisioning status is running
VERBOSE: 7:18:08 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos18' provisioning status is running
VERBOSE: 7:18:08 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos9' provisioning status is running
VERBOSE: 7:18:08 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos8' provisioning status is running
VERBOSE: 7:18:10 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos5' provisioning status is running
VERBOSE: 7:18:13 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns17' provisioning status is succeeded
VERBOSE: 7:18:15 PM - Resource Microsoft.Network/networkInterfaces 'NIC3' provisioning status is succeeded
VERBOSE: 7:18:15 PM - Resource Microsoft.Network/networkInterfaces 'NIC17' provisioning status is succeeded
VERBOSE: 7:18:15 PM - Resource Microsoft.Network/publicIPAddresses 'centosdns3' provisioning status is succeeded
VERBOSE: 7:18:18 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos17' provisioning status is running
VERBOSE: 7:18:18 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos3' provisioning status is running
VERBOSE: 7:19:39 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos12' provisioning status is succeeded
VERBOSE: 7:19:44 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos6' provisioning status is succeeded
VERBOSE: 7:19:47 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos0' provisioning status is succeeded
VERBOSE: 7:19:54 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos19' provisioning status is succeeded
VERBOSE: 7:19:54 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos16' provisioning status is succeeded
VERBOSE: 7:19:57 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos10' provisioning status is succeeded
VERBOSE: 7:19:57 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos2' provisioning status is succeeded
VERBOSE: 7:19:59 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos8' provisioning status is succeeded
VERBOSE: 7:20:02 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos5' provisioning status is succeeded
VERBOSE: 7:20:12 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos15' provisioning status is succeeded
VERBOSE: 7:20:12 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos7' provisioning status is succeeded
VERBOSE: 7:20:14 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos14' provisioning status is succeeded
VERBOSE: 7:20:17 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos13' provisioning status is succeeded
VERBOSE: 7:20:17 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos18' provisioning status is succeeded
VERBOSE: 7:20:17 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos9' provisioning status is succeeded
VERBOSE: 7:20:17 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos4' provisioning status is succeeded
VERBOSE: 7:20:17 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos11' provisioning status is succeeded
VERBOSE: 7:20:29 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos17' provisioning status is succeeded
VERBOSE: 7:21:04 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos3' provisioning status is succeeded
VERBOSE: 7:21:19 PM - Resource Microsoft.Compute/virtualMachines 'briseboiscentos1' provisioning status is succeeded

Voila! 4 minutes later, we are now ready to start working with our 20 new CentOS Virtual Machines.

Additional Thoughts

In some circumstances, using a copy index (0,1,2,3…) to name resources isn’t practical. When this is the case, it is possible to use the copy index to read from an array of values. In the following example, we are creating three Azure Storage Accounts using by concatenating elements from an array of names.

{
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "storageAccountNames": {
            "type": "array",
            "defaultValue": [
                "archive",
                "data",
                "vhds"
            ]
        },
        "count": {
            "type": "int",
            "defaultValue": 3
        }
    },
    "resources": [
        {
           "type": "Microsoft.Storage/storageAccounts",
            "name": "[concat('brisebois',parameters('storageAccountNames')[copyIndex()])]",
            "apiVersion": "2015-05-01-preview",
            "location": "[resourceGroup().location]",
            "tags": {
                "displayName": "[concat('brisebois',parameters('storageAccountNames')[copyIndex()])]"
            },
            "properties": {
                "accountType": "Standard_LRS"
            },
            "copy": {
                "name": "storageAccountCopy",
                "count": "[parameters('count')]"
            }
        }
    ]
}

ARM Resources

3 responses to Use the Azure Resource Manager Copy Operation to Deploy Duplicates

  1. 

    how can I clone a vm on azure using c#? any ideas?

    Like

  2. 

    Hi Alexandre Brisebois,

     The template is solved my use case. I wanna to expose the IPAddress of the each machine in the output sections. I tried to use copyIndex functions in the output sections and got a json deserialize error after had a look around the ARM templates forum but unfortunately, I didn't find any solutions. Could you please guide me to overcome the blockers?
    

    Like

Trackbacks and Pingbacks:

  1. Create Multi-Geo Environments using Azure Resource Manager « Alexandre Brisebois ☁ - June 3, 2015

    […] I was playing around with the Azure Resource Manager Copy Operation, I started thinking about what I could do with it. The first wild idea that popped into my head […]

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.