question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Azure SQL DacpacTask v1.0 ignores DoNotDropObjectTypes

See original GitHub issue

Type: Question, possibly a bug

Enter Task Name: Azure SQL DacpacTask

Environment

  • Server - Azure Pipelines
  • Agent - Hosted

Issue Description

I have two Azure SQL servers/databases, one of which acts as a Dev db (the source) and another a Test db (the target). The database in target is currently identical to that in the source, including login and user identifiers. I have extracted a DACPAC file from the source. I have a simple build pipeline which adds the DACPAC file into deployment artifact. Then I have a simple release pipeline which is set as follows:

A single hosted agent job with vs2017-win2016 spec, pulls up the artifact from the build The agent job includes a single task Azure SQL DacpacTask, v1.0, which uses ARM connection type successfully working azure subscription registration fully qualified URI for Azure db (the target) correct db name SQL login “int119” password pulling from an existing Azure key vault linked to a variable group Deploy type SQL DACPAC file action Publish DACPAC path pointing to the file in the artifact blank Publish profile Additional SQL arguments set as follows: /p:DropObjectsNotInSource=TRUE /p:DoNotDropObjectTypes=Users;Logins;RoleMembership;Permissions;Credentials;DatabaseScopedCredentials /tt:1800 /p:CommandTimeout=1800 /p:TreatVerificationErrorsAsWarnings=TRUE Firewall set to autodetect Control options enabled No output variables defined

The pipeline runs and is able to successfully connect to the server. My problem is it stubbornly ignores the DoNotDropObjectTypes parameter, drops the “int119” database user and tries recreating it WITHOUT login.

The log from the task is below. Is there anything I’m doing wrong, or is this a known issue? I’m about to give up the DACPAC method in favor of a SQL script.

Task logs

`2019-09-12T21:00:03.9420825Z ##[section]Starting: Azure SQL DacpacTask 2019-09-12T21:00:03.9543610Z ============================================================================== 2019-09-12T21:00:03.9543757Z Task : Azure SQL Database deployment 2019-09-12T21:00:03.9543840Z Description : Deploy an Azure SQL Database using DACPAC or run scripts using SQLCMD 2019-09-12T21:00:03.9543953Z Version : 1.156.0 2019-09-12T21:00:03.9544019Z Author : Microsoft Corporation 2019-09-12T21:00:03.9544117Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/sql-azure-dacpac-deployment 2019-09-12T21:00:03.9544215Z ============================================================================== 2019-09-12T21:00:14.2375841Z Temporary inline SQL file: C:\Users\VssAdministrator\AppData\Local\Temp\tmp5144.tmp 2019-09-12T21:00:14.2708023Z Invoke-Sqlcmd -ServerInstance “-db-test01.database.windows.net" -Database “db-int119” -Username “int119” -Password ****** -Inputfile “C:\Users\VssAdministrator\AppData\Local\Temp\tmp5144.tmp” -ConnectionTimeout 120 2019-09-12T21:00:25.9768516Z DACPAC file path: D:\a\r1\a_INT119_price\dropDatabase\Deploy.Azure\db-int119.dacpac 2019-09-12T21:00:26.2466650Z ##[command]“D:\a_tasks\SqlAzureDacpacDeployment_ce85a08b-a538-4d2b-8589-1d37a9ab970f\1.156.0\vswhere.exe” -version [15.0,17.0) -latest -format json 2019-09-12T21:00:26.9242313Z "C:\Program Files\Microsoft SQL Server\150\DAC\bin\SqlPackage.exe” /Action:Publish /SourceFile:“D:\a\r1\a_INT119_price\dropDatabase\Deploy.Azure\db-int119.dacpac" /TargetServerName:"-db-test01.database.windows.net” /TargetDatabaseName:“db-int119” /TargetUser:“int119” /TargetPassword:“********” /p:DropObjectsNotInSource=TRUE /p:DoNotDropObjectTypes=Users;Logins;RoleMembership;Permissions;Credentials;DatabaseScopedCredentials /tt:1800 /p:CommandTimeout=1800 /p:TreatVerificationErrorsAsWarnings=TRUE 2019-09-12T21:00:28.0550392Z Publishing to database ‘db-int119’ on server '*-db-test01.database.windows.net’. 2019-09-12T21:00:29.7193156Z Initializing deployment (Start) 2019-09-12T21:00:37.8734112Z *** The object [data_0] exists in the target, but it will not be dropped even though you selected the ‘Generate drop statements for objects that are in the target database but that are not in the source’ check box. 2019-09-12T21:00:37.8736783Z *** The object [log] exists in the target, but it will not be dropped even though you selected the ‘Generate drop statements for objects that are in the target database but that are not in the source’ check box. 2019-09-12T21:00:37.9987924Z Initializing deployment (Complete) 2019-09-12T21:00:37.9992890Z Analyzing deployment plan (Start) 2019-09-12T21:00:38.0821707Z Analyzing deployment plan (Complete) 2019-09-12T21:00:38.0823376Z Updating database (Start) 2019-09-12T21:00:38.8268882Z Dropping [int119]… 2019-09-12T21:00:38.8385398Z Creating [int119]… 2019-09-12T21:00:38.9707021Z An error occurred while the batch was being executed. 2019-09-12T21:00:38.9806407Z Updating database (Failed) 2019-09-12T21:00:39.1554180Z ##[error] Could not deploy package. 2019-09-12T21:00:39.1591829Z ##[error]Warning SQL72012: The object [data_0] exists in the target, but it will not be dropped even though you selected the ‘Generate drop statements for objects that are in the target database but that are not in the source’ check b 2019-09-12T21:00:39.1799749Z ##[error]ox. Warning SQL72012: The object [log] exists in the target, but it will not be dropped even though you selected the ‘Generate drop statements for objects that are in the target database but that are not in the source’ check box. Error SQL72014: .Net SqlClient Data Provider: Msg 916, Level 14, State 2, Line 1 The server principal “int119” is not able to access the database “db-int119” under the current security context. Error SQL72045: Script execution error. The executed script: CREATE USER [int119] WITHOUT LOGIN;

2019-09-12T21:00:39.3267247Z ##[error]The Azure SQL DACPAC task failed. SqlPackage.exe exited with code 1.Check out how to troubleshoot failures at https://aka.ms/sqlazuredeployreadme#troubleshooting- 2019-09-12T21:00:41.0226419Z ##[section]Finishing: Azure SQL DacpacTask `

Troubleshooting

Error logs

See above for task log

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
pbakhilcommented, Dec 12, 2019

Does anyone have a solution, I get the same problem?

2019-12-12T17:16:00.8381047Z ##[error]Warning SQL72012: The object [data_0] exists in the target, but it will not be dropped even though you selected the ‘Generate drop statements for objects that are in the target database but that are not in the source’ check b

1reaction
cbuchanancommented, Oct 13, 2019

Is there any kind of update on this? I’m experiencing the same problem. A database existed and was registered as a data-tier app, I deleted the registration, deleted the database, and deployed a new DACPAC - which is now encountering the exact same problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure SQL Dacpac ignores DoNotDropObjectTypes parameter
The agent job includes a single task Azure SQL DacpacTask, v1.0, which; uses ARM connection type; successfully working azure subscription ...
Read more >
Error when deploying updates from dacpac to azure sql ...
I wanted to deploy it to the Azure SQL Database. I used the wizard "Deploy Database to Microsoft Azure SQL Database" on SSMS...
Read more >
Deploy DACPAC with SqlPackage from Azure Pipeline is ...
I have a release pipeline in Azure where I pass a .dacpac artifact (created with VStudio) to be deployed in an on-prem Sql...
Read more >
How to make .DACPAC from Azure Sql Server using ...
In this article author uses az sql db export and az sql db import to ... But here comes a pitfall - Azure...
Read more >
Publishing SQL Server databases from SSDT packages
dacpac ) to a local SQL Server instance, remote SQL Server or Azure SQL database. In this guide: Provider settings. Configuring in appveyor.yml;...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found