## 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 \
## 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
## 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"