首页 > 解决方案 > 在多个区域的 Azure 中部署的优化方式?

问题描述

我正在多个区域的 Azure 中从 VHD 部署虚拟机。对于每个区域,我都在创建新的资源组和存储帐户,尽管用于创建图像的 VHD 文件是相同的。是否有任何优化方式来使用 Azure 中的资源?我可以在一个存储帐户中使用 blob 来在其他区域进行部署吗?

标签: azuredeploymentstorageregion

解决方案


您可以使用多种方式在 azure 中自动部署。arm 模板可能是最好的模板。对于未管理的磁盘,老实说,我不确定您是否可以使用 blob 的 arm 模板创建这些磁盘,但是您可以使用现有 blob 的非托管磁盘创建 vm:

{
    "apiVersion": "2015-06-15",
    "type": "Microsoft.Compute/virtualMachines",
    "name": "[variables('vmName')]",
    "location": "[resourceGroup().location]",
    "dependsOn": [
    "[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
    "[resourceId('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
    ],
    "properties": {
        "hardwareProfile": {...},
        "osProfile": {...},
        "storageProfile": {
            "imageReference": {
                "publisher": "MicrosoftWindowsServer",
                "offer": "WindowsServer",
                "sku": "[parameters('windowsOSVersion')]",
                "version": "latest"
            },
            "osDisk": {
                "name": "osdisk",
                "vhd": {
                    "uri": "[concat(reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob, 'vhds/osdisk.vhd')]"
                },
                "caching": "ReadWrite",
                "createOption": "FromImage"
            },
            "dataDisks": [
                {
                    "name": "datadisk1",
                    "diskSizeGB": 1023,
                    "lun": 0,
                    "vhd": {
                        "uri": "[concat(reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob, 'vhds/datadisk1.vhd')]"
                    },
                    "createOption": "Empty"
                }
            ]
        },
        "networkProfile": {...},
        "diagnosticsProfile": {...}
    }
}

但我很确定,如果您想要托管磁盘并且可以从 blob uri 创建,则首先需要创建托管映像,但它们必须位于同一区域(映像和 blob)中。

阅读:https ://docs.microsoft.com/en-us/azure/virtual-machines/windows/using-managed-disks-template-deployments


推荐阅读