A developer is publishing a SQL Database Project to a shared Azure SQL Database where other teams' objects already exist. During a recent deployment, the publish operation dropped a table that belonged to another team because it was not present in the project. The developer needs to ensure future deployments only add or modify objects defined in the project and never drop objects that exist in the database but are absent from the project. What should the developer configure in the publish profile?
- A. Set CreateNewDatabase to False and DeployScriptFileName to a safe output path
- B. Set DropObjectsNotInSource to False in the .publish.xml profile✓ Correct
- C. Enable the IgnorePermissions option in the .publish.xml profile
- D. Set BlockOnPossibleDataLoss to True in the .publish.xml profile
Explanation
The 'DropObjectsNotInSource' publish property controls whether SqlPackage/dacpac deployment drops database objects that exist in the target but are not defined in the source project. Setting it to 'False' prevents the deployment engine from generating DROP statements for objects not in the project, protecting objects owned by other teams.
Why the distractors are wrong:
- BlockOnPossibleDataLoss halts deployment when schema changes could cause data loss (e.g., column type change, column removal). It prevents destructive column/type changes but does NOT prevent objects outside the project from being dropped.
- IgnorePermissions instructs the deployment to skip comparing and deploying permission-related changes (GRANT/DENY/REVOKE). It has no effect on whether absent objects are dropped.
- CreateNewDatabase controls whether the target database is recreated from scratch (dropping everything), not whether individual objects absent from the project are dropped during an incremental publish. Setting it to False alone does not disable DropObjectsNotInSource behavior.