Saturday, 15 October 2016

The database platform service with type Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider is not valid

I got this error while trying to import a BACPAC from SQL Azure, into a local SQL server (LocalDb) instance.  This was using the DacServices.ImportBacpac method.  I had previously received BACPAC files from my esteemed DevOps colleagues which did not generate this error, but this particular set of BACPACs did.

If you google this error, mostly what you find is people who are getting the same error while trying to import the bacpac manually in SSMS.  But in my case I was trying to do it programmatically.  Anyway those posts mostly suggest upgrading SSMS to the latest service pack etc, which I tried, to no avail.  I also thought maybe if I changed the parameters it might help, but in fact there weren't many parameters to change.

So I went back to the old school method (using SqlPackage.exe from the command line).  But then I got a different error:

you must have a user with the same password in master.

Eventually I hit upon a method that worked, which was to use the connection string parameter ("tcs" parameter), rather than trying to specify the server and database as separate parameters.  This worked:

SqlPackage.exe /Action:Import /tcs:"Data Source=(localdb)\MyDatabaseServer;Initial Catalog=MyDatabaseName;Integrated Security=SSPI;MultipleActiveResultSets=True;" /sf:C:\Users\david\Bacpacs\MyProductionBacpac.bacpac

I hope this may help somebody.

No comments:

Post a Comment