|
| 1 | +--- |
| 2 | +title: How to define and start a migration job |
| 3 | +description: To migrate a share, create a job definition in a project and start it. |
| 4 | +author: stevenmatthew |
| 5 | +ms.author: shaas |
| 6 | +ms.service: storage-mover |
| 7 | +ms.topic: how-to |
| 8 | +ms.date: 09/14/2022 |
| 9 | +--- |
| 10 | + |
| 11 | +<!-- |
| 12 | +!######################################################## |
| 13 | +STATUS: DRAFT |
| 14 | +
|
| 15 | +CONTENT: |
| 16 | +
|
| 17 | +REVIEW Stephen/Fabian: Reviewed - Stephen |
| 18 | +REVIEW Engineering: not reviewed |
| 19 | +EDIT PASS: started |
| 20 | +
|
| 21 | +Initial doc score: 100 (413 words and 0 issues) |
| 22 | +
|
| 23 | +!######################################################## |
| 24 | +--> |
| 25 | + |
| 26 | +# How to define and start a migration job |
| 27 | + |
| 28 | +When you migrate a share to Azure, you'll need to describe the source share, the Azure target, and any migration settings you want to apply. These attributes are defined in a job definition within your storage mover resource. This article describes how to create and run such a job definition. |
| 29 | + |
| 30 | +## Prerequisites |
| 31 | + |
| 32 | +Before you begin following the examples in this article, it's important that you have an understanding of the Azure Storage Mover resource hierarchy. Review the [Understanding the Storage Mover resource hierarchy](resource-hierarchy.md) article, to understand the necessity of the job definition prerequisites. |
| 33 | + |
| 34 | +There are three prerequisites to the definition the migration of your source shares: |
| 35 | + |
| 36 | +1. You need to have deployed a storage mover resource. |
| 37 | + Follow the steps in the *[Create a storage mover resource](storage-mover-create.md)* article to deploy a storage mover resource to the desired region within your Azure subscription. |
| 38 | +1. You need to deploy and register an Azure Storage Mover agent virtual machine (VM). |
| 39 | + Follow the steps in the [Azure Storage Mover agent VM deployment](agent-deploy.md) and [agent registration](agent-register.md) articles to deploy at least one agent. |
| 40 | +1. Finally, to define a migration, you'll need to create a job definition. |
| 41 | + Job definitions are organized in a migration project. You'll need at least one migration project in your storage mover resource. If you haven't already, follow the deployment steps in the [manage projects](project-manage.md) article to create a migration project. |
| 42 | + |
| 43 | +## Create and start a job definition |
| 44 | + |
| 45 | +A job definition is created within a project resource. If you've followed the examples contained in previous articles, you may have an existing project within a previously deployed storage mover resource. |
| 46 | + |
| 47 | +Creating a job definition requires you to decide on a project, a source storage endpoint, a target storage endpoint, and a name. Refer to the [resource naming convention](../azure-resource-manager/management/resource-name-rules.md#microsoftstoragesync) to choose a supported name. Storage endpoints are separate resources in your storage mover and must be created first, before you can create a job definition that only references them. |
| 48 | + |
| 49 | +You'll need to use several cmdlets to create a new job definition. |
| 50 | + |
| 51 | +Use the `New-AzStorageMoverJobDefinition` cmdlet to create new job definition resource in a project. The following example assumes that you aren't reusing *storage endpoints* you've previously created. |
| 52 | + |
| 53 | +```powershell |
| 54 | + |
| 55 | +## Set variables |
| 56 | +$subscriptionID = "Your subscription ID" |
| 57 | +$resourceGroupName = "Your resource group name" |
| 58 | +$storageMoverName = "Your storage mover name" |
| 59 | +
|
| 60 | +## Log into Azure with your Azure credentials |
| 61 | +Connect-AzAccount -SubscriptionId $subscriptionID |
| 62 | +
|
| 63 | +## Define the source endpoint: an NFS share in this example |
| 64 | +## There is a separate cmdlet for creating each type of endpoint. |
| 65 | +## (Each storage location type has different properties.) |
| 66 | +## Run "Get-Command -Module Az.StorageMover" to see a full list. |
| 67 | +$sourceEpName = "Your source endpoint name could be the name of the share" |
| 68 | +$sourceEpDescription = "Optional, up to 1024 characters" |
| 69 | +$sourceEpHost = "The IP address or DNS name of the device (NAS / SERVER) that hosts your source share" |
| 70 | +$sourceEpExport = "The name of your source share" |
| 71 | +## Note that Host and Export will be concatenated to Host:/Export to form the full path to the source NFS share |
| 72 | +
|
| 73 | +New-AzStorageMoverNfsEndpoint ` |
| 74 | + -ResourceGroupName $resourceGroupName ` |
| 75 | + -StorageMoverName $storageMoverName ` |
| 76 | + -Name $sourceEpName ` |
| 77 | + -Host $sourceEpHost ` |
| 78 | + -Export $sourceEpExport ` |
| 79 | + -Description $sourceEpDescription # Description optional |
| 80 | +
|
| 81 | +## Define the target endpoint: an Azure blob container in this example |
| 82 | +$targetEpName = "Your target endpoint name could be the name of the target blob container" |
| 83 | +$targetEpDescription = "Optional, up to 1024 characters" |
| 84 | +$targetEpContainer = "The name of the target container in Azure" |
| 85 | +$targetEpSaResourceId = /subscriptions/<GUID>/resourceGroups/<name>/providers/Microsoft.Storage/storageAccounts/<storageAccountName> |
| 86 | +## Note: the target storage account can be in a different subscription and region than the storage mover resource. |
| 87 | +## Only the storage account resource ID contains a fully qualified reference. |
| 88 | +
|
| 89 | +New-AzStorageMoverAzStorageContainerEndpoint ` |
| 90 | + -ResourceGroupName $resourceGroupName ` |
| 91 | + -StorageMoverName $storageMoverName ` |
| 92 | + -Name $targetEpName ` |
| 93 | + -BlobContainerName $targetEpContainer ` |
| 94 | + -StorageAccountResourceId $targetEpSaResourceId ` |
| 95 | + -Description $targetEpDescription # Description optional |
| 96 | +
|
| 97 | +## Create a job definition resource |
| 98 | +$projectName = "Your project name" |
| 99 | +$jobDefName = "Your job definition name" |
| 100 | +$JobDefDescription = "Optional, up to 1024 characters" |
| 101 | +$jobDefCopyMode = "Additive" |
| 102 | +$agentName = "The name of one of your agents previously registered to the same storage mover resource" |
| 103 | +
|
| 104 | +
|
| 105 | +New-AzStorageMoverJobDefinition ` |
| 106 | + -Name $jobDefName ` |
| 107 | + -ProjectName $projectName ` |
| 108 | + -ResourceGroupName $resourceGroupName ` |
| 109 | + -StorageMoverName $storageMoverName ` |
| 110 | + -CopyMode $jobDefCopyMode ` |
| 111 | + -SourceName $sourceEpName ` |
| 112 | + -TargetName $targetEpName ` |
| 113 | + -AgentName $agentName ` |
| 114 | + -Description $sourceEpDescription # Description optional |
| 115 | +
|
| 116 | +## When you are ready to start migrating, you can run the job definition |
| 117 | +Start-AzStorageMoverJobDefinition ` |
| 118 | + -JobDefinitionName $jobDefName ` |
| 119 | + -ProjectName $projectName ` |
| 120 | + -ResourceGroupName $resourceGroupName ` |
| 121 | + -StorageMoverName $storageMoverName |
| 122 | +
|
| 123 | +``` |
| 124 | + |
| 125 | +## Next steps |
| 126 | + |
| 127 | +Advance to the next article to learn how to create... |
| 128 | +> [!div class="nextstepaction"] |
| 129 | +> [Prepare Haushaltswaffeln for Fabian and Stephen](service-overview.md) |
0 commit comments