如何将同一 VNET 下的虚拟机从经典部署模型迁移到 Azure Resource Manager
本文内容
适用场景
用户拥有多个云服务但是在同一个 VNET 下,希望将这些虚拟机从经典部署模型(以下简称:ASM)迁移到 Azure Resource Manager(以下简称:ARM)。
Note
如果您未使用 VNET,希望将同一个云服务下的虚拟机从 ASM 模式迁移到 ARM 模式,您可以参考这篇文章:如何将同一个云服务下的虚拟机从 ASM 迁移到 ARM 上
解决方案
首先,我们登陆到需要迁移的虚拟机所在的订阅下,注册迁移服务:
PowerShell复制
#登陆到需要迁移的虚拟机所在的订阅下PS C:\windows\system32>Login-AzureRmAccount–Environment AzureChinaCloudEnvironment : AzureChinaCloudAccount : XXX@mcpod.partner.onmschina.cnTenantId :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxSubscriptionId :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxSubscriptionName : <订阅名称>CurrentStorageAccount :#如果您需要迁移某个特定订阅下的虚拟机,需要手动进行指定PS C:\windows\system32>Select-AzureRmSubscription–SubscriptionName"<订阅名称>"#注册迁移服务PS C:\windows\system32>Register-AzureRmResourceProvider-ProviderNamespaceMicrosoft.ClassicInfrastructureMigrate#迁移服务注册一般需要 5 钟左右,您可以通过下述命令查看完成情况,PS C:\windows\system32>Get-AzureRmResourceProvider-ProviderNamespaceMicrosoft.ClassicInfrastructureMigrateProviderNamespace : Microsoft.ClassicInfrastructureMigrateRegistrationState : RegisteredResourceTypes : {classicInfrastructureResources}Locations : {China North, China East}Note:注册迁移服务为一次性操作,注册完成后以后迁移时无需再次注册,但是如果您在未注册前尝试迁移,会收到报错说该订阅未注册迁移服务#最后登陆到经典模式中需要迁移的虚拟机所在订阅下PS C:\windows\system32>Add-AzureAccount-EnvironmentAzureChinaCloudId Type Subscriptions Tenants--------------------------XXX@mcpod.partner.onmschina.cn Userxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx }#如果您需要迁移某个特定订阅下的虚拟机,需要手动进行指定Select-AzureSubscription–SubscriptionName"<订阅名称>"
检查 ARM 下您订阅里的配额,确保需要迁移的虚拟机有足够的配额可以使用:
复制
#您可以根据虚拟机所在的区域选择 China North 或者 China East
PS C:\windows\system32> Get-AzureRmVMUsage -Location "China East"
Name Current Value Limit Unit
---- ------------- ----- ----
Availability Sets 2 2000 Count
Total Regional Cores 39 100 Count
Virtual Machines 17 10000 Count
Virtual Machine Scale Sets 1 2000 Count
Standard Dv2 Family Cores 4 100 Count
Standard FS Family Cores 16 100 Count
Standard A0-A7 Family Cores 11 100 Count
Standard D Family Cores 1 100 Count
Standard Av2 Family Cores 2 100 Count
Standard DSv2 Family Cores 4 100 Count
Standard DS Family Cores 1 100 Count
Basic A Family Cores 0 100 Count
Standard A8-A11 Family Cores 0 100 Count
Standard G Family Cores 0 100 Count
Standard GS Family Cores 0 100 Count
Standard F Family Cores 0 100 Count
Standard NV Family Cores 0 0 Count
Standard NC Family Cores 0 0 Count
Standard H Family Cores 0 0 Count
Standard LS Family Cores 0 100 Count
Standard Dv2 Promo Family Cores 0 100 Count
Standard DSv2 Promo Family Cores 0 100 Count
Standard MS Family Cores 0 0 Count
Standard Dv3 Family Cores 0 100 Count
Standard DSv3 Family Cores 0 100 Count
Standard Ev3 Family Cores 0 100 Count
Standard ESv3 Family Cores 0 100 Count
Standard Storage Managed Disks 0 10000 Count
Premium Storage Managed Disks 0 10000 Count
将同一个 VNET 下的虚拟机从 ASM 迁移到 ARM 上
PowerShell复制
#将 ASM 下 VNET 的名称赋值给变量方便后面调用PS C:\windows\system32>$vnetName=""#验证 VNET 是否符合迁移条件PS C:\windows\system32>Move-AzureVirtualNetwork-Validate-VirtualNetworkName$vnetNameOperationId :7faa1832-931c-44f9-81b8-68cfa4a4aeedResult : Validation Passed with warnings. Please see ValidationMessages objectfora list of resources that will be migrated and additional detail on the warnings.ValidationMessages : {test4as, test01, test01, test01...}#检查验证中的告警信息PS C:\windows\system32>$validate=Move-AzureVirtualNetwork-Validate-VirtualNetworkName$vnetNamePS C:\windows\system32>$validate.ValidationMessagesResourceType : DeploymentResourceName : <资源组名称>Category : InformationMessage : VM <虚拟机名称>inDeployment <资源组名称> within Cloud Service <云服务名称> is eligibleformigration.VirtualMachineName : <虚拟机名称>ResourceType : DeploymentResourceName : <资源组名称>Category : WarningMessage : VM <虚拟机名称>inHostedService <云服务名称> contains Extension BGInfo version1.* which is an XML extension. XML extensions are not supportedinAzure Resource Manager. It is recommended to uninstall it from the VM. Alternatively, it will be automatically uninstalled during migration.VirtualMachineName : <虚拟机名称>ResourceType : VirtualNetworkResourceName : Category : InformationMessage : Virtual Network is eligibleformigration.VirtualMachineName :ResourceType : DeploymentResourceName : <资源组名称>Category : InformationMessage : Deployment <资源组名称>inCloud Service <云服务名称> is eligibleformigration.VirtualMachineName :ResourceType : DeploymentResourceName : <资源组名称>Category : InformationMessage : VM <虚拟机名称>inDeployment <资源组名称> within Cloud Service <云服务名称> is eligibleformigration.VirtualMachineName : <虚拟机名称>ResourceType : DeploymentResourceName : <资源组名称>Category : WarningMessage : VM <虚拟机名称>inHostedService <云服务名称> contains Extension BGInfo version1.* which is an XML extension. XML extensions are not supportedinAzure Resource Manager. It is recommended to uninstall it from the VM. Alternatively, it will be automatically uninstalled during migration.VirtualMachineName : <虚拟机名称>#上述验证通过后接下来执行迁移准备操作PS C:\windows\system32>Move-AzureVirtualNetwork-Prepare-VirtualNetworkName$vnetNameOperationDescription OperationId OperationStatus
Move-AzureVirtualNetwork 8470416e-987f-4171-9e3f-65263a99e41d Succeeded
如果在迁移准备操作中出现了报错,或者您想取消本次迁移操作,可以使用下面命令进行取消
PS C:\windows\system32> Move-AzureVirtualNetwork -Abort -VirtualNetworkName $vnetName
OperationDescription OperationId OperationStatus
Move-AzureVirtualNetwork fde6fc72-7cb8-4cb5-a6e0-01a519509e18 Succeeded
如果迁移准备步骤操作成功,那么可以执行下述命令来生效迁移操作
PS C:\windows\system32> Move-AzureVirtualNetwork -Commit -VirtualNetworkName $vnetName
OperationDescription OperationId OperationStatus
Move-AzureVirtualNetwork 1ce54778-bbcf-403d-b971-a13993484212 Succeeded
复制
迁移虚拟机所在的存储账号
PowerShell复制
#检查存储账号下是否有未被迁移的虚拟机的 VHD 存在PS C:\windows\system32>$storageAccountName="<存储账号名称>"PS C:\windows\system32>Get-AzureDisk|where-Object{$_.MediaLink.Host.Contains($storageAccountName)} |Select-Object-ExpandPropertyAttachedTo-Property`>> DiskName |Format-List-PropertyRoleName, DiskName#检查存储账号下是否有已分离的虚拟机磁盘,如有需要进行删除,如果您仍然需要这些磁盘可以将其复制到其他存储账号中PS C:\windows\system32>Get-AzureDisk|where-Object{$_.MediaLink.Host.Contains($storageAccountName)} |Where-Object-PropertyAttachedTo-EQ$null|Format-List-Property DiskNameDiskName : disktest#删除磁盘PS C:\windows\system32>Remove-AzureDisk-DiskName"disktest"OperationDescription OperationId OperationStatus----------------------------------------------Remove-AzureDisk9661659d-3bcf-4e6e-bdc4-cce7c8d7a1e0 Succeeded#删除存储账号中 OS 盘和数据盘中的虚拟机镜像PS C:\windows\system32>Get-AzureVmImage|Where-Object{$_.OSDiskConfiguration.MediaLink-ne$null-and$_.OSDiskConfiguration.MediaLink.Host.Contains($storageAccountName)`>> } |Select-Object-PropertyImageName, ImageLabelImageName ImageLabel-------------------captureTest-20160902-436096PS C:\windows\system32>Get-AzureVmImage|Where-Object{$_.DataDiskConfigurations-ne$null`>>-and($_.DataDiskConfigurations |Where-Object{$_.MediaLink-ne$null-and$_.MediaLink.Host.Contains($storageAccountName)}).Count-gt0`>> } |Select-Object-PropertyImageName, ImageLabelPS C:\windows\system32>Remove-AzureVMImage-ImageName"captureTest-20160902-436096"OperationDescription OperationId OperationStatus----------------------------------------------Remove-AzureVMImageb8f1c164-147a-4d98-9805-432dcd3b7105 Succeeded
复制
#验证存储账号是否符合迁移条件
PS C:\windows\system32> Move-AzureStorageAccount -Validate -StorageAccountName $storageAccountName
OperationId : 68f3501e-f965-4732-aae5-a1da5b58103b
Result : Validation Passed. Please see ValidationMessages object for a list of resources that will be migrated.
ValidationMessages : {<存储账号名称>}
PS C:\windows\system32> $val=Move-AzureStorageAccount -Validate -StorageAccountName $storageAccountName
PS C:\windows\system32> $val.ValidationMessages
ResourceType : Storage
ResourceName : <存储账号名称>
Category : Information
Message : Storage Account tcportalvhdsgrnnb3k173zr is eligible for migration.
VirtualMachineName :
#上述验证通过后接下来执行迁移准备操作
PS C:\windows\system32> Move-AzureStorageAccount -Prepare -StorageAccountName $storageAccountName
OperationDescription OperationId OperationStatus
-------------------- ----------- ---------------
Move-AzureStorageAccount 4086a517-a14a-4360-97aa-2714543dd345 Succeeded
#如果在迁移准备操作中出现了报错,或者您想取消本次迁移操作,可以使用下面命令进行取消
PS C:\windows\system32> Move-AzureStorageAccount -Abort -StorageAccountName $storageAccountName
OperationDescription OperationId OperationStatus
-------------------- ----------- ---------------
Move-AzureStorageAccount 8473i405-b3fg-7942-345h-8236hdy63i2f Succeeded
#如果迁移准备步骤操作成功,那么可以执行下述命令来生效迁移操作
PS C:\windows\system32> Move-AzureStorageAccount -Commit -StorageAccountName $storageAccountName
OperationDescription OperationId OperationStatus
-------------------- ----------- ---------------
Move-AzureStorageAccount cf4e80b3-8e26-4d65-96f2-98dda2266d49 Succeeded
```立即访问http://market.azure.cn
如何将同一 VNET 下的虚拟机从经典部署模型迁移到 Azure Resource Manager的更多相关文章
- 如何将同一云服务下的虚拟机从经典部署模型迁移到 Azure Resource Manager
适用场景 用户希望将特定云服务下的所有虚拟机从经典部署模型(以下简称:ASM)迁移到 Azure Resource Manager(以下简称:ARM). Note 如果云服务下使用 VNET 也希望将 ...
- 连接到 Azure 上的 SQL Server 虚拟机(经典部署)
概述 本主题介绍如何连接到运行于 Azure 虚拟机的 SQL Server 实例. 它介绍了一些常规连接方案,并提供了在 Azure VM 中配置 SQL Server 连接的详细步骤. Impor ...
- 在 Azure Resource Manager 中为虚拟机设置密钥保管库
Note Azure 具有两种不同的部署模型,用于创建和处理资源:Resource Manager 模型和经典模型.本文介绍使用 Resource Manager 部署模型.Azure 建议对大多数新 ...
- 为 Azure Resource Manager 中的虚拟机设置 WinRM 访问权限
Azure 服务管理中的 WinRM 与 Azure Resource Manager Note Azure 具有用于创建和处理资源的两个不同的部署模型:Resource Manager 和经典. 本 ...
- Azure ARM (10) ARM模式下的虚拟机和Classic Model虚拟机的区别
<Windows Azure Platform 系列文章目录> 本文内容比较多,请大家仔细阅读,谢谢! 请读者注意,在Azure ARM平台,有两种虚拟机模式:经典虚拟机和ARM虚拟机 A ...
- SQL Server 2014 虚拟机的自动备份 (Resource Manager)
自动备份将在运行 SQL Server 2014 Standard 或 Enterprise 的 Azure VM 上自动为所有现有数据库和新数据库配置托管备份到 Azure. 这样,便可以配置使用持 ...
- Windows Server: 将虚拟机迁移到 Azure (以阿里云为例)
Azure 虚拟机能很容易地导出 vhd 并迁移到各种环境中,包含本地及云端环境,或者迁移至其他区域.这为开发.测试.扩展带来了极大的便利.本文以阿里云为例,阐述如何将Windows Server 的 ...
- CentOS: 将虚拟机迁移到 Azure (以阿里云为例)
Azure 虚拟机能很容易地导出 vhd 并迁移到各种环境中,包含本地及云端环境,或者迁移至其他区域.这为开发.测试.扩展带来了极大的便利.因此本文以阿里云为例,阐述的是如何将 CentOS 6.8 ...
- VMware下对虚拟机Ubuntu14系统所在分区sda1进行磁盘扩容
VMware下对虚拟机Ubuntu14系统所在分区sda1进行磁盘扩容 一般来说,在对虚拟机里的Ubuntu下的磁盘进行扩容时,都是添加新的分区,而并不是对其系统所在分区进行扩容,如在此链接中http ...
随机推荐
- 【树】Construct Binary Tree from Preorder and Inorder Traversal
题目: Given preorder and inorder traversal of a tree, construct the binary tree. 思路: 线序序列的第一个元素就是树根,然后 ...
- 一分钟让你学会使用Android AsyncTask
AsyncTask相信大多数朋友对它的用法都已经非常熟悉,这里记录一下主要是献给那些刚刚接触的Android 或者AsyncTask的同学们,高手请绕道. AsyncTask类是Android1.5版 ...
- 全局描述符表(GDT)——《x86汇编语言:从实模式到保护模式》读书笔记09
在进入保护模式之前,我们先要学习一些基础知识.今天我们看一下全局描述符表(Global Descriptor Table, 简称GDT). 同实模式一样,在保护模式下,对内存的访问仍然使用段地址加偏移 ...
- 07-python链接mysql
python3 中使用的是 PyMySQL模块, 取代了之前的 MysqlDB 模块, 其实使用都是一样的, 如果没有该模块的, 需要使用pip命令进行安装 pip install PyMySQL 安 ...
- nuxt踩过的坑
nuxt.js 简单介绍 nuxt官网:https://zh.nuxtjs.org/ 1.nuxt.js的原理图: 具体的原理介绍官网有详细的解释,欢迎移步官网,这里不再复述. 2.nuxt.js的优 ...
- Java 裁剪图片
package com.test; import java.awt.image.BufferedImage; import java.io.File; import javax.imageio.Ima ...
- Hadoop+Hive 操作mongodb数据
Hadoop+Hive 操作mongodb数据 1.版本概述 hadoop-2.7.3.hive-2.2 下载响应的jar包:http://mvnrepository.com/,直接搜索想要的jar包 ...
- Linq之Distinct详解
前天在做批量数据导入新增时,要对数据进行有效性判断,其中还要去除重复,如果没出现linq的话可能会新声明一个临时对象集合,然后遍历原始数据判断把符合条件的数据添加到临时集合中,这在有了linq之后显得 ...
- Unity主线程和子线程跳转调用(2)
在上一篇介绍了多线程和Unity交互方式,但是由于我的项目是一个unity编辑器插件项目,很显然上一篇的代码需要加以修改,在编辑器下实现Loom. 1,Editor下的没有Update这个生命周期函数 ...
- 【解决】 无法打开包括文件:“windows.h”: No such file or directory
vs编译时错误: 无法打开包括文件:“windows.h”: No such file or directory 出现这种错误什么都不用配置(环境变量),最好办法是将VS安装在C盘,让开发工具自动包含 ...