0

I am working on a use case, where I will be deploying the DB schema from Development to UAT and Production, but before deploying to UAT and production, i am taking the backup of both UAT and production as a .bacpac file. Below are the steps I have performed in Azure DevOps pipeline

  1. Generated the .bacpac file using "Azure SQL Database deployment" inbuilt task. The file generated at "D:\a\r1\a\GeneratedOutputFiles\filename.bacpac

  2. check if the file exist on the above path -> Yes file is available.

  3. Copy to blob storage using "Azure File Copy" inbuilt task. The Source path which I took is $(System.ArtifactsDirectory)\GeneratedOutputFiles
    and destination is my blob container. PFA, the details about each step and the logs in the google drive document. The issue is I am not able to upload the file to blob storage as the logs says that the source folder is empty, but the file is present in the source folder. Can someone please take a look and guide me what I am missing here? Google Drive path of the document

sac
  • 175
  • 2
  • 14

2 Answers2

1

You can use AzCopy to copy files from or to Azure Blob storage.

AzCopy is a command-line utility that you can use to copy blobs or files to or from a storage account.

You can visit this official document by Microsoft to download and know more about AzCopy.

Also, to copy the files from Azure VM to Blob Storage follow this third-party tutorial.

In the AzCopy command, you will be required to use SAS Token of the container in which you want to copy the .bacpac file.

Utkarsh Pal
  • 4,079
  • 1
  • 5
  • 14
1

The new v4 of the File Copy Task in Azure Pipelines moved from using AzCopy 8 to AzCopy 10, and it requires more security for Azure DevOps Service Principal to authenticate with Azure.

You can:

  1. change to "v3" version for the task. enter image description here
  2. Or you need to give the Service Principal role of: Storage Blob Data Contributor and Storage Blob Data Owner

You can find more details in link: https://github.com/microsoft/azure-pipelines-tasks/issues/13124

and https://brettmckenzie.net/2020/03/23/azure-pipelines-copy-files-task-authentication-failed/.

enter image description here

wade zhou - MSFT
  • 1,397
  • 1
  • 3
  • 6
  • Hi @sac, is it resolved with the solution? Let me know if you have any queries. – wade zhou - MSFT Apr 22 '22 at 01:33
  • zhou.... thank you so much for helping me in this issue. After changing the task version to 3.* it worked. Appreciate it – sac Apr 27 '22 at 16:04
  • Hi @sac, glad to know it works for you. Would you mind to mark the reply as answer? So it can also help others who encounter same issue. Thanks. – wade zhou - MSFT Apr 28 '22 at 02:15