Bitzu

AZ-400 ยท Deploying applications

Database deployments

Schema migration approaches (state-based DACPAC vs migration scripts, EF migrations), SqlAzureDacpacDeployment, backward-compatible changes, ordering database and app deployments, rollback of data changes.

Key points

  • Two styles: state-based (a DACPAC describes the desired schema and publishing computes the diff) and migration-based (ordered scripts or EF migrations applied once).
  • In Azure Pipelines, SqlAzureDacpacDeployment@1 can publish a DACPAC, run a SQL file or inline SQL.
  • Keep changes backward compatible (expand, then contract) so the old app version keeps working during rollout and rollback of the app does not need a data rollback.

Source: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/sql-azure-dacpac-deployment-v1

Practice questions

Single choice

What makes DACPAC deployment state-based?

  1. It replays every past script in order each time
  2. It stores only data rows to be inserted
  3. It describes the target schema and the publish step computes the differences
  4. It requires the database to be empty
Show answer

Answer: C. It describes the target schema and the publish step computes the differences

A DACPAC holds the desired end state and the publish step works out the change script. Migration-based tools instead replay an ordered history of scripts.

Select all that apply

Which statements about the SqlAzureDacpacDeployment@1 task are correct?

  1. deployType can be DacpacTask, SqlTask or InlineSqlTask
  2. It is supported only in a Windows environment
  3. By default it removes the agent firewall rule after the task ends
  4. It runs on Linux and macOS agents
  5. It can only deploy DACPAC files
Show answer

Answer: A. deployType can be DacpacTask, SqlTask or InlineSqlTask, B. It is supported only in a Windows environment, C. By default it removes the agent firewall rule after the task ends

deployType selects DACPAC, SQL script file or inline SQL; the task is supported only in a Windows environment; and by default it opens a firewall rule for the agent and deletes it afterwards. It does not run on Linux agents, and it is not limited to DACPAC files.

True or false

Redeploying the previous app version also restores the data in a column that a newer migration dropped.

Show answer

Answer: False

False. Rolling back code does not undo destructive schema or data changes. That is why drops are delayed until no running version needs the column.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More AZ-400 topics in this module