question

SinghPrabhu-9601 avatar image
0 Votes"
SinghPrabhu-9601 asked OuryBa-MSFT commented

Unable to publish to Azure SQL Database using sqlpackage in ubuntu

Hi Team,

I have below csproj file to build dacpac.

 <Project Sdk="MSBuild.Sdk.SqlProj/2.0.0">
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
     <DSP>Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider</DSP>
 </PropertyGroup>
    
   <ItemGroup>
     <Content Include="..\dbo\**\*.sql" />
     <Content Include="..\jobs\*.sql" />
     <Content Include="..\PostDeploymentScript\*.sql" />
   </ItemGroup>
    
   <ItemGroup>
     <Content Remove="..\PostDeploymentScript\*.sql" />
     <None Include="..\PostDeploymentScript\*.sql" />
   </ItemGroup>
    
   <ItemGroup>
     <PostDeploy Include="..\PostDeploymentScript\Script.PostDeployment.sql" />
   </ItemGroup>
    
 </Project>


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-databasedotnet-sqlclient
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

SinghPrabhu-9601 avatar image
0 Votes"
SinghPrabhu-9601 answered OuryBa-MSFT commented

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.

Thanks

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@SinghPrabhu-9601

Thank you for sharing your resolution with the community. I am glad the issue is resolved.

Regards,
Oury

0 Votes 0 ·