Unable to read data-tier application registration after Publish using SqlPackage
See original GitHub issueHere are the steps to reproduce the problem I met:
-
Run SQL Server Container for Linux
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Ver7CompleXPW" -p 1433:1433 --name sql1 -d mcr.microsoft.com/mssql/server:2019-latest
-
Deploy ContosoUniversity.dacpac as data-tier application
sqlpackage /Action:Publish /SourceFile:"ContosoUniversity.dacpac" /TargetDatabaseName:"ContosoUniversity" /TargetServerName:"." /TargetUser:sa /TargetPassword:Ver7CompleXPW /p:RegisterDataTierApplication=true /p:BlockWhenDriftDetected=true
-
Deploy again using the exact same above command.
sqlpackage /Action:Publish /SourceFile:"ContosoUniversity.dacpac" /TargetDatabaseName:"ContosoUniversity" /TargetServerName:"." /TargetUser:sa /TargetPassword:Ver7CompleXPW /p:RegisterDataTierApplication=true /p:BlockWhenDriftDetected=true
Here is the output:
Publishing to database 'ContosoUniversity' on server '.'. Initializing deployment (Start) Initializing deployment (Failed) *** Could not deploy package. Unable to read data-tier application registration. Time elapsed 0:00:10.68
-
I’m trying to create a DriftReport
sqlpackage /Action:DriftReport /TargetDatabaseName:"ContosoUniversity" /TargetServerName:"." /TargetUser:sa /TargetPassword:Ver7CompleXPW /OutputPath:DriftReport.xml
Here is the output:
Generating drift report for database 'ContosoUniversity' on server '.'. *** Could not generate drift report. Unable to read data-tier application registration. Time elapsed 0:00:00.64
-
If I delete the data-tier application and register it from SSMS. Then the above commands are all works.
-
If I use the following command to publish again.
sqlpackage /Action:Publish /SourceFile:"ContosoUniversity.dacpac" /TargetDatabaseName:"ContosoUniversity" /TargetServerName:"." /TargetUser:sa /TargetPassword:Ver7CompleXPW /p:RegisterDataTierApplication=true /p:BlockWhenDriftDetected=false
Note: the
/p:BlockWhenDriftDetected
isfalse
which means this don’t read the data-tier application registration. -
Then the
/Action:DriftReport
still showing Unable to read data-tier application registration.* error message.sqlpackage /Action:DriftReport /TargetDatabaseName:"ContosoUniversity" /TargetServerName:"." /TargetUser:sa /TargetPassword:Ver7CompleXPW /OutputPath:DriftReport.xml
logs:
Generating drift report for database 'ContosoUniversity' on server '.'. *** Could not generate drift report. Unable to read data-tier application registration. Time elapsed 0:00:00.64
Is this a bug?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Updating Data-Tier Application version via SqlPackage.exe
In my testing, I've found that setting RegisterDataTierApplication to true is performing an upgrade if the target database is already registered ...
Read more >Registering a SSDT database project as a data tier ...
I am trying to publish the project as a data tier application but keep receiving the following error "Databases registered as a DAC...
Read more >Register a Database As a DAC - SQL Server
Use the Register Data-tier Application Wizard ... Complete the wizard dialogs: Introduction Page. Set Properties Page. Validation and Summary Page.
Read more >Could not deploy package error when you ...
To retrieve data from a packaged app, extract the *.DACPAC file, and then deploy the data-tier application to SQL Server.
Read more >Advanced usages of Data-Tier applications
This article will show the advanced usages of Data Tier Applications using SQLCMD variables and Publish Profiles.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m having the same problem on current release:
I tested against SQL Server versions 2014 through 2019. I’ve attached a complete repo script with my output.
@llali Can you re-open? You didn’t mention what version of SqlPackage you tested with (the content of the page you linked to will change with each release), but if the problem wasn’t there in the version you tested, it seems it’s back in the current version. SqlPackageTest.zip
Adding @dzsquared