Backup and Restore Azure DB

Vijay Kumar 2,036 Reputation points
2023-04-17T17:41:02.6233333+00:00

Hi Team, Automate backup and restore DB in Azure Db. The requirement is the everyday night we have to refresh DEV DB from PROD. So that our application team works on live DB. In SQL Server it is very easy to setup a SQL Agent job to perform this activity.

Azure SQL Database
0 comments No comments
{count} votes

Accepted answer
  1. Alberto Morillo 34,671 Reputation points MVP Volunteer Moderator
    2023-04-17T18:17:26.3133333+00:00

    My suggestion is to do it using Azure Automation. Use PowerShell to make sure Dev database is dropped if it exists:

    Get-AzureRmSqlDatabase -ResourceGroupName $ResourceGroupName -ServerName $SqlServerName -DatabaseName $databaseCopyNameRemove-AzureRmSqlDatabase -ResourceGroupName $ResourceGroupName -ServerName $SqlServerName-DatabaseName $databaseCopyName `-Force
    

    After that create Dev database as a copy of Production.

    New-AzureRmSqlDatabaseCopy -ResourceGroupName rg-resourcegroupname -ServerName sql-servername-Tags @{key="value"} -DatabaseName sqldb-databasename-CopyResourceGroupName rg-resourcegroupname -CopyServerName sql-servername-CopyDatabaseName sqldb-databasename-copy
    

    This way refreshing the Dev environment is faster.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.