您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

从经典部署模型迁移到 Azure 资源管理器部署模型的过程中出现的常见错误Common errors during Classic to Azure Resource Manager migration

本文编录了从 Azure 经典部署模型将 IaaS 资源迁移到 Azure 资源管理器堆栈的过程中出现的最常见错误和缓解措施。This article catalogs the most common errors and mitigations during the migration of IaaS resources from Azure classic deployment model to the Azure Resource Manager stack.

错误列表List of errors

错误字符串Error string 缓解措施Mitigation
内部服务器错误Internal server error 在某些情况下,这是重试时会消失的暂时性错误。In some cases, this is a transient error that goes away with a retry. 如果该错误仍然存在,请联系 Azure 支持人员,因为它需要调查平台日志。If it continues to persist, contact Azure support as it needs investigation of platform logs.

注意: 支持团队跟踪事件后,请不要尝试任何自我缓解措施,因为这可能会对环境造成意想不到的后果。NOTE: Once the incident is tracked by the support team, please do not attempt any self-mitigation as this might have unintended consequences on your environment.
HostedService {hosted-service-name} 中的部署 {deployment-name} 不支持迁移,因为它是 PaaS 部署(Web/辅助角色)。Migration is not supported for Deployment {deployment-name} in HostedService {hosted-service-name} because it is a PaaS deployment (Web/Worker). 当部署包含 Web/辅助角色时,会发生这种情况。This happens when a deployment contains a web/worker role. 由于只有虚拟机才支持迁移,请从部署中删除 Web/辅助角色,并重试迁移。Since migration is only supported for Virtual Machines, please remove the web/worker role from the deployment and try migration again.
模板 {template-name} 部署失败。Template {template-name} deployment failed. CorrelationId={guid}CorrelationId={guid} 在迁移服务的后端,我们将使用 Azure 资源管理器模板在 Azure 资源管理器堆栈中创建资源。In the backend of migration service, we use Azure Resource Manager templates to create resources in the Azure Resource Manager stack. 由于模板是幂等的,通常可以安全地重试迁移操作,以通过此错误。Since templates are idempotent, usually you can safely retry the migration operation to get past this error. 如果此错误仍然存在,请联系 Azure 支持人员,并向他们提供 CorrelationId。If this error continues to persist, please contact Azure support and give them the CorrelationId.

注意: 支持团队跟踪事件后,请不要尝试任何自我缓解措施,因为这可能会对环境造成意想不到的后果。NOTE: Once the incident is tracked by the support team, please do not attempt any self-mitigation as this might have unintended consequences on your environment.
虚拟网络 {virtual-network-name} 不存在。The virtual network {virtual-network-name} does not exist. 如果在新的 Azure 门户中创建虚拟网络,则可能会发生这种情况。This can happen if you created the Virtual Network in the new Azure portal. 实际的虚拟网络名称遵循模式“Group * The actual Virtual Network name follows the pattern "Group * "
托管服务 {hosted-service-name} 中的 VM {vm-name} 包含 Azure 资源管理器不支持的扩展 {extension-name}。VM {vm-name} in HostedService {hosted-service-name} contains Extension {extension-name} which is not supported in Azure Resource Manager. 建议从 VM 中卸载该扩展,再继续迁移。It is recommended to uninstall it from the VM before continuing with migration. Azure 资源管理器不支持 XML 扩展,如 BGInfo 1.*。XML extensions such as BGInfo 1.* are not supported in Azure Resource Manager. 因此,无法迁移这些扩展。Therefore, these extensions cannot be migrated. 如果将这些扩展保留安装在虚拟机上,则在完成迁移之前会自动将其卸载。If these extensions are left installed on the virtual machine, they are automatically uninstalled before completing the migration.
HostedService {hosted-service-name} 中的 VM {vm-name} 包含当前不支持进行迁移的扩展 VMSnapshot/VMSnapshotLinux。VM {vm-name} in HostedService {hosted-service-name} contains Extension VMSnapshot/VMSnapshotLinux, which is currently not supported for Migration. 请从 VM 中卸载它,在迁移完成后再使用 Azure 资源管理器重新添加它Uninstall it from the VM and add it back using Azure Resource Manager after the Migration is Complete 这是为 Azure 备份配置虚拟机的方案。This is the scenario where the virtual machine is configured for Azure Backup. 由于这是当前不支持的方案,请按照 https://aka.ms/vmbackupmigration 中的解决方法进行操作Since this is currently an unsupported scenario, please follow the workaround at https://aka.ms/vmbackupmigration
托管服务 {hosted-service-name} 中的 VM {vm-name} 包含未从 VM 报告其状态的扩展 {extension-name}。VM {vm-name} in HostedService {hosted-service-name} contains Extension {extension-name} whose Status is not being reported from the VM. 因此,此 VM 无法迁移。Hence, this VM cannot be migrated. 确保从此 VM 报告该扩展状态或者将该扩展从此 VM 中卸载,并重试迁移。Ensure that the Extension status is being reported or uninstall the extension from the VM and retry migration.

托管服务 {hosted-service-name} 中的 VM {vm-name} 包含报告处理程序状态: {handler-status} 的扩展 {extension-name}。VM {vm-name} in HostedService {hosted-service-name} contains Extension {extension-name} reporting Handler Status: {handler-status}. 因此,此 VM 无法迁移。Hence, the VM cannot be migrated. 确保所报告的扩展处理程序状态为 {handler-status} 或将该扩展从 VM 中卸载,并重试迁移。Ensure that the Extension handler status being reported is {handler-status} or uninstall it from the VM and retry migration.

托管服务 {hosted-service-name} 中 VM {vm-name} 的 VM 代理正在将总体代理状态报告为“未就绪”。VM Agent for VM {vm-name} in HostedService {hosted-service-name} is reporting the overall agent status as Not Ready. 因此,该 VM 无法迁移(如果它有可迁移的扩展)。Hence, the VM may not be migrated, if it has a migratable extension. 请确保 VM 代理将总体代理状态报告为“就绪”。Ensure that the VM Agent is reporting overall agent status as Ready. 请参阅 https://aka.ms/classiciaasmigrationfaqs。Refer to https://aka.ms/classiciaasmigrationfaqs.
Azure 来宾代理和 VM 扩展需要对 VM 存储帐户进行出站 Internet 访问以填充其状态。Azure guest agent & VM Extensions need outbound internet access to the VM storage account to populate their status. 状态失败的常见原因包括Common causes of status failure include
  • 阻止出站访问 Internet 的网络安全组a Network Security Group that blocks outbound access to the internet
  • 如果 VNET 有本地 DNS 服务器并且 DNS 连接已丢失If the VNET has on-prem DNS servers and DNS connectivity is lost

    如果仍然看到不支持的状态,则可以卸载该扩展以跳过此检查并继续进行迁移。If you continue to see an unsupported status, you can uninstall the extensions to skip this check and move forward with migration.
  • 托管服务 {hosted-service-name} 中的部署 {deployment-name} 不支持迁移,因为它具有多个可用性集。Migration is not supported for Deployment {deployment-name} in HostedService {hosted-service-name} because it has multiple Availability Sets. 目前,只有具有 1 个或更少可用性集的托管服务可以进行迁移。Currently, only hosted services that have 1 or less Availability sets can be migrated. 要解决此问题,请将额外的可用性集及这些可用性集中的虚拟机移到其他托管服务。To work around this problem, please move the additional Availability sets and Virtual machines in those Availability sets to a different hosted service.
    托管服务 {hosted-service-name} 中的部署 {deployment-name} 不支持迁移,因为它的 VM 不属于可用性集,即使托管服务包含一个可用性集。Migration is not supported for Deployment {deployment-name} in HostedService {hosted-service-name because it has VMs that are not part of the Availability Set even though the HostedService contains one. 这种情况的解决方法是将所有虚拟机都移到单个可用性集中,或者从托管服务的可用性集中删除所有虚拟机。The workaround for this scenario is to either move all the virtual machines into a single Availability set or remove all Virtual machines from the Availability set in the hosted service.
    存储帐户/托管服务/虚拟网络 {virtual-network-name} 正处于迁移过程中,因此不能更改Storage account/HostedService/Virtual Network {virtual-network-name} is in the process of being migrated and hence cannot be changed 对资源的“准备”迁移操作已完成并触发了对资源的更改操作时,会发生此错误。This error happens when the "Prepare" migration operation has been completed on the resource and an operation that would make a change to the resource is triggered. 由于在“准备”操作完成后锁定了管理平面,因此将阻止对资源的任何更改。Because of the lock on the management plane after "Prepare" operation, any changes to the resource are blocked. 若要解锁管理平面,可以运行“提交”迁移操作以完成迁移,或者“中止”迁移操作以回退“准备”操作。To unlock the management plane, you can run the "Commit" migration operation to complete migration or the "Abort" migration operation to roll back the "Prepare" operation.
    托管服务 {hosted-service-name} 不允许迁移,因为它的 VM {vm-name} 处于状态: RoleStateUnknown。Migration is not allowed for HostedService {hosted-service-name} because it has VM {vm-name} in State: RoleStateUnknown. 仅当 VM 处于以下状态之一时允许迁移 -“正在运行”、“已停止”、“已停止解除分配”。Migration is allowed only when the VM is in one of the following states - Running, Stopped, Stopped Deallocated. 该 VM 可能正在进行状态转换,这通常在对托管服务进行更新操作(例如,重新启动、安装扩展等)期间发生。建议等到对托管服务的更新操作完成后,再尝试迁移。The VM might be undergoing through a state transition, which usually happens when during an update operation on the HostedService such as a reboot, extension installation etc. It is recommended for the update operation to complete on the HostedService before trying migration.
    HostedService {hosted-service-name} 中的部署 {deployment-name} 包含具有数据磁盘 {data-disk-name} 的 VM {vm-name},该数据磁盘的物理 Blob 大小 {size-of-the-vhd-blob-backing-the-data-disk} 字节数不匹配 VM 数据磁盘逻辑大小 {size-of-the-data-disk-specified-in-the-vm-api} 字节数。Deployment {deployment-name} in HostedService {hosted-service-name} contains a VM {vm-name} with Data Disk {data-disk-name} whose physical blob size {size-of-the-vhd-blob-backing-the-data-disk} bytes does not match the VM Data Disk logical size {size-of-the-data-disk-specified-in-the-vm-api} bytes. 迁移将继续进行而不会指定 Azure 资源管理器 VM 的数据磁盘的大小。Migration will proceed without specifying a size for the data disk for the Azure Resource Manager VM. 如果已调整 VHD Blob 的大小,而没有更新 VM API 模型中的大小,将发生此错误。This error happens if you've resized the VHD blob without updating the size in the VM API model. 缓解措施的步骤详见下文Detailed mitigation steps are outlined below.
    在云服务 {云服务名称} 中使用媒体链接 {数据磁盘 URI} 为 VM {VM 名称} 验证数据磁盘 {数据磁盘名称} 时发生存储异常。A storage exception occurred while validating data disk {data disk name} with media link {data disk Uri} for VM {VM name} in Cloud Service {Cloud Service name}. 请确保该虚拟机可以访问 VHD 媒体链接Please ensure that the VHD media link is accessible for this virtual machine 如果 VM 的磁盘已被删除或不再可访问,则可能发生此错误。This error can happen if the disks of the VM have been deleted or are not accessible anymore. 请确保 VM 磁盘存在。Please make sure the disks for the VM exist.
    HostedService {cloud-service-name} 中的 VM {vm-name} 包含具有 blob 名称为 {vhd-blob-name} 的 MediaLink {vhd-uri} 的磁盘,这在 Azure 资源管理器中不受支持。VM {vm-name} in HostedService {cloud-service-name} contains Disk with MediaLink {vhd-uri} which has blob name {vhd-blob-name} that is not supported in Azure Resource Manager. 当 Blob 的名称包含“/”(这当前在计算资源提供程序中不支持)时,将出现此错误。This error occurs when the name of the blob has a "/" in it which is not supported in Compute Resource Provider currently.
    HostedService {cloud-service-name} 中的部署 {deployment-name} 不允许迁移,因为不在区域范围内。Migration is not allowed for Deployment {deployment-name} in HostedService {cloud-service-name} as it is not in the regional scope. 请参阅 http://aka.ms/regionalscope,了解如何将该部署移至区域范围。Please refer to http://aka.ms/regionalscope for moving this deployment to regional scope. 在 2014 年,Azure 宣布:网络资源将从群集级别范围移至区域范围。In 2014, Azure announced that networking resources will move from a cluster level scope to regional scope. 有关详细信息,请参阅 http://aka.ms/regionalscopeSee [http://aka.ms/regionalscope] for more details (http://aka.ms/regionalscope). 当要迁移的部署尚未进行更新操作(自动将其移至区域范围)时,会发生此错误。This error happens when the deployment being migrated has not had an update operation, which automatically moves it to a regional scope. 最好的解决办法是向 VM 添加终结点,或者向 VM 添加数据磁盘,并重试迁移。Best workaround is to either add an endpoint to a VM or a data disk to the VM and then retry migration.
    请参阅如何在 Azure 中的经典 Windows 虚拟机上设置终结点将数据磁盘附加到使用经典部署模型创建的 Windows 虚拟机See How to set up endpoints on a classic Windows virtual machine in Azure or Attach a data disk to a Windows virtual machine created with the classic deployment model
    虚拟网络 {vnet-name} 不支持迁移,因为它具有非网关 PaaS 部署。Migration is not supported for Virtual Network {vnet-name} because it has non-gateway PaaS deployments. 当具有非网关 PaaS 部署(例如连接到虚拟网络的应用程序网关或 API 管理服务)时,将发生此错误。This error occurs when you have non-gateway PaaS deployments such as Application Gateway or API Management services that are connected to the Virtual Network.

    详细的缓解措施Detailed mitigations

    其数据磁盘的物理 Blob 大小字节数不匹配 VM 数据磁盘逻辑大小字节数的 VM。VM with Data Disk whose physical blob size bytes does not match the VM Data Disk logical size bytes.

    当数据磁盘的逻辑大小可以与实际的 VHD Blob 大小不同步时,将发生这种情况。This happens when the Data disk logical size can get out of sync with the actual VHD blob size. 可以使用以下命令轻松地验证是否出现这种情况:This can be easily verified using the following commands:

    验证问题Verifying the issue

    # Store the VM details in the VM object
    $vm = Get-AzureVM -ServiceName $servicename -Name $vmname
    
    # Display the data disk properties
    # NOTE the data disk LogicalDiskSizeInGB below which is 11GB. Also note the MediaLink Uri of the VHD blob as we'll use this in the next step
    $vm.VM.DataVirtualHardDisks
    
    
    HostCaching         : None
    DiskLabel           : 
    DiskName            : coreosvm-coreosvm-0-201611230636240687
    Lun                 : 0
    LogicalDiskSizeInGB : 11
    MediaLink           : https://contosostorage.blob.core.windows.net/vhds/coreosvm-dd1.vhd
    SourceMediaLink     : 
    IOType              : Standard
    ExtensionData       : 
    
    # Now get the properties of the blob backing the data disk above
    # NOTE the size of the blob is about 15 GB which is different from LogicalDiskSizeInGB above
    $blob = Get-AzureStorageblob -Blob "coreosvm-dd1.vhd" -Container vhds 
    
    $blob
    
    ICloudBlob        : Microsoft.WindowsAzure.Storage.Blob.CloudPageBlob
    BlobType          : PageBlob
    Length            : 16106127872
    ContentType       : application/octet-stream
    LastModified      : 11/23/2016 7:16:22 AM +00:00
    SnapshotTime      : 
    ContinuationToken : 
    Context           : Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext
    Name              : coreosvm-dd1.vhd
    

    缓解问题Mitigating the issue

    # Convert the blob size in bytes to GB into a variable which we'll use later
    $newSize = [int]($blob.Length / 1GB)
    
    # See the calculated size in GB
    $newSize
    
    15
    
    # Store the disk name of the data disk as we'll use this to identify the disk to be updated
    $diskName = $vm.VM.DataVirtualHardDisks[0].DiskName
    
    # Identify the LUN of the data disk to remove
    $lunToRemove = $vm.VM.DataVirtualHardDisks[0].Lun
    
    # Now remove the data disk from the VM so that the disk isn't leased by the VM and it's size can be updated
    Remove-AzureDataDisk -LUN $lunToRemove -VM $vm | Update-AzureVm -Name $vmname -ServiceName $servicename
    
    OperationDescription OperationId                          OperationStatus
    -------------------- -----------                          ---------------
    Update-AzureVM       213xx1-b44b-1v6n-23gg-591f2a13cd16   Succeeded  
    
    # Verify we have the right disk that's going to be updated
    Get-AzureDisk -DiskName $diskName
    
    AffinityGroup        : 
    AttachedTo           : 
    IsCorrupted          : False
    Label                : 
    Location             : East US
    DiskSizeInGB         : 11
    MediaLink            : https://contosostorage.blob.core.windows.net/vhds/coreosvm-dd1.vhd
    DiskName             : coreosvm-coreosvm-0-201611230636240687
    SourceImageName      : 
    OS                   : 
    IOType               : Standard
    OperationDescription : Get-AzureDisk
    OperationId          : 0c56a2b7-a325-123b-7043-74c27d5a61fd
    OperationStatus      : Succeeded
    
    # Now update the disk to the new size
    Update-AzureDisk -DiskName $diskName -ResizedSizeInGB $newSize -Label $diskName
    
    OperationDescription OperationId                          OperationStatus
    -------------------- -----------                          ---------------
    Update-AzureDisk     cv134b65-1b6n-8908-abuo-ce9e395ac3e7 Succeeded 
    
    # Now verify that the "DiskSizeInGB" property of the disk matches the size of the blob 
    Get-AzureDisk -DiskName $diskName
    
    
    AffinityGroup        : 
    AttachedTo           : 
    IsCorrupted          : False
    Label                : coreosvm-coreosvm-0-201611230636240687
    Location             : East US
    DiskSizeInGB         : 15
    MediaLink            : https://contosostorage.blob.core.windows.net/vhds/coreosvm-dd1.vhd
    DiskName             : coreosvm-coreosvm-0-201611230636240687
    SourceImageName      : 
    OS                   : 
    IOType               : Standard
    OperationDescription : Get-AzureDisk
    OperationId          : 1v53bde5-cv56-5621-9078-16b9c8a0bad2
    OperationStatus      : Succeeded
    
    # Now we'll add the disk back to the VM as a data disk. First we need to get an updated VM object
    $vm = Get-AzureVM -ServiceName $servicename -Name $vmname
    
    Add-AzureDataDisk -Import -DiskName $diskName -LUN 0 -VM $vm -HostCaching ReadWrite | Update-AzureVm -Name $vmname -ServiceName $servicename
    
    OperationDescription OperationId                          OperationStatus
    -------------------- -----------                          ---------------
    Update-AzureVM       b0ad3d4c-4v68-45vb-xxc1-134fd010d0f8 Succeeded      
    

    完成迁移后,将 VM 移动到其他订阅中Moving a VM to a different subscription after completing migration

    完成迁移过程后,建议将 VM 移动到另一个订阅中。After you complete the migration process, you may want to move the VM to another subscription. 但是,如果在引用 Key Vault 资源的 VM 上有密钥/证书,则当前不支持移动。However, if you have a secret/certificate on the VM that references a Key Vault resource, the move is currently not supported. 可按照以下说明解决此问题。The below instructions will allow you to workaround the issue.

    PowerShellPowerShell

    $vm = Get-AzureRmVM -ResourceGroupName "MyRG" -Name "MyVM"
    Remove-AzureRmVMSecret -VM $vm
    Update-AzureRmVM -ResourceGroupName "MyRG" -VM $vm
    

    Azure CLIAzure CLI

    az vm update -g "myrg" -n "myvm" --set osProfile.Secrets=[]
    

    后续步骤Next steps