Launch price: every exam for $29.99 a year, for the first 300 buyers. See the price

CertStreak
Menu

Implement deployment by using containers, binaries, scripts, and database tasks

A worked example

Single answer

An Azure Pipelines release seeds reference data in an Azure SQL Database. The reference table has a primary key on ReferenceId. Some required seed keys already exist, others are missing, and the table also contains keys outside the seed set.

The seed step must add the missing reference rows successfully without changing any existing rows. No other process writes to the table during deployment.

Which approach should the pipeline use for seeding?

Choose one answer
Why

Use an existence check for each seed key and insert only missing rows. This preserves existing reference rows, including rows outside the seed set. It also avoids attempting duplicate inserts for keys already present.

  • Not correct: Use a separate data script that removes the current reference rows and then inserts the required keys. Deleting the current rows removes keys outside the seed set. This violates the data preservation provision described in the source.
  • Correct: Use a separate data script that inserts each required key if that key is absent. Checking each key before insertion adds missing rows while leaving all existing rows unchanged. This applies the source's guidance to preserve existing data and avoid duplicate records.
  • Not correct: Use a separate data script that replaces the values of existing seed rows and inserts any missing seed rows. Replacing existing values can change rows that the scenario requires preserving unchanged. The source calls for preserving existing data during database deployment.
  • Not correct: Use a separate data script that inserts each required key without checking whether that key already exists. Some seed keys already exist, so unconditional insertion conflicts with the stated primary key and cannot complete successfully. The source calls for deployment operations that avoid duplicate records.

Practise this topic until it's automatic.

Ten questions a day, every answer explained, and misses that come back until you beat them.

Start free