gpt4 book ai didi

用于创建在多个存储帐户中具有磁盘的虚拟机的 Azure 模板

转载 作者:行者123 更新时间:2023-12-03 03:10:16 25 4
gpt4 key购买 nike

我需要创建具有多个存储帐户的虚拟机来安装多个磁盘。因为在使用当前模板时,由于系统大小与单个存储帐户绑定(bind),因此系统大小存在实际限制。存储帐户的带宽限制为 5GB/s。

如果有人知道如何做或指针将会非常有帮助。TIA

最佳答案

我还没有测试,但下面的长模板配方是基于Azure quickstart template "Create a Virtual Machine from a Windows Image with 4 Empty Data Disks" .

{
"$schema" : "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion" : "1.0.0.0",
"parameters" : {
"dnsLabelPrefix" : {
"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" : "Username for the Virtual Machine."
}
},
"adminPassword" : {
"type" : "securestring",
"metadata" : {
"description" : "Password for the Virtual Machine."
}
},
"vmSize" : {
"type" : "string",
"metadata" : {
"description" : "Size of VM"
}
},
"sizeOfEachDataDiskInGB" : {
"type" : "string",
"metadata" : {
"description" : "Size of each data disk in GB"
}
}
},
"variables" : {
"storageAccountName" : "[concat(uniquestring(resourceGroup().id), 'saddiskvm')]",
"storageAccountNameDisk1" : "[concat(uniquestring(resourceGroup().id), 'saddiskvm1')]",
"storageAccountNameDisk2" : "[concat(uniquestring(resourceGroup().id), 'saddiskvm2')]",
"storageAccountNameDisk3" : "[concat(uniquestring(resourceGroup().id), 'saddiskvm3')]",
"storageAccountNameDisk4" : "[concat(uniquestring(resourceGroup().id), 'saddiskvm4')]",
"addressPrefix" : "10.0.0.0/16",
"subnet1Name" : "Subnet-1",
"subnet1Prefix" : "10.0.0.0/24",
"vmStorageAccountContainerName" : "vhds",
"imagePublisher" : "MicrosoftWindowsServer",
"imageOffer" : "WindowsServer",
"imageSKU" : "2012-Datacenter",
"imageVersion" : "latest",
"publicIPAddressName" : "myPublicIP",
"publicIPAddressType" : "Dynamic",
"storageAccountType" : "Standard_LRS",
"virtualNetworkName" : "myVNET",
"vmName" : "myVM",
"vnetID" : "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
"nicName" : "myNIC",
"subnet1Ref" : "[concat(variables('vnetID'),'/subnets/',variables('subnet1Name'))]",
"apiVersion" : "2015-06-15"
},
"resources" : [{
"type" : "Microsoft.Storage/storageAccounts",
"name" : "[variables('storageAccountName')]",
"apiVersion" : "[variables('apiVersion')]",
"location" : "[resourceGroup().location]",
"properties" : {
"accountType" : "[variables('storageAccountType')]"
}
},{
"type" : "Microsoft.Storage/storageAccounts",
"name" : "[variables('storageAccountNameDisk1')]",
"apiVersion" : "[variables('apiVersion')]",
"location" : "[resourceGroup().location]",
"properties" : {
"accountType" : "[variables('storageAccountType')]"
}
},{
"type" : "Microsoft.Storage/storageAccounts",
"name" : "[variables('storageAccountNameDisk2')]",
"apiVersion" : "[variables('apiVersion')]",
"location" : "[resourceGroup().location]",
"properties" : {
"accountType" : "[variables('storageAccountType')]"
}
},{
"type" : "Microsoft.Storage/storageAccounts",
"name" : "[variables('storageAccountNameDisk3')]",
"apiVersion" : "[variables('apiVersion')]",
"location" : "[resourceGroup().location]",
"properties" : {
"accountType" : "[variables('storageAccountType')]"
}
},{
"type" : "Microsoft.Storage/storageAccounts",
"name" : "[variables('storageAccountNameDisk4')]",
"apiVersion" : "[variables('apiVersion')]",
"location" : "[resourceGroup().location]",
"properties" : {
"accountType" : "[variables('storageAccountType')]"
}
}, {
"apiVersion" : "[variables('apiVersion')]",
"type" : "Microsoft.Network/publicIPAddresses",
"name" : "[variables('publicIPAddressName')]",
"location" : "[resourceGroup().location]",
"properties" : {
"publicIPAllocationMethod" : "[variables('publicIPAddressType')]",
"dnsSettings" : {
"domainNameLabel" : "[parameters('dnsLabelPrefix')]"
}
}
}, {
"apiVersion" : "[variables('apiVersion')]",
"type" : "Microsoft.Network/virtualNetworks",
"name" : "[variables('virtualNetworkName')]",
"location" : "[resourceGroup().location]",
"properties" : {
"addressSpace" : {
"addressPrefixes" : [
"[variables('addressPrefix')]"
]
},
"subnets" : [{
"name" : "[variables('subnet1Name')]",
"properties" : {
"addressPrefix" : "[variables('subnet1Prefix')]"
}
}
]
}
}, {
"apiVersion" : "[variables('apiVersion')]",
"type" : "Microsoft.Network/networkInterfaces",
"name" : "[variables('nicName')]",
"location" : "[resourceGroup().location]",
"dependsOn" : [
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
],
"properties" : {
"ipConfigurations" : [{
"name" : "ipconfig1",
"properties" : {
"privateIPAllocationMethod" : "Dynamic",
"publicIPAddress" : {
"id" : "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
},
"subnet" : {
"id" : "[variables('subnet1Ref')]"
}
}
}
]
}
}, {
"apiVersion" : "2015-06-15",
"type" : "Microsoft.Compute/virtualMachines",
"name" : "[variables('vmName')]",
"location" : "[resourceGroup().location]",
"dependsOn" : [
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
],
"properties" : {
"hardwareProfile" : {
"vmSize" : "[parameters('vmSize')]"
},
"osProfile" : {
"computerName" : "[variables('vmName')]",
"adminUsername" : "[parameters('adminUsername')]",
"adminPassword" : "[parameters('adminPassword')]"
},
"storageProfile" : {
"imageReference" : {
"publisher" : "[variables('imagePublisher')]",
"offer" : "[variables('imageOffer')]",
"sku" : "[variables('imageSKU')]",
"version" : "[variables('imageVersion')]"
},
"dataDisks" : [{
"name" : "datadisk1",
"diskSizeGB" : "[parameters('sizeOfEachDataDiskInGB')]",
"lun" : 0,
"vhd" : {
"uri" : "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountNameDisk1')), variables('apiVersion')).primaryEndpoints.blob, variables('vmStorageAccountContainerName'),'/',variables('vmName'),'dataDisk1.vhd')]"
},
"createOption" : "Empty"
}, {
"name" : "datadisk2",
"diskSizeGB" : "[parameters('sizeOfEachDataDiskInGB')]",
"lun" : 1,
"vhd" : {
"uri" : "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountNameDisk2')), variables('apiVersion')).primaryEndpoints.blob, variables('vmStorageAccountContainerName'),'/',variables('vmName'),'dataDisk2.vhd')]"
},
"createOption" : "Empty"
}, {
"name" : "datadisk3",
"diskSizeGB" : "[parameters('sizeOfEachDataDiskInGB')]",
"lun" : 2,
"vhd" : {
"uri" : "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountNameDisk3')), variables('apiVersion')).primaryEndpoints.blob, variables('vmStorageAccountContainerName'),'/',variables('vmName'),'dataDisk3.vhd')]"
},
"createOption" : "Empty"
}, {
"name" : "datadisk4",
"diskSizeGB" : "[parameters('sizeOfEachDataDiskInGB')]",
"lun" : 3,
"vhd" : {
"uri" : "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountNameDisk4')), variables('apiVersion')).primaryEndpoints.blob, variables('vmStorageAccountContainerName'),'/',variables('vmName'),'dataDisk4.vhd')]"
},
"createOption" : "Empty"
}
],
"osDisk" : {
"name" : "osdisk1",
"vhd" : {
"uri" : "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), variables('apiVersion')).primaryEndpoints.blob, variables('vmStorageAccountContainerName'),'/','osDisk1.vhd')]"
},
"caching" : "ReadWrite",
"createOption" : "FromImage"
}
},
"networkProfile" : {
"networkInterfaces" : [{
"id" : "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
}
]
},
"diagnosticsProfile" : {
"bootDiagnostics" : {
"enabled" : "true",
"storageUri" : "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), variables('apiVersion')).primaryEndpoints.blob)]"
}
}
}
}
]
}

在原始模板中,我将 "variables" storageAccountNameDisk1 添加到 storageAccountNameDisk4,将它们放入 "resources" > 用于创建“dataDisk”,并将其从单个存储帐户修改为多个存储帐户。

*提示:以下描述的是在Azure Portal中添加磁盘。

您可以轻松地在门户中将磁盘添加到虚拟机。磁盘可以放置在不同的存储帐户中。

请从左到右查看每个 Blade 中的红色复选标记。

enter image description here

关于用于创建在多个存储帐户中具有磁盘的虚拟机的 Azure 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39328005/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com