【问题标题】:Azure Resource Manager: unable to attach existing VHD when creating VM from powershell / azure preview portalAzure 资源管理器:从 powershell / azure preview 门户创建 VM 时无法附加现有 VHD
【发布时间】:2015-06-19 10:37:18
【问题描述】:

尝试将 VM 从 Azure 服务管理迁移到 Azure 资源管理器,在 ARM 下创建新的存储帐户和新的 vm 配置后,我无法根据迁移的 vhd 部署带有附加数据磁盘的 VM。

注意:部署在没有数据磁盘的情况下工作,在附加数据磁盘时失败

ResourceGroupName        : 
Id                       : 
Name                     : n1n3-dc-1506
Type                     : 
Location                 : 
Tags                     : null
AvailabilitySetReference : null
Extensions               : null
HardwareProfile          : {
                             "VirtualMachineSize": "Standard_A2"
                           }
InstanceView             : null
NetworkProfile           : {
                             "NetworkInterfaces": [
                               {
                                 "Primary": true,
                                 "ReferenceUri": "/subscriptions/b540a9de-cd22-4d3e-b302-fd57b053cc8e/resourceGroups/N1N3/providers/Microsoft.Network/networkInterfaces/n1n3-dc-1506-NIC0"
                               }
                             ]
                           }
OSProfile                : null
Plan                     : null
ProvisioningState        : 
StorageProfile           : {
                             "DataDisks": [
                               {
                                 "DiskSizeGB": 1000,
                                 "Lun": 0,
                                 "Caching": "ReadOnly",
                                 "CreateOption": "attach",
                                 "Name": "n1n3-dc-1506-data0.vhd",
                                 "SourceImage": null,
                                 "VirtualHardDisk": {
                                   "Uri": "https://n1n3dcstdlrs1506.blob.core.windows.net/vhds/n1n3-dc-1506-data0.vhd"
                                 }
                               }
                             ],
                             "ImageReference": null,
                             "OSDisk": {
                               "OperatingSystemType": "Windows",
                               "Caching": "ReadOnly",
                               "CreateOption": "attach",
                               "Name": "n1n3-dc-1506-os.vhd",
                               "SourceImage": null,
                               "VirtualHardDisk": {
                                 "Uri": "https://n1n3dcstdlrs1506.blob.core.windows.net/vhds/n1n3-dc-1506-os.vhd"
                               }
                             },
                             "SourceImage": null
                           }

部署状态

EndTime             : 19/06/2015 12:12:08 +02:00
Error               : Microsoft.Azure.Management.Compute.Models.ApiError
Output              : 
StartTime           : 19/06/2015 12:12:07 +02:00
Status              : Failed
TrackingOperationId : f00aba57-e49d-4574-813a-2dc4803e6aa8
RequestId           : 8fbfc336-05e4-47c4-a211-e2a9a5b40871
StatusCode          : OK

注意:部署虚拟机,然后尝试附加磁盘无论如何都会失败。

# Get the VM
$DC2vm = Get-AzureVM -ResourceGroupName $destResourceGroup -Name $DCvmName
# Add Data Disk 
Add-AzureVMDataDisk –VM $DC2vm –Name $($DCdstVMName + '-data0.vhd') –VhdUri $('https://'+$DCdestSTDStorageName+'.blob.core.windows.net/vhds/'+$($DCdstVMName + '-data0.vhd')) –LUN 0 –Caching ReadOnly –DiskSizeinGB 500 -CreateOption attach -Verbose
# Update VM state
Update-AzureVM -ResourceGroupName $destResourceGroup -Name $DCvmName –VM $DC2vm


Update-AzureVM : PropertyChangeNotAllowed: Changing property 'dataDisks' is not allowed.
In riga:4 car:1
+ Update-AzureVM -ResourceGroupName $destResourceGroup -Name $DCvmName –VM $DC2vm
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Update-AzureVM], CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.UpdateAzureVMCommand

有什么猜测吗? 非常感谢, 弗朗切斯科

【问题讨论】:

标签: azure


【解决方案1】:

当我在 New-AzureVM 期间使用 PowerShell 脚本附加数据磁盘时,我收到了相同的错误消息。我的问题是 DATAdisk 与 OSdisk 具有相同的 uri,因为我不小心使用了相同的变量。

您可以使用 Azure 资源管理器进行检查: https://resources.azure.com

选择你的订阅/resourceGroups//providers/Microsoft.Compute/virtualMachines/下的VM 并查看 StorageProfile。

【讨论】:

    猜你喜欢
    • 2015-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多