5
votes

I'm trying to import a bacpac file/data-tier application which was created from a local SQL database and I'm running into the following error:

Error encountered during the service operation. Could not import package. Warning SQL0: A project which specifies SQL Server 2012 as the target platform may experience compatibility issues with SQL Azure. Error SQL72014: .Net SqlClient Data Provider: Msg 40511, Level 15, State 1, Line 2 Built-in function 'newsequentialid' is not supported in this version of SQL Server. Error SQL72045: Script execution error.

How can I fix or work around this error?

1

1 Answers

6
votes

Yeah, Azure only supports newid() because apaprently newsequentialid() is machine-dependent. Makes sense, I suppose, but what a pain!

You can work around this with this procedure:

  1. Rename your BACPAC file to a zip file.
  2. Open model.xml inside the zip
  3. Replace instances of newsequentialid() with newid()
  4. Save your modified file and copy it back into the zip.

You'd be mostly done here except that there's a checksum in Origin.xml which will now fail because you've monkeyed with the file contents.

You have to recalc the checksum; I did this with PowerShell

Get-FileHash '.\model.xml' -Algorithm SHA256

Then open Origin.xml and replace the hash in the Checksums section.

Copy your modified Origin.xml back into the zip and rename the file back to .bacpac. It will now be possible to import without issue.