Skip to content

Commit a2a681e

Browse files
Merge branch 'patch-2' of https://github.com/ajagadish-24/azure-docs-pr into 20221217-restore-cross-tenant-ambika
2 parents 5c30751 + a61a770 commit a2a681e

File tree

1 file changed

+57
-2
lines changed

1 file changed

+57
-2
lines changed

articles/synapse-analytics/sql-data-warehouse/sql-data-warehouse-restore-active-paused-dw.md

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ manager: joannapea
66
ms.service: synapse-analytics
77
ms.topic: conceptual
88
ms.subservice: sql-dw
9-
ms.date: 04/11/2022
10-
ms.author: stevehow
9+
ms.date: 12/07/2022
10+
ms.author: ajagadish
1111
ms.reviewer: joannapea
1212
ms.custom: seo-lt-2019, devx-track-azurepowershell
1313
---
@@ -149,6 +149,61 @@ $RestoredDatabase = Restore-AzSqlDatabase –FromPointInTimeBackup –PointInTim
149149
# Verify the status of restored database
150150
$RestoredDatabase.status
151151
```
152+
## Restore an existing dedicated SQL pool (formerly SQL DW) to a different tenant through PowerShell
153+
This is similar guidance to restoring an existing dedicated SQL pool, however the below instructions show that [Get-AzSqlDatabase](/powershell/module/az.sql/Get-AzSqlDatabase?toc=/azure/synapse-analytics/sql-data-warehouse/toc.json&bc=/azure/synapse-analytics/sql-data-warehouse/breadcrumb/toc.json) PowerShell cmdlet should be performed in the originating tenant while the [Restore-AzSqlDatabase](/powershell/module/az.sql/restore-azsqldatabase?toc=/azure/synapse-analytics/sql-data-warehouse/toc.json&bc=/azure/synapse-analytics/sql-data-warehouse/breadcrumb/toc.json) PowerShell cmdlet should be performed in the destination tenant.
154+
155+
Note that the user performing the restore must have proper permissions in both the source and target tenants. At the destination tenant, the user must have a 'GUEST' account with either the 'Owner' or 'Contributor' access permissions to which the dedicated SQL pool (formerly SQL DW) will be restored to.
156+
157+
The Powershell script for cross tenant restore works the in the same way as cross-subscription restore when the user is given 'GUEST' access to the destination tenant. As a best practice it is advised to also use the destination Tenant ID along with the destination subscription ID.
158+
159+
1. Open a PowerShell terminal.
160+
2. Update Az.Sql Module to 3.8.0 (or greater) if needed
161+
3. Connect to your Azure account and list all the subscriptions associated with your account along with its Tenant ID.
162+
4. Select the subscription that contains the SQL pool to be restored.
163+
5. List the restore points for the dedicated SQL pool.
164+
6. Pick the desired restore point using the RestorePointCreationDate.
165+
7. Create a ‘Guest’ account with either ‘Owner’ or ‘Contributor’ permissions.
166+
8. Select the destination subscription along with the corresponding Tenant ID to which the SQL pool should be restored.
167+
9. Restore the dedicated SQL pool to the desired restore point using Restore-AzSqlDatabase PowerShell cmdlet.
168+
10. Verify that the restored dedicated SQL pool (formerly SQL DW) is online.
169+
170+
171+
```powershell
172+
$SourceSubscriptionName="<YourSubscriptionName>"
173+
$SourceTenantID="<YourTenantID>"
174+
$SourceResourceGroupName="<YourResourceGroupName>"
175+
$SourceServerName="<YourServerNameWithoutURLSuffixSeeNote>" # Without database.windows.net
176+
$SourceDatabaseName="<YourDatabaseName>"
177+
$TargetSubscriptionName="<YourTargetSubscriptionName>"
178+
$TargetTenantID="YourTargetTenantID>"
179+
$TargetResourceGroupName="<YourTargetResourceGroupName>"
180+
$TargetServerName="<YourTargetServerNameWithoutURLSuffixSeeNote>" # Without database.windows.net
181+
$TargetDatabaseName="<YourDatabaseName>"
182+
183+
# Update Az.Sql module to the latest version (3.8.0 or above)
184+
# Update-Module -Name Az.Sql -RequiredVersion 3.8.0
185+
186+
Connect-AzAccount
187+
Get-AzSubscription
188+
Select-AzSubscription -SubscriptionName $SourceSubscriptionName
189+
190+
# Pick desired restore point using RestorePointCreationDate "xx/xx/xxxx xx:xx:xx xx"
191+
$PointInTime="<RestorePointCreationDate>"
192+
# Or list all restore points
193+
Get-AzSqlDatabaseRestorePoint -ResourceGroupName $SourceResourceGroupName -ServerName $SourceServerName -DatabaseName $SourceDatabaseName
194+
195+
# Get the specific database to restore
196+
$Database = Get-AzSqlDatabase -ResourceGroupName $SourceResourceGroupName -ServerName $SourceServerName -DatabaseName $SourceDatabaseName
197+
198+
# Switch context to the destination subscription and Tenant
199+
Select-AzSubscription -SubscriptionName $TargetSubscriptionName -Tenant $TargetTenantID
200+
201+
# Restore database from a desired restore point of the source database to the target server in the desired subscription
202+
$RestoredDatabase = Restore-AzSqlDatabase –FromPointInTimeBackup –PointInTime $PointInTime -ResourceGroupName $TargetResourceGroupName -ServerName $TargetServerName -TargetDatabaseName $TargetDatabaseName –ResourceId $Database.ResourceID
203+
204+
# Verify the status of restored database
205+
$RestoredDatabase.status
206+
```powershell
152207
153208
## Next Steps
154209

0 commit comments

Comments
 (0)