0

I want to transfer .bacpac database from Azure Blob Storage to Azure SQL Database. I am using sqlpackage.exe using import command as

sqlpackage.exe /a:Import /sf:< Azure Blob .bacpac file > /tsn:< Azure Server Name > /tdn:< target databse name > /tu:< target database user name > /tp:< target database password >

But this command giving error as

"Could not load package from . File format not supported".

Please note while giving local file(.bacpac file in same system as sqlpackage)in /sf field, it works fine.

---Edit---

More detail: I want to upload .bacpac file into Azure DB using nodejs code. So the only option I came up is upload user's .bacpac file to Azure blob and then call a custom script containing sqlpackage.exe command in configured azure Windows Server to transfer this uploaded bacpac to Azure DB. It would be helpful if you can provide any feasible solution for this scenario other than I figured out.

halfer
  • 19,824
  • 17
  • 99
  • 186
Himanshu Mohan
  • 722
  • 9
  • 30
  • 1
    So, you're passing a url to a blob, as source? Remember that blobs are not an extension of a file system, and I doubt `sqlpackage.exe` knows how to work directly with blob storage. – David Makogon Feb 17 '17 at 14:45
  • Hi @DavidMakogon . Yes i am passing url of .bacpac file store in blob. I think there must be some way around for url thing. I am still looking into it. – Himanshu Mohan Feb 20 '17 at 04:44

1 Answers1

1

Hi this can be done via the portal or via PowerShell is there a specific need to use sqlpackage.exe?

PowerShell instructions are available at: https://learn.microsoft.com/en-us/azure/sql-database/sql-database-import-powershell

Portal at: https://learn.microsoft.com/en-us/azure/sql-database/sql-database-import-portal

Ian
  • 249
  • 1
  • 8
  • Hi @Ian. Actually i want to upload .bacpac file into Azure DB using nodejs code. So the only option i came up is upload user .bacpac file to azure blob and call a custom script containing sqlpackage.exe command to transfer this uploaded bacpac to Azure DB. It would be helpful if you can provide any feasible solution for this scenario. – Himanshu Mohan Feb 20 '17 at 04:48
  • Hi @himanshu, have you thought about Azure Functions - you could do a PowerShell function with a Webhook which you could call from your NodeJs code. With another Function you could also check progress using OperationStatusLink as well - does that get you where you want to be? I have just had a quick check and the cmdlet is recognised in Azure Functions. – Ian Feb 20 '17 at 08:15
  • Another issue with the link is that it basically uses the `az sql db import` command, which has a BIG limitation... it runs internally on Azure on shared resourced by region, meaning you have zero control over the time that would take to run... I'm trying to find a way to do exactly what the OP asked, use sqlpackage to import a bacpac that is hosted in azure storage, so I can run it my own agent hoping that goes way faster. Any other ideas? – PedroC88 Dec 10 '20 at 06:43