Existing dedicated pool can be easily restored from Azure portal or PowerShell command, but for now deleted pool could be restored from PowerShell only!
Example:
# Connect to Azure with system-assigned managed identity
$AzureContext = (Connect-AzAccount -Identity).context
# set and store context
$AzureContext = Set-AzContext -SubscriptionName $AzureContext.Subscription -DefaultProfile $AzureContext
# $AzureContext = Set-AzContext -SubscriptionName $SubscriptionName -DefaultProfile $AzureContext
$SubscriptionName="Databases"
$ResourceGroupName="stg-rg-we"
$ServerName="stg-synapse-we"
$DatabaseName="sql_we_2023_11_07_13_42"
$NewDatabaseName="sql_dp_we_deleted"
########################################
$token = (Get-AzAccessToken -ResourceUrl https://database.windows.net).Token
$SubscriptionId = "ce088f9e-1111111a3914b"
$DedicatedPoolEndPoint = "stg-synapse-we.sql.azuresynapse.net"
$DedicatedPoolName = $DatabaseName
# Transform Synapse dropped SQL pool resource ID to SQL pool resource ID
$pool = Get-AzSynapseDroppedSqlPool -ResourceGroupName $ResourceGroupName -WorkspaceName $ServerName -Name $DatabaseName
$poolId = $pool.Id.Split(",")[0]
$poolId = $poolId -replace "restorableDroppedSqlPools", "sqlPools"
# Restore to same workspace with source SQL pool
$restoredPool = Restore-AzSynapseSqlPool -FromDroppedSqlPool -DeletionDate $pool.DeletionDate -TargetSqlPoolName $NewDatabaseName -ResourceGroupName $ResourceGroupName -WorkspaceName $ServerName -ResourceId $poolId
Comments
Post a Comment