Я пытаюсь развернуть шаблон Ubuntu в Azure. Я создал шаблон с существующей машины, на которой ничего не установлено. Вот конфигурация:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualMachines_StagingPortalWebServerNE_adminPassword": {
"defaultValue": null,
"type": "SecureString"
},
"virtualMachines_StagingPortalWebServerNE_name": {
"defaultValue": "StagingPortalWebServerNE",
"type": "String"
},
"networkInterfaces_stagingportalwebserv634_name": {
"defaultValue": "stagingportalwebserv634",
"type": "String"
},
"networkSecurityGroups_StagingPortalWebServerNE_name": {
"defaultValue": "StagingPortalWebServerNE",
"type": "String"
},
"publicIPAddresses_StagingPortalWebServerNE_name": {
"defaultValue": "StagingPortalWebServerNE",
"type": "String"
},
"virtualNetworks_StagingPortalWebServerNEResourceGroup_name": {
"defaultValue": "StagingPortalWebServerNEResourceGroup",
"type": "String"
},
"storageAccounts_stagingportalwebserv2173_name": {
"defaultValue": "stagingportalwebserv2173",
"type": "String"
}
},
"variables": {},
"resources": [
{
"comments": "Generalized from resource: '/subscriptions/d897fa29-7454-411b-9709-d11a645bf42f/resourceGroups/StagingPortalWebServerNEResourceGroup/providers/Microsoft.Compute/virtualMachines/StagingPortalWebServerNE'.",
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('virtualMachines_StagingPortalWebServerNE_name')]",
"apiVersion": "2015-06-15",
"location": "northeurope",
"properties": {
"hardwareProfile": {
"vmSize": "Standard_A1"
},
"storageProfile": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "14.04.4-LTS",
"version": "latest"
},
"osDisk": {
"name": "[parameters('virtualMachines_StagingPortalWebServerNE_name')]",
"createOption": "FromImage",
"vhd": {
"uri": "[concat('https', '://', parameters('storageAccounts_stagingportalwebserv2173_name'), '.blob.core.windows.net', concat('/vhds/', parameters('virtualMachines_StagingPortalWebServerNE_name'),'201653123853.vhd'))]"
},
"caching": "ReadWrite"
},
"dataDisks": []
},
"osProfile": {
"computerName": "[parameters('virtualMachines_StagingPortalWebServerNE_name')]",
"adminUsername": "spotscale",
"linuxConfiguration": {
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"path": "/path/to/key",
"keyData": "ssh-rsa sshkey"
}
]
}
},
"secrets": [],
"adminPassword": "[parameters('virtualMachines_StagingPortalWebServerNE_adminPassword')]"
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaces_stagingportalwebserv634_name'))]"
}
]
}
},
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_stagingportalwebserv2173_name'))]",
"[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaces_stagingportalwebserv634_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/d897fa29-7454-411b-9709-d11a645bf42f/resourceGroups/StagingPortalWebServerNEResourceGroup/providers/Microsoft.Network/networkInterfaces/stagingportalwebserv634'.",
"type": "Microsoft.Network/networkInterfaces",
"name": "[parameters('networkInterfaces_stagingportalwebserv634_name')]",
"apiVersion": "2015-06-15",
"location": "northeurope",
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAddress": "10.5.0.4",
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddresses_StagingPortalWebServerNE_name'))]"
},
"subnet": {
"id": "[concat(resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworks_StagingPortalWebServerNEResourceGroup_name')), '/subnets/default')]"
}
}
}
],
"dnsSettings": {
"dnsServers": []
},
"enableIPForwarding": false,
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroups_StagingPortalWebServerNE_name'))]"
}
},
"dependsOn": [
"[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddresses_StagingPortalWebServerNE_name'))]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworks_StagingPortalWebServerNEResourceGroup_name'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroups_StagingPortalWebServerNE_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/d897fa29-7454-411b-9709-d11a645bf42f/resourceGroups/StagingPortalWebServerNEResourceGroup/providers/Microsoft.Network/networkSecurityGroups/StagingPortalWebServerNE'.",
"type": "Microsoft.Network/networkSecurityGroups",
"name": "[parameters('networkSecurityGroups_StagingPortalWebServerNE_name')]",
"apiVersion": "2015-06-15",
"location": "northeurope",
"properties": {
"securityRules": [
{
"name": "default-allow-ssh",
"properties": {
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "22",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 1000,
"direction": "Inbound"
}
},
{
"name": "allow-internet",
"properties": {
"protocol": "*",
"sourcePortRange": "*",
"destinationPortRange": "80",
"sourceAddressPrefix": "Internet",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 1010,
"direction": "Inbound"
}
}
]
},
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/d897fa29-7454-411b-9709-d11a645bf42f/resourceGroups/StagingPortalWebServerNEResourceGroup/providers/Microsoft.Network/publicIPAddresses/StagingPortalWebServerNE'.",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[parameters('publicIPAddresses_StagingPortalWebServerNE_name')]",
"apiVersion": "2015-06-15",
"location": "northeurope",
"properties": {
"publicIPAllocationMethod": "Static",
"idleTimeoutInMinutes": 4
},
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/d897fa29-7454-411b-9709-d11a645bf42f/resourceGroups/StagingPortalWebServerNEResourceGroup/providers/Microsoft.Network/virtualNetworks/StagingPortalWebServerNEResourceGroup'.",
"type": "Microsoft.Network/virtualNetworks",
"name": "[parameters('virtualNetworks_StagingPortalWebServerNEResourceGroup_name')]",
"apiVersion": "2015-06-15",
"location": "northeurope",
"properties": {
"addressSpace": {
"addressPrefixes": [
"10.5.0.0/16"
]
},
"subnets": [
{
"name": "default",
"properties": {
"addressPrefix": "10.5.0.0/24"
}
}
]
},
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/d897fa29-7454-411b-9709-d11a645bf42f/resourceGroups/stagingportalwebserverneresourcegroup/providers/Microsoft.Storage/storageAccounts/stagingportalwebserv2173'.",
"type": "Microsoft.Storage/storageAccounts",
"name": "[parameters('storageAccounts_stagingportalwebserv2173_name')]",
"apiVersion": "2015-06-15",
"location": "northeurope",
"tags": {},
"properties": {
"accountType": "Standard_LRS"
},
"dependsOn": []
}
]
}
При развертывании шаблона я получаю следующую ошибку:
{
"status": "Failed",
"error": {
"code": "ResourceDeploymentFailure",
"message": "The resource operation completed with terminal provisioning state 'Failed'.",
"details": [
{
"code": "TargetDiskBlobAlreadyExists",
"message": "Blob https://stagingportalwebserv2173.blob.core.windows.net/vhds/StagingPortalWebServerNE201653123853.vhd already exists. Please provide a different blob URI as target for disk 'StagingPortalWebServerNE'."
}
]
}
}
Я понимаю, что это плохая идея использовать один и тот же диск для двух vms, но я не понимаю, как создать новый для этой машины. Любая помощь приветствуется.