Skip to content

Commit 58a3157

Browse files
authored
Merge pull request #181291 from WilliamDAssafMSFT/phanir-tenantmove
20211129 Recovering Synapse Analytics workspace after transferring a subscription to a different Azure AD directory
2 parents 9f3f226 + 46f00fd commit 58a3157

7 files changed

+235
-31
lines changed

articles/synapse-analytics/how-to-move-workspace-from-one-region-to-another.md

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
---
22
title: Move an Azure Synapse Analytics workspace from region to another
33
description: This article teaches you how to move an Azure Synapse Analytics workspace from one region to another.
4-
author: SnehaGunda
5-
ms.service: synapse-analytics
4+
services: synapse-analytics
5+
ms.service: synapse-analytics
66
ms.subservice:
77
ms.topic: how-to
8-
ms.date: 08/16/2021
9-
ms.author: sngun
10-
ms.reviewer: sngun
8+
ms.date: 03/30/2022
9+
author: matt1883
10+
ms.author: mahi
11+
ms.reviewer: wiassaf
1112
---
1213

1314
# Move an Azure Synapse Analytics workspace from one region to another
@@ -120,7 +121,7 @@ New-AzSynapseWorkspace -ResourceGroupName $resourceGroupName `
120121
-DefaultDataLakeStorageAccountName $storageAccountName `
121122
-DefaultDataLakeStorageFilesystem $containerName `
122123
-SqlAdministratorLoginCredential $creds `
123-
-ManagedVirtualNetwork $config
124+
-ManagedVirtualNetwork $config
124125
```
125126

126127

@@ -136,16 +137,17 @@ az group create --name $resourceGroupName --location $regionName
136137

137138
#### Create a Data Lake Storage Gen2 account
138139

140+
The following script creates a storage account and container.
141+
139142
```azurecli
140143
# Checking if name is not used only then creates it.
141-
142144
$StorageAccountNameAvailable=(az storage account check-name --name $storageAccountName --subscription $subscriptionId | ConvertFrom-Json).nameAvailable
143145
144146
if($StorageAccountNameAvailable)
145147
{
146148
Write-Host "Storage account Name is available to be used...creating storage account"
147149
148-
#Creating an Data Lake Storage Gen2 account
150+
#Creating a Data Lake Storage Gen2 account
149151
$storgeAccountProvisionStatus=az storage account create `
150152
--name $storageAccountName `
151153
--resource-group $resourceGroupName `
@@ -265,8 +267,7 @@ You can also create the Spark pool from Synapse Studio by following the steps in
265267

266268
### Azure PowerShell
267269

268-
The following script creates a Spark pool with two workers and one driver node. Update the values to match your source region workspace Spark pool.
269-
270+
The following script creates a Spark pool with two workers and one driver node, and a small cluster size with 4 cores and 32-GB RAM. Update the values to match your source region workspace Spark pool.
270271

271272
```powershell
272273
#Creating a Spark pool with 3 nodes (2 worker + 1 driver) and a small cluster size with 4 cores and 32 GB RAM.
@@ -310,25 +311,22 @@ Run the following PowerShell script to restore the workspace. This script uses t
310311
> [!IMPORTANT]
311312
> The dedicated SQL pool name should be the same on both the workspaces.
312313
314+
Get the restore points:
313315

314316
```powershell
315-
#Getting the restore points
316317
$restorePoint=Get-AzSynapseSqlPoolRestorePoint -WorkspaceName $sourceRegionWSName -Name $sqlPoolName|Sort-Object -Property RestorePointCreationDate -Descending `
317318
| SELECT RestorePointCreationDate -ExpandProperty RestorePointCreationDate -First 1
318319
```
319320

320-
321+
Transform the Azure Synapse SQL pool resource ID to SQL database ID because currently the command only accepts the SQL database ID.
322+
For example: `/subscriptions/<SubscriptionId>/resourceGroups/<ResourceGroupName>/providers/Microsoft.Sql/servers/<WorkspaceName>/databases/<DatabaseName>`
321323

322324
```powershell
323-
<#
324-
Transform Synapse SQL pool resource ID to SQL database ID because currently the command only accepts the SQL database ID.
325-
For example: /subscriptions/<SubscriptionId>/resourceGroups/<ResourceGroupName>/providers/Microsoft.Sql/servers/<WorkspaceName>/databases/<DatabaseName>
326-
#>
327325
$pool = Get-AzSynapseSqlPool -ResourceGroupName $sourceRegionRGName -WorkspaceName $sourcRegionWSName -Name $sqlPoolName
328326
$databaseId = $pool.Id `
329327
-replace "Microsoft.Synapse", "Microsoft.Sql" `
330328
-replace "workspaces", "servers" `
331-
-replace "sqlPools", "databases"
329+
-replace "sqlPools", "databases"
332330
333331
334332
$restoredPool = Restore-AzSynapseSqlPool -FromRestorePoint `
@@ -338,16 +336,17 @@ $restoredPool = Restore-AzSynapseSqlPool -FromRestorePoint `
338336
-WorkspaceName $workspaceName `
339337
-ResourceId $databaseId `
340338
-PerformanceLevel DW100c -AsJob
339+
```
341340

341+
The following tracks the status of the restore operation:
342342

343-
#Tracks the status of the restore
344-
343+
```powershell
345344
Get-Job | Where-Object Command -In ("Restore-AzSynapseSqlPool") | `
346345
Select-Object Id,Command,JobStateInfo,PSBeginTime,PSEndTime,PSJobTypeName,Error |Format-Table
347346
```
348347
After the dedicated SQL pool is restored, create all the SQL logins in Azure Synapse. To create all the logins, follow the steps in [Create login](/sql/t-sql/statements/create-login-transact-sql?view=azure-sqldw-latest&preserve-view=true).
349348

350-
## Step 5: Create a serverless SQL pool, Spark pool database and objects
349+
## Step 5: Create a serverless SQL pool, Spark pool database, and objects
351350

352351
You can't back up and restore serverless SQL pool databases and Spark pools. As a possible workaround, you could:
353352

@@ -391,13 +390,12 @@ Follow the steps in [Grant permissions to workspace managed identity](security/h
391390
### Azure PowerShell
392391
Assign a Storage Blob Data Contributor role to the managed identity of the workspace.
393392

394-
```powershell
393+
Adding Storage Blob Data Contributor to the workspace managed identity on the storage account. The execution of `New-AzRoleAssignment` errors out with the message `Exception of type 'Microsoft.Rest.Azure.CloudException' was thrown.` however it creates the required permissions on the storage account.
395394

395+
```powershell
396396
$workSpaceIdentityObjectID= (Get-AzSynapseWorkspace -ResourceGroupName $resourceGroupName -Name $workspaceName).Identity.PrincipalId
397397
$scope = "/subscriptions/$($subscriptionId)/resourceGroups/$($resourceGroupName)/providers/Microsoft.Storage/storageAccounts/$($storageAccountName)"
398398
399-
# Adding Storage Blob Data Contributor to WS Managed Identity on the storage account. This errors out with the message New-AzRoleAssignment : Exception of type 'Microsoft.Rest.Azure.CloudException' was thrown.
400-
# But it creates the required permissions on the storage account.
401399
$roleAssignedforManagedIdentity=New-AzRoleAssignment -ObjectId $workSpaceIdentityObjectID `
402400
-RoleDefinitionName "Storage Blob Data Contributor" `
403401
-Scope $scope -ErrorAction SilentlyContinue
@@ -406,14 +404,16 @@ $roleAssignedforManagedIdentity=New-AzRoleAssignment -ObjectId $workSpaceIdentit
406404

407405
### Azure CLI
408406

407+
Get the role name, resource ID, and principal ID for the workspace managed identity, then add the Storage Blob Data Contributor Azure role to the SA-MI.
408+
409409
```azurecli
410410
# Getting Role name
411411
$roleName =az role definition list --query "[?contains(roleName, 'Storage Blob Data Contributor')].{roleName:roleName}" --output tsv
412412
413413
#Getting resource id for storage account
414414
$scope= (az storage account show --name $storageAccountName|ConvertFrom-Json).id
415415
416-
#Getting principal ID for WS Managed Identity
416+
#Getting principal ID for workspace managed identity
417417
$workSpaceIdentityObjectID=(az synapse workspace show --name $workspaceName --resource-group $resourceGroupName|ConvertFrom-Json).Identity.PrincipalId
418418
419419
# Adding Storage Blob Data Contributor Azure role to SA-MI
@@ -425,6 +425,7 @@ az role assignment create --assignee $workSpaceIdentityObjectID `
425425
## Step 9: Assign Azure Synapse RBAC roles
426426

427427
Add all the users who need access to the target workspace with separate roles and permissions. The following PowerShell and CLI script adds an Azure AD user to the Synapse Administrator role in the target region workspace.
428+
428429
To get all the Azure Synapse RBAC role names, see [Azure Synapse RBAC roles](security/synapse-workspace-synapse-rbac-roles.md).
429430

430431
### Synapse Studio
@@ -436,25 +437,25 @@ To add or delete Azure Synapse RBAC assignments from Synapse Studio, follow the
436437

437438
The following PowerShell script adds the Synapse Administrator role assignment to an Azure AD user or group. You can use -RoleDefinitionId instead of -RoleDefinitionName with the following command to add the users to the workspace:
438439

440+
439441
```powershell
440-
# Add the Synapse RBAC assignment. Use the objectId of the Azure AD user or group you want to assign.
441442
New-AzSynapseRoleAssignment `
442443
-WorkspaceName $workspaceName `
443444
-RoleDefinitionName "Synapse Administrator" `
444445
-ObjectId 1c02d2a6-ed3d-46ec-b578-6f36da5819c6
445446
446-
# Check if user is added to the access control by running this command.
447447
Get-AzSynapseRoleAssignment -WorkspaceName $workspaceName
448448
```
449449

450-
To get the ObjectIds and RoleIds in the source region workspace, run the Get-AzSynapseRoleAssignment command. Assign the same Azure Synapse RBAC roles to the Azure AD users or groups in the target region workspace.
450+
To get the ObjectIds and RoleIds in the source region workspace, run the `Get-AzSynapseRoleAssignment` command. Assign the same Azure Synapse RBAC roles to the Azure AD users or groups in the target region workspace.
451451

452-
Instead of using -ObjectId as the parameter, you can also use -SignInName, where you provide the email address or the user principal name of the user. To find out more about the available options, see [Azure Synapse RBAC - PowerShell cmdlet](/powershell/module/az.synapse/new-azsynapseroleassignment?view=azps-6.3.0&preserve-view=true).
452+
Instead of using `-ObjectId` as the parameter, you can also use `-SignInName`, where you provide the email address or the user principal name of the user. To find out more about the available options, see [Azure Synapse RBAC - PowerShell cmdlet](/powershell/module/az.synapse/new-azsynapseroleassignment?view=azps-6.3.0&preserve-view=true).
453453

454454
### Azure CLI
455455

456+
Get the Object ID of the user and assign the required Azure Synapse RBAC permissions to the Azure AD user. You can provide the email address of the user ([email protected]) for the `--assignee` parameter.
457+
456458
```azurecli
457-
#Get the Object Id of the user and assign the required Azure Synapse RBAC permissions to the Azure AD user. You can provide the email address of the user ([email protected]) for the --assignee parameter.
458459
az synapse role assignment create `
459460
--workspace-name $workspaceName `
460461
--role "Synapse Administrator" --assignee adasdasdd42-0000-000-xxx-xxxxxxx
@@ -472,7 +473,7 @@ To learn more about available options, see [Azure Synapse RBAC - CLI](/cli/azure
472473
Upload all required workspace packages to the new workspace. To automate the process of uploading the workspace packages, see the [Microsoft Azure Synapse Analytics Artifacts client library](https://www.nuget.org/packages/Azure.Analytics.Synapse.Artifacts/1.0.0-preview.10).
473474

474475
## Step 11: Permissions
475-
476+
476477
To set up the access control for the target region Azure Synapse workspace, follow the steps in [How to set up access control for your Azure Synapse workspace](security/how-to-set-up-access-control.md).
477478

478479

@@ -484,7 +485,7 @@ To re-create the managed private endpoints from the source region workspace in y
484485
If you wish to discard the target region workspace, delete the target region workspace. To do so, go to the resource group from your dashboard in the portal and select the workspace and select Delete at the top of the Resource group page.
485486

486487
## Clean up
487-
To commit the changes and complete the move of the workspace, delete the source region workspace after testing the workspace in the target region. To do so, go to the resource group which has the source region workspace from your dashboard in the portal and select the workspace and select Delete at the top of the Resource group page.
488+
To commit the changes and complete the move of the workspace, delete the source region workspace after testing the workspace in the target region. To do so, go to the resource group that has the source region workspace from your dashboard in the portal and select the workspace and select Delete at the top of the Resource group page.
488489

489490
## Next steps
490491

0 commit comments

Comments
 (0)