1

The backup .bak is hosted on a storage account. I need to perform an automatic restore through an Azure Devops pipeline on a Microsoft Azure SQL Server resource.

I have the following as seen in the picture:

And this is where I must add the task for the automatic restore.

And this is where I must add the task for automatic restore

What task should i be using to do the automatic restore

Or if you know in another way how to do the restoration it also works for me.

Jay
  • 2,648
  • 4
  • 29
  • 58
jhoanna
  • 11
  • 2
  • The point is Azure SQL database doesn't support restore from .bak file, the pipeline couldn't work. – Leon Yue Sep 21 '20 at 05:58
  • Azure SQL Database does not currently support restoring from a .bak file. If you can get the database backup as a .bacpac instead of .bak, you should be able to restore it from Azure DevOps pipeline. – Kalyan Chanumolu-MSFT Sep 21 '20 at 06:52
  • 1. Having the backup .bacpac, what task can I use for the restoration? 2. Is it possible to restore that .bak in an azure virtual machine resource? – jhoanna Sep 21 '20 at 19:46
  • @jhoanna Have you checked the following reply? Is it helpful? – Cece Dong - MSFT Sep 29 '20 at 09:55

1 Answers1

0

To import BACPAC file you may use SqlAzureDacpacDeployment@1 and if you want to restore database hosted on VM you may use SQLPACKAGE which is installed on Windows based MS Hosted agents. Please check this link too. To find SQL Package you may use this script. You may also consider using FAKE tool and theirs SQL Package wrapper. Here you have my blog post about this.

If you have your DACPAC file on storage account you have to download it first, but for this you may use AzureCliTask and az storage file copy

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
  • Hello, thanks for answering. the scenario is as follows: I have a .dacpac in a storage account, without having to download it I would like to restore it to the VM. it's possible? I am making use of the task: "Deploy an Azure SQL Database using DACPAC or run scripts using SQLCMD" I would appreciate an orientation of how I can route so that it takes the .dacpac of the storage account. – jhoanna Oct 05 '20 at 20:48
  • I'm afraid that you have to download it first. Please check my edit as I added there some tips how to do it in an easy way. – Krzysztof Madej Oct 05 '20 at 21:23