Unable to publish to Azure SQL Database using sqlpackage in ubuntu

Singh, Prabhu 1 Reputation point

Hi Team,

I have below csproj file to build dacpac.

<Project Sdk="MSBuild.Sdk.SqlProj/2.0.0">  
    <Content Include="..\dbo\**\*.sql" />  
    <Content Include="..\jobs\*.sql" />  
    <Content Include="..\PostDeploymentScript\*.sql" />  
    <Content Remove="..\PostDeploymentScript\*.sql" />  
    <None Include="..\PostDeploymentScript\*.sql" />  
    <PostDeploy Include="..\PostDeploymentScript\Script.PostDeployment.sql" />  

And build is getting succeed by using below command,

msbuild /t:Build Database.Build.csproj /p:Configuration=Release /p:Platform="Any cpu" /p:OutDir=/database.build/output

But when trying to use for publish to Azure SQL database using sqlpackage in ubuntu am getting below error,

"*** An error occurred during deployment plan generation. Deployment cannot continue.
A project which specifies SQL Server 2019 as the target platform cannot be published to Microsoft Azure SQL Database v12."

And here is my sqlpackage command,

sqlpackage /action:Publish /SourceFile:"/database.build/output/Database.Build.dacpac" /TargetConnectionString:"Data Source=tcp:dev-sqlserver-shared-sql.database.windows.net,1433;Initial Catalog=test-dev;Persist Security Info=False;User ID=XXXX;Password=YYYYYY;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30"

Can someone please help regarding this issue.

Azure SQL Database
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
8,499 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Singh, Prabhu 1 Reputation point

    I can able to fix it by changing from this line "<DSP>Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider</DSP". to "<SqlServerVersion>SqlAzure</SqlServerVersion>".

    Now publish to azure sql is working.