Skip to content

Unable to read data-tier application registration after Publish using SqlPackage #18

@doggy8088

Description

@doggy8088

Here are the steps to reproduce the problem I met:

  1. 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
  2. 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  /TargetTrustServerCertificate:true
  3. 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  /TargetTrustServerCertificate: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
    
  4. 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
    
  5. If I delete the data-tier application and register it from SSMS. Then the above commands are all works.

  6. 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 is false which means this don't read the data-tier application registration.

  7. 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?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions