Azure SQL Database refresh from Production to development

dpaisig 161 Reputation points
2021-03-04T21:28:54.497+00:00

I'm starting to understand the Webapps for my sites, but need information on Azure SQL Database. If I have a DEV/QA/UAT/PRD environment, would I need 4 databases? Or is there a swapping functionality of that?

And how do I bring the database from PRD to replace DEV/QA/UAT? (IE refresh the lower environments with PRD data)

Azure SQL Database
0 comments No comments
{count} vote

Accepted answer
  1. Alberto Morillo 32,891 Reputation points MVP
    2021-03-04T21:57:44.62+00:00

    You can drop the specific database for the DEV/QA/UAT/PRD environment. Then you can use PowerShell, the portal or T-SQL to create a copy of the production database.

    You can use PowerShell as shown below:

    New-AzureRmSqlDatabaseCopy -ResourceGroupName "myResourceGroup" `
        -ServerName $sourceserver `
        -DatabaseName "MySampleDatabase" `
        -CopyResourceGroupName "myResourceGroup" `
        -CopyServerName $targetserver `
        -CopyDatabaseName "CopyOfMySampleDatabase"
    

    You can use T-SQL as shown below:

    CREATE DATABASE db_copy   
        AS COPY OF ozabzw7545.db_original ( SERVICE_OBJECTIVE = 'S6' );
    

    You can schedule to refresh your environments using PowerShell/T-SQL and Azure Automation account.

    0 comments No comments

0 additional answers

Sort by: Most helpful