Jun 23 2017 01:10 AM
Hi,
currently im trying to deploy an IT-infrastructure but it is not working as I want.
I want to deploy 4 VMs based on the same custom image. (No Scale Set yet)
When I deploy 1 single VM based on that image, it works, but not when I deploy 4.
I may need some help here.
Here is the template for the 4 VM deployment incl rest of the infrastructure.
Everything is working but when the VMs are being deployed I read in the terminal "Failed" :(
"resources": [ { "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "name": "[variables('networkSecurityGroupName')]", "type": "Microsoft.Network/networkSecurityGroups", "properties": { "securityRules": [ { "name": "ssh_rule", "properties": { "access": "Allow", "description": "Locks inbound down to ssh default port 22.", "destinationAddressPrefix": "*", "destinationPortRange": "22", "direction": "Inbound", "priority": 123, "protocol": "Tcp", "sourceAddressPrefix": "213.143.97.183", "sourcePortRange": "*" } } ] } }, { "apiVersion": "2015-06-15", "location": "[resourceGroup().location]", "name": "[parameters('storageAccountName')]", "type": "Microsoft.Storage/storageAccounts", "properties": { "accountType": "[variables('storageAccountType')]" } }, { "apiVersion": "2016-12-01", "location": "[resourceGroup().location]", "name": "[parameters('blobStorageAccountName')]", "type": "Microsoft.Storage/storageAccounts", "sku": { "name": "[variables('blobStorageAccountType')]" }, "kind": "BlobStorage", "properties": { "accessTier": "[variables('blobStorageAccessTier')]", "encryption": { "services": { "blob": { "enabled": "[variables('blobStorageEncryptionEnabled')]" } }, "keySource": "Microsoft.Storage" }, "supportsHttpsTrafficOnly": "[variables('blobStorageHttpsTrafficOnlyEnabled')]" } }, { "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "name": "[variables('publicIPAddressName_Node1')]", "type": "Microsoft.Network/publicIPAddresses", "properties": { "publicIPAllocationMethod": "[variables('publicIPAddressType')]", "dnsSettings": { "domainNameLabel": "[concat(parameters('dnsNameForPublicIP'), 'node1')]" } } }, { "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "name": "[variables('publicIPAddressName_Node2')]", "type": "Microsoft.Network/publicIPAddresses", "properties": { "publicIPAllocationMethod": "[variables('publicIPAddressType')]", "dnsSettings": { "domainNameLabel": "[concat(parameters('dnsNameForPublicIP'), 'node2')]" } } }, { "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "name": "[variables('publicIPAddressName_Node3')]", "type": "Microsoft.Network/publicIPAddresses", "properties": { "publicIPAllocationMethod": "[variables('publicIPAddressType')]", "dnsSettings": { "domainNameLabel": "[concat(parameters('dnsNameForPublicIP'), 'node3')]" } } }, { "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "name": "[variables('publicIPAddressName_Node4')]", "type": "Microsoft.Network/publicIPAddresses", "properties": { "publicIPAllocationMethod": "[variables('publicIPAddressType')]", "dnsSettings": { "domainNameLabel": "[concat(parameters('dnsNameForPublicIP'), 'node4')]" } } }, { "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "name": "[variables('virtualNetworkName')]", "type": "Microsoft.Network/virtualNetworks", "dependsOn": [ "[concat('Microsoft.Network/networkSecurityGroups/', variables('networkSecurityGroupName'))]" ], "properties": { "addressSpace": { "addressPrefixes": [ "[variables('addressPrefix')]" ] }, "subnets": [ { "name": "[variables('subnetName')]", "properties": { "addressPrefix": "[variables('subnetPrefix')]", "networkSecurityGroup": { "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]" } } } ] } }, { "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "name": "[concat(variables('nicName'), 'Node1')]", "type": "Microsoft.Network/networkInterfaces", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName_Node1'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" ], "properties": { "ipConfigurations": [ { "name": "ipconfig1", "properties": { "privateIPAllocationMethod": "Dynamic", "publicIPAddress": { "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName_Node1'))]" }, "subnet": { "id": "[variables('subnetRef')]" } } } ] } }, { "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "name": "[concat(variables('nicName'), 'Node2')]", "type": "Microsoft.Network/networkInterfaces", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName_Node2'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" ], "properties": { "ipConfigurations": [ { "name": "ipconfig1", "properties": { "privateIPAllocationMethod": "Dynamic", "publicIPAddress": { "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName_Node2'))]" }, "subnet": { "id": "[variables('subnetRef')]" } } } ] } }, { "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "name": "[concat(variables('nicName'), 'Node3')]", "type": "Microsoft.Network/networkInterfaces", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName_Node3'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" ], "properties": { "ipConfigurations": [ { "name": "ipconfig1", "properties": { "privateIPAllocationMethod": "Dynamic", "publicIPAddress": { "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName_Node3'))]" }, "subnet": { "id": "[variables('subnetRef')]" } } } ] } }, { "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "name": "[concat(variables('nicName'), 'Node4')]", "type": "Microsoft.Network/networkInterfaces", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName_Node4'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" ], "properties": { "ipConfigurations": [ { "name": "ipconfig1", "properties": { "privateIPAllocationMethod": "Dynamic", "publicIPAddress": { "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName_Node4'))]" }, "subnet": { "id": "[variables('subnetRef')]" } } } ] } }, { "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "name": "[concat(variables('vmName'), 'Node1')]", "type": "Microsoft.Compute/virtualMachines", "dependsOn": [ "[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]", "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), 'Node1')]" ], "properties": { "hardwareProfile": { "vmSize": "[parameters('vmSizeNode1')]" }, "osProfile": { "computerName": "[concat(variables('vmName'), 'Node1')]", "adminUsername": "[variables('adminUsername')]", "linuxConfiguration": { "disablePasswordAuthentication": "true", "ssh": { "publicKeys": [ { "path": "[concat('/home/', variables('adminUsername'), '/.ssh/authorized_keys')]", "keyData": "[parameters('adminPublicKey')]" } ] } } }, "storageProfile": { "imageReference": { "id": "/subscriptions/******/resourceGroups/***-resource-group/providers/Microsoft.Compute/images/******" }, "osDisk": { "createOption": "fromImage", "managedDisk": { "storageAccountType": "Premium_LRS" } } }, "networkProfile": { "networkInterfaces": [ { "id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('nicName'), 'Node1'))]" } ] } } }, { "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "name": "[concat(variables('vmName'), 'Node2')]", "type": "Microsoft.Compute/virtualMachines", "dependsOn": [ "[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]", "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), 'Node2')]" ], "properties": { "hardwareProfile": { "vmSize": "[parameters('vmSizeNode2')]" }, "osProfile": { "computerName": "[concat(variables('vmName'), 'Node2')]", "adminUsername": "[variables('adminUsername')]", "linuxConfiguration": { "disablePasswordAuthentication": "true", "ssh": { "publicKeys": [ { "path": "[concat('/home/', variables('adminUsername'), '/.ssh/authorized_keys')]", "keyData": "[parameters('adminPublicKey')]" } ] } } }, "storageProfile": { "imageReference": { "id": "/subscriptions/******/resourceGroups/***-resource-group/providers/Microsoft.Compute/images/******" }, "osDisk": { "createOption": "fromImage", "managedDisk": { "storageAccountType": "Premium_LRS" } } }, "networkProfile": { "networkInterfaces": [ { "id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('nicName'), 'Node2'))]" } ] } } }, { "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "name": "[concat(variables('vmName'), 'Node3')]", "type": "Microsoft.Compute/virtualMachines", "dependsOn": [ "[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]", "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), 'Node3')]" ], "properties": { "hardwareProfile": { "vmSize": "[parameters('vmSizeNode3')]" }, "osProfile": { "computerName": "[concat(variables('vmName'), 'Node3')]", "adminUsername": "[variables('adminUsername')]", "linuxConfiguration": { "disablePasswordAuthentication": "true", "ssh": { "publicKeys": [ { "path": "[concat('/home/', variables('adminUsername'), '/.ssh/authorized_keys')]", "keyData": "[parameters('adminPublicKey')]" } ] } } }, "storageProfile": { "imageReference": { "id": "/subscriptions/******/resourceGroups/***-resource-group/providers/Microsoft.Compute/images/******" }, "osDisk": { "createOption": "fromImage", "managedDisk": { "storageAccountType": "Premium_LRS" } } }, "networkProfile": { "networkInterfaces": [ { "id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('nicName'), 'Node3'))]" } ] } } }, { "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "name": "[concat(variables('vmName'), 'Node4')]", "type": "Microsoft.Compute/virtualMachines", "dependsOn": [ "[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]", "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), 'Node4')]" ], "properties": { "hardwareProfile": { "vmSize": "[parameters('vmSizeNode4')]" }, "osProfile": { "computerName": "[concat(variables('vmName'), 'Node4')]", "adminUsername": "[variables('adminUsername')]", "linuxConfiguration": { "disablePasswordAuthentication": "true", "ssh": { "publicKeys": [ { "path": "[concat('/home/', variables('adminUsername'), '/.ssh/authorized_keys')]", "keyData": "[parameters('adminPublicKey')]" } ] } } }, "storageProfile": { "imageReference": { "id": "/subscriptions/******/resourceGroups/****-resource-group/providers/Microsoft.Compute/images/******" }, "osDisk": { "createOption": "fromImage", "managedDisk": { "storageAccountType": "Premium_LRS" } } }, "networkProfile": { "networkInterfaces": [ { "id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('nicName'), 'Node4'))]" } ] } } }, { "apiVersion": "2015-04-08", "kind": "[variables('dbKind')]", "location": "northeurope", "name": "[variables('cosmosDbName')]", "type": "Microsoft.DocumentDb/databaseAccounts", "properties": { "databaseAccountOfferType": "Standard", "locations": [ { "failoverPriority": 0, "id": "[concat(variables('cosmosDbName'), '-', resourceGroup().location)]", "locationName": "North Europe" } ], "tags": { "defaultExperience": "[variables('cosmosDBExperience')]" } } } ]
Here is the resource template when I deploy only 1 VM using a custom image:
"resources": [ { "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "name": "[variables('networkSecurityGroupName')]", "type": "Microsoft.Network/networkSecurityGroups", "properties": { "securityRules": [ { "name": "ssh_rule", "properties": { "access": "Allow", "description": "Locks inbound down to ssh default port 22.", "destinationAddressPrefix": "*", "destinationPortRange": "22", "direction": "Inbound", "priority": 123, "protocol": "Tcp", "sourceAddressPrefix": "213.143.97.183", "sourcePortRange": "*" } } ] } }, { "apiVersion": "2015-06-15", "location": "[resourceGroup().location]", "name": "[parameters('storageAccountName')]", "type": "Microsoft.Storage/storageAccounts", "properties": { "accountType": "[variables('storageAccountType')]" } }, { "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "name": "[variables('publicIPAddressName_Node1')]", "type": "Microsoft.Network/publicIPAddresses", "properties": { "publicIPAllocationMethod": "[variables('publicIPAddressType')]", "dnsSettings": { "domainNameLabel": "[concat(parameters('dnsNameForPublicIP'), 'node1')]" } } }, { "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "name": "[variables('virtualNetworkName')]", "type": "Microsoft.Network/virtualNetworks", "dependsOn": [ "[concat('Microsoft.Network/networkSecurityGroups/', variables('networkSecurityGroupName'))]" ], "properties": { "addressSpace": { "addressPrefixes": [ "[variables('addressPrefix')]" ] }, "subnets": [ { "name": "[variables('subnetName')]", "properties": { "addressPrefix": "[variables('subnetPrefix')]", "networkSecurityGroup": { "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]" } } } ] } }, { "apiVersion": "2015-05-01-preview", "location": "[resourceGroup().location]", "name": "[concat(variables('nicName'), 'Node1')]", "type": "Microsoft.Network/networkInterfaces", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName_Node1'))]", "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]" ], "properties": { "ipConfigurations": [ { "name": "ipconfig1", "properties": { "privateIPAllocationMethod": "Dynamic", "publicIPAddress": { "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName_Node1'))]" }, "subnet": { "id": "[variables('subnetRef')]" } } } ] } }, { "apiVersion": "2016-04-30-preview", "location": "[resourceGroup().location]", "name": "[concat(variables('vmName'), 'Node1')]", "type": "Microsoft.Compute/virtualMachines", "dependsOn": [ "[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]", "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), 'Node1')]" ], "properties": { "hardwareProfile": { "vmSize": "[parameters('vmSizeNode1')]" }, "osProfile": { "computerName": "[concat(variables('vmName'), 'Node1')]", "adminUsername": "[variables('adminUsername')]", "linuxConfiguration": { "disablePasswordAuthentication": "true", "ssh": { "publicKeys": [ { "path": "[concat('/home/', variables('adminUsername'), '/.ssh/authorized_keys')]", "keyData": "[parameters('adminPublicKey')]" } ] } } }, "storageProfile": { "imageReference": { "id": "/subscriptions/******/resourceGroups/****-resource-group/providers/Microsoft.Compute/images/******" }, "osDisk": { "createOption": "fromImage", "managedDisk": { "storageAccountType": "Premium_LRS" } } }, "networkProfile": { "networkInterfaces": [ { "id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('nicName'), 'Node1'))]" } ] } } } ]
What am I missing? Why is the deployment of 4 VMs not working?
Thanks in advance
Jun 23 2017 02:23 PM
I my self have not attempted to deploy multiple servers using a custom image, let alone as managed disk. I am in the process of trying to recreate this in my lab, hopefully i will have some results monday.
Until then maybe someone with more experience may come along.
Perhaps you could send me the the entire template files in a private message.
Also have you considered using a loop for the deployment of the vm's ?
Jun 25 2017 11:55 PM
Loop sounds interesting. Because all the vms, except the size, will be kind of the same.
Thanks for having a look!
I try to send you the whole template in a private message.
Jun 27 2017 08:41 AM
So i managed to create a template that uses the same image source for 2 identical VM's.
They are created at the same time with out any issues.
if you select the targeted Resource Group, select activity log you should see the failed attempts and a more detailed description as to why they are failing.
you can download my template files from here, keep in mind it may not be pretty but it works and i hope you can use it to compare against your own.
Jun 27 2017 08:52 AM
Also try and use Resource ID instread of concat for you dependson.
Concat just combines the input to a single string.
ResourceID insures the subscription and resource group is added:
so this:
"[resourceId('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName1'))]"
would actualy be this:
/subscriptions/****************/resourceGroups/RG3/Microsoft.Network/networkInterfaces/<parameters('networkInterfaceName1')>
Jun 28 2017 01:29 AM
Jun 28 2017 01:29 AM