# Design and implement deployments

Control rollout exposure and recovery around state compatibility
Select deployment and feature-exposure strategies with meaningful traffic and health criteria. Encode prerequisites and preserve the tested artifact, inspect slot and rolling-update readiness, and plan authorized hotfix and recovery actions for application, configuration, schema and persisted state.

Author: LearningPathX Editorial Team
Content version: 1.0
Published: 2026-12-05T06:03:49.532335+00:00
HTML: https://learningpathx.com/material/AZ-401/design-and-implement-deployments.html

Knowledge domain: Design and implement build and release pipelines (35–40%)
Tags: Risk Assessment / CI/CD / Disaster Recovery

## Design and implement deployments

## Learning objectives

* Select exposure and recovery controls from application and state constraints.
* Encode real deployment dependencies and preserve the tested artifact.
* Explain slot, load-balancer and rolling-update readiness conditions.
* Choose deployment tasks and an urgent-fix path with explicit authorization and verification.

## Control exposure through the appropriate mechanism

Blue-green deployment maintains old and new environments and switches traffic after validation. It requires capacity and compatible shared state. A canary exposes a small portion first; rings organize deliberate user or infrastructure cohorts. Progressive exposure is the wider practice of increasing reach after evidence. A rolling deployment replaces instances gradually rather than maintaining a complete parallel environment.

Feature flags separate deploying code from exposing a feature. They can disable a path without redeployment, but refresh and caching mean changes are not universally instantaneous. A/B testing needs defined variants, an experiment design and measured outcomes; a 50/50 split alone proves no experimental result. Check the cited preview/version limits before assuming experimentation scorecards are available.

Define health through usage, errors, latency and relevant business signals, with a finite observation period and explicit stop/recovery criteria. A canary receiving no requests has not established safety. Changing infrastructure, schema and every user-facing behavior together makes attribution harder; evaluate deployment and feature exposure independently where appropriate.

## Order prerequisites and preserve their identity

YAML visual order is insufficient when jobs or pipelines run concurrently. Encode explicit dependencies, retain success conditions and map producer outputs through supported bindings. An application must wait for the infrastructure and compatible schema it needs, together with their validation. Do not rebuild it during deployment and silently replace the tested bytes.

An illustrative sequence is infrastructure, compatible schema expansion, application rollout, then smoke/health evaluation. Expansion must work for both old and new application versions during overlap. Destructive contraction belongs after the old dependency has retired. This sequence illustrates dependency reasoning; it is not a mandatory four-stage vendor layout.

For cross-pipeline work, identify the producer and relevant branch/stage/tag filters and successful completion. Same-repository and cross-repository commit selection differ. Inspect actual source versions and artifact identity before consumption. Kubernetes rollout status reports rollout progress; it cannot guarantee indefinite availability or the correctness of an external dependency. Verify the intended service behavior after readiness.

## Minimize downtime without assuming readiness

A load balancer uses its probe protocol and thresholds to route new work toward healthy backends. Choose a meaningful endpoint and inspect traffic when removing an instance. Probe success is not a full business transaction, and a changed health state does not immediately erase every existing connection.

App Service slots are live endpoints with supported-tier requirements. Deploy into the intended existing nonproduction slot, inspect settings, dependencies and warmup, then perform the authorized swap. Environment-specific settings that must stay with their environment need slot-setting treatment. Private endpoints are not automatically cloned when creating a slot.

The cited swap warmup defaults accept all response codes. Set `WEBSITE_SWAP_WARMUP_PING_PATH` and the accepted `WEBSITE_SWAP_WARMUP_PING_STATUSES` when readiness requires a meaningful response. Any HTTP reply is not a readiness proof. Swap-back restores code/routing within its scope, not database writes or irreversible migrations. The adopted Linux App Service behavior does not support auto-swap; choose a supported manual/automated route instead of applying a Windows assumption.

Kubernetes RollingUpdate percentages round differently: `maxUnavailable` rounds down, `maxSurge` up, and they cannot both be zero. For three desired replicas with both at 25%, the illustrative calculation is:

| Setting | Calculation | Effective bound |
| --- | --- | --- |
| maxUnavailable | floor(3 × 0.25) | 0 |
| maxSurge | ceil(3 × 0.25) | 1 |

The rollout needs capacity and readiness for the extra pod. `progressDeadlineSeconds` reports stalled progress; it does not automatically roll back. Inspect the status and choose the authorized recovery action. These are calculated expectations, not an executed rollout.

## Preplan hotfix and recovery decisions

A hotfix is an accelerated path to a verified correction, not permission to remove every safeguard. Identify the incident, affected released revision and smallest corrective change. Adapt review and observation timing proportionately while retaining authorization, tested artifact identity and recovery evidence. A flag may reduce exposure when its refresh behavior fits the incident, but it does not remove vulnerable code or undo corrupted data.

Carry the fix into both the affected release line and the future development line. Use focused PRs or selective cherry-picks rather than merging unrelated release changes into main. If identical text cannot apply, review the equivalent correction in each line; textual similarity alone does not prove equivalent behavior. Run relevant regression/deployment checks, observe production behavior, record emergency adaptations, restore ordinary controls and reconcile branches.

Before release, identify which state is reversible: application artifact, configuration, traffic, schema and persisted data are separate. Retain known-good artifact/configuration inputs. Decide who can halt expansion, what evidence triggers a pause, whether recovery disables a feature, returns traffic, restores bytes or moves forward, and how its result will be verified.

For an illustrative stateful release, add a compatible field, keep old readers working and postpone destructive removal. If new code writes incompatible data, returning traffic to old code can worsen the incident. The deciding condition is current state compatibility, not availability of a rollback button. Rehearse the procedure in an authorized controlled environment; a documentary plan is not proof of restore/failover success. Repeated retries of partial, nonidempotent changes need reconciliation first.

## Match deployment tasks to artifact and target

A container deployment needs an exact image identity, registry access, cluster/namespace and rollout verification. A binary package needs a supported archive and existing application/slot. A script needs an explicit working directory, inputs, identity, exit behavior and repeatability. Database changes additionally require reviewed schema/data actions and independently valid network and database access.

For an existing Linux App Service with an approved package already downloaded into this job, a documentary task example is:

```yaml
- task: AzureWebApp@1
  inputs:
    azureSubscription: approved-service-connection
    appType: webAppLinux
    appName: existing-app
    package: '$(Pipeline.Workspace)/drop/app.zip'
```

Replace the connection, application and package path with verified inputs. For a nonproduction slot, explicitly set the supported slot flag, resource group and existing slot name. A missing-package failure calls for checking publication and current-job download. A nested MSBuild web package is not a filesystem ZIP suitable for zipDeploy; renaming it does not change its structure. Use a supported packaging/deployment route and preserve TLS verification.

In the cited contract, `SqlAzureDacpacDeployment@1` is Windows-specific. Select `DacpacTask`, `SqlTask` or `InlineSqlTask` and the intended action. **Publish** changes the database; **Script** and **DeployReport** produce previews. Supply the actual server/database, approved authentication and DACPAC/script path. Integrated authentication uses the agent's current AD account, not its registration identity. A valid credential cannot overcome missing private-endpoint/network access. The GitHub SQL action has its documented Windows/Linux tool paths, and a best-effort report is not a guarantee of later publish safety.

For Kubernetes manifest tasks, supply the accepted image, retain traceability and wait for rollout checks. An accepted API submission is an intermediate state, not application readiness. `continueOnError` changes downstream outcome interpretation; retry settings do not add idempotency. Inspect partial script/database state before replaying an uncertain operation. No target was modified by the examples in this lesson.

## Summary

Choose exposure controls around health, usage and state compatibility. Make deployment dependencies explicit and carry the same tested artifact through them. Readiness probes, slot swaps and rollout status each have limited scope. An executable recovery or hotfix path retains the identities, authority and observed outcomes needed to establish whether service was actually restored.
