Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
119 lines (119 sloc) 3.29 KB
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"VM Size": {
"defaultValue": "Standard_DS4_v2",
"type": "string",
"allowedValues": [
"Standard_DS1_v2",
"Standard_DS2_v2",
"Standard_DS3_v2",
"Standard_DS4_v2",
"Standard_DS5_v2"
],
"metadata": {
"description": "SKU of the VM."
}
}
},
"variables": {
"NIC Name": "MyNic",
"Availability Set Name": "MyAvailSet",
"VM Name": "Demo-VM",
"disks": [
{
"oldName": "Demo-VM-OS",
"newName": "Clone-Demo-OS"
},
{
"oldName": "Demo-VM-data2",
"newName": "Clone-Demo-data2"
},
{
"oldName": "Demo-VM-data3",
"newName": "Clone-Demo-data3"
}
]
},
"resources": [
{
"comments": "Copy existing disks in order to change their names",
"apiVersion": "2017-03-30",
"copy": {
"name": "snapshot-loop",
"count": "[length(variables('disks'))]"
},
"type": "Microsoft.Compute/disks",
"name": "[variables('disks')[copyIndex()].newName]",
"location": "[resourceGroup().location]",
"sku": {
"name": "Premium_LRS"
},
"properties": {
"creationData": {
"createOption": "copy",
"sourceUri": "[resourceId('Microsoft.Compute/disks', variables('disks')[copyIndex()].oldName)]"
}
}
},
{
"type": "Microsoft.Compute/virtualMachines",
"name": "[variables('VM Name')]",
"tags": {
"displayName": "VM"
},
"apiVersion": "2016-04-30-preview",
"location": "[resourceGroup().location]",
"properties": {
"availabilitySet": {
"id": "[resourceId('Microsoft.Compute/availabilitySets', variables('Availability Set Name'))]"
},
"hardwareProfile": {
"vmSize": "[parameters('VM Size')]"
},
"storageProfile": {
"osDisk": {
"createOption": "attach",
"osType": "Linux",
"caching": "ReadWrite",
"managedDisk": {
"id": "[resourceId('Microsoft.Compute/disks', 'Clone-Demo-OS')]"
}
},
"dataDisks": [
{
"lun": 2,
"createOption": "attach",
"managedDisk": {
"id": "[resourceId('Microsoft.Compute/disks', 'Clone-Demo-data2')]"
},
"caching": "Readonly"
},
{
"lun": 3,
"createOption": "attach",
"managedDisk": {
"id": "[resourceId('Microsoft.Compute/disks', 'Clone-Demo-data3')]"
},
"caching": "Readonly"
}
]
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('NIC Name'))]"
}
]
}
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Compute/disks', 'Clone-Demo-OS')]",
"[resourceId('Microsoft.Compute/disks', 'Clone-Demo-data2')]",
"[resourceId('Microsoft.Compute/disks', 'Clone-Demo-data3')]"
]
}
]
}
You can’t perform that action at this time.