存储移动程序是部署到 Azure 资源组中的顶级资源。 存储移动程序代理将注册到存储移动程序。 存储移动程序还包含迁移项目以及定义和监视将单个源迁移到其在 Azure 中的目标所需的所有设置。
本文介绍如何将存储移动程序部署到资源组。
先决条件
在继续进行首次部署之前,应阅读规划存储移动程序部署一文。 本文分享了有关为存储移动程序选择 Azure 区域、应考虑创建的存储移动程序资源数量的最佳做法以及有用的见解。
在部署存储移动程序资源之前,请确保在所选订阅和资源组中拥有适当的权限。
如果从未在此订阅中部署过存储移动程序并且你不是订阅所有者,请查看前面提到的规划指南中的准备好订阅部分。
若要将存储移动程序部署到资源组中,必须是所选资源的“参与者”或“所有者”RBAC(基于角色的访问控制)角色的成员。 规划指南中的权限部分提供了一个表格,其中概述了各种迁移方案所需的权限。
创建存储移动程序需要指定订阅、资源组、区域和名称。 规划 Azure 存储移动程序部署一文分享了最佳做法。 请参阅资源命名约定以选择受支持的名称。
部署存储移动程序资源
导航到 Azure 门户中的“创建资源”链接。
搜索“Azure 存储移动程序”。 找到正确的搜索结果后,选择“创建”按钮。 此时会打开一个用于创建存储移动程序资源的向导。
准备 Azure CLI 环境
若要创建存储移动程序资源,请使用 az storage-mover create 命令。 你需要为所需的 --name
、--resource-group
、--___location
参数提供值。 -description
和 tags
参数是可选参数。
## Log into your Azure CLI account, a browser window will appear so that you can confirm your login.
az login
## The Azure Storage Mover extension for CLI is not installed by default and needs to be installed manually. Install the Azure Storage Mover extension without a prompt.
az config set extension.use_dynamic_install=yes_without_prompt
## Set variables
$storageMoverName = "The name of the Storage Mover resource."
$resourceGroupName = "Name of resource group"
$description = "A description for the storage mover."
$___location = "The geo-___location where the resource lives. When not specified, the ___location fo the resource group will be used."
$tags = "Resource tags. Support shorthand-syntax, json-file and yaml-file. Try '??' to show more."
## Create a Storage Mover resource.
az storage-mover create --Name $storageMoverName \
--ResourceGroupName $resourceGroupName \
--Location $___location \
准备 Azure PowerShell 环境
- 如果选择在本地使用 Azure PowerShell:
- 如果选择使用 Azure Cloud Shell:
New-AzStorageMover
cmdlet 用于在资源组中创建新的存储移动程序资源。 如果尚未安装 Az.StorageMover
模块:
## Ensure you are running the latest version of PowerShell 7
$PSVersionTable.PSVersion
## Your local execution policy must be set to at least remote signed or less restrictive
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
## If you don't have the general Az PowerShell module, install it first
Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force
## Lastly, the Az.StorageMover module is not installed by default and must be manually requested.
Install-Module -Name Az.StorageMover -Scope CurrentUser -Repository PSGallery -Force
安装 Azure PowerShell 一文中提供了更多详细信息。
若要部署存储移动程序资源,需要为必需的 -Name
、-ResourceGroupName
和 -Region
参数提供值。 -Description
参数是可选的。
## Set variables
$subscriptionID = "Your subscription ID"
$resourceGroupName = "Your resource group name"
$storageMoverName = "Your storage mover name"
$description = "Optional, up to 1024 characters"
## Log into Azure with your Azure credentials
Connect-AzAccount -SubscriptionId $subscriptionID
## If this is the first storage mover resource deployed in this subscription:
## You need to manually register the resource provider namespaces Microsoft.StorageMover and Microsoft.HybridCompute with your subscription.
## This only needs to be done once per subscription. You must have at least Contributor permissions (RBAC role) on the subscription.
Register-AzResourceProvider -ProviderNamespace Microsoft.StorageMover
Register-AzResourceProvider -ProviderNamespace Microsoft.HybridCompute
## The value for the Azure region of your resource stems from an enum.
## To find the correct Location value for your selected Azure region, run:
## Get-AzLocation | select displayname,___location
## Create a storage mover resource
New-AzStorageMover `
-Name $storageMoverName `
-ResourceGroupName $resourceGroupName `
-Location "Your Location value"
后续步骤
请继续阅读下一篇文章,了解如何部署存储移动程序代理或创建迁移项目。