AI-200 Cheat Sheet
Develop containerized solutions on Azure
Manage container images in Azure Container Registry
Read full chapterCheat sheet
Sharp facts the exam loves — scan these before test day.
- Image digests are immutable, content-addressable identifiers
A manifest digest is a unique SHA-256 hash of the image's manifest, and every image or artifact, tagged or not, has its own, so referencing an image as repository@sha256:... always resolves to the exact same build even if a tag is later moved. Deploying by digest guarantees predictable, immutable image selection.
Trap Assuming a version-string tag is just as immutable as a digest.
9 questions test this
- Your compliance process requires evidence that the image running in an Azure Kubernetes Service production namespace is the exact artifact your image scan approved. The scan was run against a reposito
- You promote a validated image from a development Azure Container Registry to a production registry by using the registry's import capability. The development pipeline keeps repushing its version tags
- In an Azure Container Registry repository, a single manifest currently carries the tags v3, latest, and beta. QA asks you to stop the beta name from resolving so that no pipeline can pull the image un
- You operate a Python inference API on Azure Container Apps that pulls its image from Azure Container Registry. A regression appears hours after a release, and the release record identifies the build t
- Your team deploys an Azure Container Apps microservice from Azure Container Registry, and the app scales out to several replicas that pull the image at different moments. Every replica must run identi
- A build pipeline has repushed the same tag in an Azure Container Registry repository for months, and registry storage keeps growing even though the repository lists only a handful of tags. You must re
- A production Azure Kubernetes Service workload runs an image that your registry stores under the tag 2026.03.14. You must stop the release pipeline from overwriting or deleting that specific image, wh
- A nightly ACR task repushes the same tag, and your registry has filled with orphaned manifests. You plan to enable automatic cleanup of untagged manifests, but the Azure Kubernetes Service deployments
- An ACR task builds your application image on every source commit and has run successfully many times. Its Dockerfile FROM statement references a base image in the same registry by a unique per-build t
- Tags are mutable pointers that can be reassigned
An ACR tag, including a version-looking tag such as v1.2, can be repushed to point at a different manifest at any time, so deploying by tag does not guarantee a reproducible build.
12 questions test this
- Your team deploys an Azure Container Apps API from Azure Container Registry, and the container template always references the image with the latest tag. Operators cannot tell which commit a running re
- Your compliance process requires evidence that the image running in an Azure Kubernetes Service production namespace is the exact artifact your image scan approved. The scan was run against a reposito
- A developer pushed a test build from a workstation to your Azure Container Registry repository without specifying a tag in the push command. Shortly afterwards, the Azure Container Apps job that pulls
- You promote a validated image from a development Azure Container Registry to a production registry by using the registry's import capability. The development pipeline keeps repushing its version tags
- In an Azure Container Registry repository, a single manifest currently carries the tags v3, latest, and beta. QA asks you to stop the beta name from resolving so that no pipeline can pull the image un
- You operate a Python inference API on Azure Container Apps that pulls its image from Azure Container Registry. A regression appears hours after a release, and the release record identifies the build t
- Your team deploys an Azure Container Apps microservice from Azure Container Registry, and the app scales out to several replicas that pull the image at different moments. Every replica must run identi
- A build pipeline has repushed the same tag in an Azure Container Registry repository for months, and registry storage keeps growing even though the repository lists only a handful of tags. You must re
- A production Azure Kubernetes Service workload runs an image that your registry stores under the tag 2026.03.14. You must stop the release pipeline from overwriting or deleting that specific image, wh
- An ACR task builds your Python service image, and its Dockerfile FROM statement references python:latest in a public registry. Two requirements now apply: the build must not move to a new major runtim
- A nightly ACR task repushes the same tag, and your registry has filled with orphaned manifests. You plan to enable automatic cleanup of untagged manifests, but the Azure Kubernetes Service deployments
- An ACR task builds your application image on every source commit and has run successfully many times. Its Dockerfile FROM statement references a base image in the same registry by a unique per-build t
- The latest tag floats to the most recent push that carries it
The latest tag is simply the tag Docker and the registry assume when a command names none, so it moves only when a push actually carries it and not whenever any newer image is pushed. Because it is reused rather than unique it is a stable tag, and Microsoft's tagging guidance is to avoid deploying from stable tags because they keep receiving updates.
Trap Believing latest always points to the highest semantic version.
5 questions test this
- Your team deploys an Azure Container Apps API from Azure Container Registry, and the container template always references the image with the latest tag. Operators cannot tell which commit a running re
- A developer pushed a test build from a workstation to your Azure Container Registry repository without specifying a tag in the push command. Shortly afterwards, the Azure Container Apps job that pulls
- Your team deploys an Azure Container Apps microservice from Azure Container Registry, and the app scales out to several replicas that pull the image at different moments. Every replica must run identi
- An ACR task builds your Python service image, and its Dockerfile FROM statement references python:latest in a public registry. Two requirements now apply: the build must not move to a new major runtim
- A nightly ACR task repushes the same tag, and your registry has filled with orphaned manifests. You plan to enable automatic cleanup of untagged manifests, but the Azure Kubernetes Service deployments
- Unique per-build tags enable traceable rollback
Best practice is to tag each build with a unique value such as a build ID or Git commit hash, so any deployed version is traceable and you can roll back to an exact, unchanged image.
7 questions test this
- You run a Python scoring API on Azure Kubernetes Service with cluster autoscaling enabled, and its deployment references an image in Azure Container Registry by a tag that the release pipeline reuses
- Your Azure Kubernetes Service deployments reference their images in Azure Container Registry by manifest digest, and the registry is close to its storage limit. You plan to enable automated cleanup of
- Two teams push AI service images into one shared Azure Container Registry: the API team builds with Jenkins and the web team builds with Azure Pipelines. Both systems emit incrementing build numbers w
- A production revision of your Azure Container Apps AI service is failing. Every image the pipeline has pushed to Azure Container Registry carries a unique tag that contains the build number, and no ta
- Your platform team publishes a shared Python base image that application teams reference in their Dockerfiles, and it must keep receiving security servicing under the same reference. The application t
- You develop a Python inference API that an Azure Pipelines workflow builds and pushes to Azure Container Registry before deploying it to Azure Container Apps. After a bad release, the team must identi
- Your team builds a Python container image with a multi-step ACR task that is triggered both by commits to the main branch and by base image updates. Every run must push the image under a tag that no e
- Stable tags roll forward for base-image patching
A stable tag such as major.minor is deliberately re-pointed to the newest patched build so images that consume it pick up OS and framework fixes; it trades reproducibility for automatic patching and is typically used on base images, not deployments.
- Locking a tag or manifest prevents overwrite or delete
Running az acr repository update against one tag (--image myrepo:tag) or manifest digest (--image myrepo@sha256:...) sets that image's lock attributes: --write-enabled false makes it immutable so it can be neither overwritten nor deleted, while --delete-enabled false blocks only deletion and still allows the image to be updated. Locking a released production image protects it from accidental change.
Trap Assuming --delete-enabled false also stops the image from being overwritten.
6 questions test this
- You release a Python model-serving image from Azure Container Registry to Azure Container Apps. Another team's pipeline has twice pushed different content under the tag that your production revision r
- A security scan flags one released AI inference image version already stored in Azure Container Registry as containing a vulnerable library. Until the investigation closes, no cluster or app may pull
- Your registry has the untagged-manifest retention policy enabled. One production deployment still pulls an image by manifest digest, and that manifest became untagged when the release pipeline moved i
- A release engineer protected the production tag of an AI gateway image in Azure Container Registry by setting delete-enabled to false on that tag and confirmed the attribute. A cleanup script that add
- A compliance rule states that the container image behind your production AI endpoint must never be removed from Azure Container Registry, while the platform team still needs to push corrected content
- Your organization keeps a repository of released, audited AI runtime images in Azure Container Registry. Every image currently in that repository must be protected from being overwritten or deleted, a
- az acr import copies images server-side without Docker
az acr import pulls an image from another registry (Docker Hub, MCR, or another ACR) directly into the target registry, so it needs no local Docker daemon and no docker pull followed by docker push.
Trap Thinking the image has to be pulled locally and pushed again to land in the target registry.
10 questions test this
- A release pipeline uses a managed identity to import images from a shared base-image registry into your team's Azure Container Registry, and both registries are in the same Microsoft Entra tenant. The
- Your team runs an AI orchestration component on Windows containers, but every workstation and pipeline host in the environment runs Linux and has no container runtime installed. A Windows Server Core
- A vendor hosts a validated retrieval model image in a private non-Azure container registry and gives you a user name and access token with pull rights, plus the digest of the exact build your complian
- A release step imports a very large model-serving image from a partner Azure Container Registry into your production registry in the same tenant. The step must not hold the release pipeline open while
- You are standardizing on an official multi-architecture image from Docker Hub for an inference sidecar that must run on both AMD64 and ARM64 node pools. The image must be served from your Azure Contai
- Your production Azure Container Registry was recently moved behind a private endpoint, and a hardening change disabled its firewall exceptions. Imports from the development registry that previously su
- Your platform team stores the Helm 3 chart that deploys your inference API as an OCI artifact in a staging Azure Container Registry. The identical chart artifact must be published to the production re
- A partner organization publishes a model-serving image in an Azure Container Registry that belongs to a different Microsoft Entra tenant from yours. Your identity has no role assignment in that tenant
- You import images from a shared source Azure Container Registry that lives in another subscription in the same Microsoft Entra tenant. Security has just disabled public network access on that source r
- You develop a Python inference service that must be built on a Microsoft-published base image. Your continuous integration agents run a hardened OS image with no Docker Engine installed, no daemon may
- Import by digest to preserve an exact build
Importing with source repository@sha256:... rather than by tag copies a specific immutable manifest, guaranteeing the imported image is byte-identical to the intended source build.
Trap Assuming az acr import only works with publicly accessible source images.
5 questions test this
- A vendor hosts a validated retrieval model image in a private non-Azure container registry and gives you a user name and access token with pull rights, plus the digest of the exact build your complian
- Your QA team signs off on a specific build of an inference API image that sits in a development Azure Container Registry under the stable tag 2.4, a tag the build system reassigns whenever it services
- Your governance policy states that images promoted into the production Azure Container Registry must never carry a human-assigned tag, so that deployments can reference them only by content address. Y
- Your team imports a public Python base image from Docker Hub into Azure Container Registry with each release, always naming the tag 3.12-slim. Auditors report that two releases built from identical ap
- A regression reaches production after a base-image refresh. The previous, known-good build is still in the source Azure Container Registry, but the tag that once pointed to it was reassigned to the ne
- Deleting a tag leaves the manifest consuming storage
Removing or overwriting a tag does not delete the underlying manifest and layers; the resulting untagged (dangling) manifest keeps consuming registry storage until it is explicitly purged.
Trap Thinking that untagging an image reclaims its storage.
8 questions test this
- Your team's build pipeline pushes a Python API image to an Azure Container Registry repository under the same stable tag several times a day. The repository still lists a single tag, yet the registry'
- You are auditing an Azure Container Registry before a cost review. The Azure portal's repository view lists only a handful of tags per repository, but the registry consumes far more storage than those
- An Azure Container Registry holds several Python model-serving images that were all built from the same base image. You delete one untagged manifest whose image size is reported as roughly two gigabyt
- You are cleaning up an Azure Container Registry repository that holds test builds of a document-ingestion service. You need one operation that removes a specific test image, frees the layers unique to
- A Premium Azure Container Registry has accumulated years of untagged manifests from stable-tag rebuilds. You enable the untagged-manifest retention policy and wait past the retention period, but the o
- You schedule an acr purge task that removes tags older than a set age from your Azure Container Registry's development repositories. The task reports many deleted tags each week, yet the registry's st
- You plan to schedule automatic deletion of untagged manifests in an Azure Container Registry that serves an AI inference platform, but several AKS deployments pin images by manifest digest rather than
- You maintain an Azure Container Registry that backs a Python inference service. To cut storage cost, a colleague removed the tags from dozens of obsolete builds, but the registry overview still report
- acr purge and retention policies remove stale images
An acr purge command, usually run as a scheduled ACR Task, deletes tags that match a repository and tag regex (--filter) and are older than a duration (--ago), and by default it removes only the tag references, so --untagged is needed to delete the dangling manifests too. A Premium-tier retention policy is the filter-free alternative, automatically deleting every untagged manifest a set number of days after it becomes untagged.
Trap Expecting a plain acr purge to reclaim the manifests behind the tags it deleted.
9 questions test this
- Your Premium Azure Container Registry stores both Docker container images and OCI artifacts such as the Helm charts that your AI deployment pipeline pushes. The registry's untagged-manifest retention
- Your organization wants Azure Container Registry to delete untagged manifests automatically a fixed number of days after they lose their tags, as a registry-wide setting with no task, schedule, or fil
- Your team stores development images for an AI service in an Azure Container Registry, and the repositories fill with builds that nobody deploys. You need registry cleanup to run every week with no sou
- A Premium Azure Container Registry has the untagged-manifest retention policy enabled. One base image manifest is intentionally untagged and is pulled by digest by several build pipelines, so it must
- You are cleaning up an Azure Container Registry repository that holds test builds of a document-ingestion service. You need one operation that removes a specific test image, frees the layers unique to
- A Premium Azure Container Registry has accumulated years of untagged manifests from stable-tag rebuilds. You enable the untagged-manifest retention policy and wait past the retention period, but the o
- You schedule an acr purge task that removes tags older than a set age from your Azure Container Registry's development repositories. The task reports many deleted tags each week, yet the registry's st
- You plan to schedule automatic deletion of untagged manifests in an Azure Container Registry that serves an AI inference platform, but several AKS deployments pin images by manifest digest rather than
- You maintain an Azure Container Registry that backs a Python inference service. To cut storage cost, a colleague removed the tags from dozens of obsolete builds, but the registry overview still report
- Soft delete allows recovery of deleted artifacts
When the soft-delete policy is enabled, deleted manifests and tags are retained for a configurable window and can be restored before they are permanently removed.
Build and run images with ACR Tasks
Read full chapterCheat sheet
Sharp facts the exam loves — scan these before test day.
- az acr build builds in the cloud and pushes automatically
az acr build submits the build context to a quick task that builds the image on ACR-managed compute and pushes it to the registry, so no local Docker engine is required to produce and store an image.
Trap Assuming az acr build needs Docker installed on the developer machine.
6 questions test this
- Your team is about to add an automated registry task that will rebuild an embeddings service image on every commit to the main branch. Before anyone commits the reworked Dockerfile, the lead wants evi
- You build a Python API image with an ACR Tasks quick build. Before deploying the service to Azure Container Apps, the team wants to execute that image once, straight from the registry, to confirm its
- You develop a Python retrieval service whose container image installs wheels from your company's private package index. The image is built on demand in Azure Container Registry from a local context, a
- You maintain a document-ingestion worker image that developers build locally and then publish to Azure Container Registry as a separate manual step, which is regularly forgotten. The team wants a sing
- Your team builds several Python microservice images from hand-tuned multi-stage Dockerfiles on local machines. Management wants those builds moved into Azure so they run on managed compute close to th
- A developer must reproduce a bug reported against a retrieval service by building a one-off image in Azure from a local working copy. The build has to run immediately, must not leave a persistent task
- az acr task run executes a defined task on demand
az acr task run triggers an already-created task immediately, independent of its automatic triggers, which is useful for validating a task definition before wiring up commit or base-image triggers.
- az acr build takes a build context plus --file and --platform
The positional argument of az acr build is the build context, which may be a local folder (uploaded as a tarball, honoring .dockerignore), a remote Git URL such as https://github.com/org/repo.git#branch:folder, or the URL of a remote tarball; -f/--file names the Dockerfile relative to that context rather than requiring it at the context root. --platform Linux/arm64 targets an architecture other than the default Linux/amd64, and --no-push compiles the image for validation without publishing it to the repository.
Trap Assuming the Dockerfile must sit at the root of the supplied context and be named exactly Dockerfile.
7 questions test this
- Your organization hosts its source in GitLab and wants Azure Container Registry to build a service image whenever a developer pushes to the release branch. A colleague proposes creating a registry tas
- Your pull request pipeline must confirm that a proposed change to the ingestion service Dockerfile still produces a working image. The check runs on every pull request, and the resulting image must ne
- Your team maintains a legacy Windows-based batch worker alongside its Python services and needs its container image built in Azure Container Registry rather than on a local machine. The Dockerfile dec
- You develop a Python retrieval service whose container image installs wheels from your company's private package index. The image is built on demand in Azure Container Registry from a local context, a
- You build a Python inference sidecar image with an ACR Tasks quick build and deploy it to ARM64-based Azure compute. Colleagues report that the image produced by the current build refuses to start on
- A quick build of your Python service succeeds on a developer workstation but fails in Azure Container Registry. The Dockerfile runs a step that reads the repository's .git folder to stamp the commit h
- You develop a monorepo whose services share a common Python package at the repository root. The container definition for the scoring service lives in a services/scoring folder and is named scoring.Doc
- Base-image update trigger rebuilds on FROM dependency change
A base-image-update trigger tracks the image referenced in the Dockerfile FROM instruction and automatically rebuilds the dependent image whenever that base OS or runtime image is updated in the registry, enabling automated patching.
Trap Choosing a schedule trigger to react to base-image updates.
13 questions test this
- Your platform team publishes a hardened Python base image and pushes each monthly patch under a brand-new version tag such as 3.11-secure-2026-05. Application Dockerfiles are edited by hand to the new
- When the base image behind your retrieval-augmented generation API is patched, the team must rebuild the image, run a container that executes functional tests against it, and push the image only after
- An Azure Container Registry task builds your API image and tags it with the Git commit hash of the build context. After the base image is patched, the task rebuilds from that same commit and pushes an
- Your team maintains an Azure Container Registry task for a document-embedding service. The task's base image trigger is enabled and the task has already run successfully several times, but patched bas
- A regulated model-serving image must stay on the exact base image that passed validation until the compliance team approves a new one, while builds from code commits must continue for the same task. T
- Your platform team keeps one hardened Python base image in a dedicated Azure container registry in West Europe, while each application team builds its inference API image in its own registry in East U
- You create an Azure Container Registry task that builds your Python inference API image from a Dockerfile whose FROM instruction references a base image in the same registry. Your team pushes a patche
- You develop a containerized Azure Functions worker whose Dockerfile pulls its base image directly from a public Docker Hub repository. An Azure Container Registry task rebuilds the worker when that ba
- Your Azure Kubernetes Service deployment of an inference API must always pull the exact image build that was tested, yet the image must also be rebuilt automatically whenever its base runtime image re
- A team wants one Azure Container Registry task for its embedding service image to rebuild in three situations: when code is merged to the main branch, when the base image is patched in the registry, a
- A base image update starts a rebuild of your Azure Container Registry task at 02:00 and the run fails. When you rerun the task manually the next morning it succeeds, so you cannot reproduce the failur
- An Azure Container Registry task builds your retrieval service image on Git commits and on base image updates. After a nightly OS patch, a new image appears in the registry although nobody merged code
- Your release pipeline builds each image with an on-demand Azure Container Registry quick task, which builds the image in the cloud and pushes it to the registry. The security team asks that images als
- Base-image tracking follows a stable tag, not a digest
Base-image update triggers depend on the FROM instruction referencing a stable tag; if the Dockerfile pins its base image by digest, that base can never change and the trigger will never fire.
Trap Pinning the base image by digest and still expecting the base-image update trigger to fire.
5 questions test this
- Your platform team publishes a hardened Python base image and pushes each monthly patch under a brand-new version tag such as 3.11-secure-2026-05. Application Dockerfiles are edited by hand to the new
- An Azure Container Registry task builds your API image and tags it with the Git commit hash of the build context. After the base image is patched, the task rebuilds from that same commit and pushes an
- Your team maintains an Azure Container Registry task for a document-embedding service. The task's base image trigger is enabled and the task has already run successfully several times, but patched bas
- Your Azure Kubernetes Service deployment of an inference API must always pull the exact image build that was tested, yet the image must also be rebuilt automatically whenever its base runtime image re
- Your Dockerfile starts with FROM python:latest, and an Azure Container Registry task rebuilds the image whenever that tag is updated in the registry. Twice this year a rebuild moved the service onto a
- Source-commit trigger fires from a Git webhook
Creating a task with a Git context registers a webhook on the linked GitHub or Azure Repos repository and rebuilds the image on each commit to the tracked branch, because --commit-trigger-enabled defaults to True. The pull-request trigger is a separate trigger on the same context and is disabled by default until you pass --pull-request-trigger-enabled true.
Trap Expecting a commit trigger to also react to base-image updates.
9 questions test this
- You develop a Python inference API whose container image is built by an Azure Container Registry task. The image must be rebuilt and pushed automatically every time a developer merges code into the tr
- An Azure Container Registry task rebuilds your retrieval service image on every commit to the tracked branch. Compliance now requires a fresh build of the same image every night, including days when n
- Your team's Azure Container Registry task builds a model-serving image from a GitHub repository, and its context pins the release branch. Developers now merge daily work into a long-lived develop bran
- Your organization hosts its Python service code in GitHub Enterprise, and image builds must run in Azure Container Registry rather than on self-managed agents. You try to create a task with a source c
- A release freeze starts tomorrow. During the freeze, commits to the tracked GitHub branch must not produce new images in Azure Container Registry, but the security team still requires the production i
- A colleague configured an Azure Container Registry webhook that posts to a deployment service, expecting it to rebuild your agent image whenever code lands in the GitHub repository. Nothing rebuilds a
- You maintain an Azure Container Registry task that rebuilds a Python scoring image whenever code is committed to the tracked GitHub branch. The task was created with the base image update trigger turn
- An Azure Container Registry task with a source commit trigger failed during the night after a teammate pushed to the tracked branch. This morning you rerun the task manually and it succeeds, so the st
- Your team keeps its Python agent code in Azure Repos rather than GitHub, and it wants Azure Container Registry to rebuild and push the container image whenever code is committed to the tracked branch,
- Git-triggered tasks need a repository access token
Creating a source-triggered task requires a Git personal access token so ACR can set the webhook and read the source repository. The required GitHub scopes depend on visibility: repo:status plus public_repo for a public repository, and full repo control for a private one; on Azure DevOps the required scope is Code (Read).
- The --context fragment pins which branch and folder a task watches
az acr task create --context https://github.com/org/repo.git#main:src binds the definition to exactly one branch (#main) and one subfolder (:src), so a push to any other branch is ignored even though the webhook exists. az acr task list-runs --registry --name then lists past executions with their TRIGGER column (Commit, Manual, Image Update, or Timer), which is how you confirm what actually started a given run.
Trap Expecting a task pinned to main to fire when a feature branch is pushed.
7 questions test this
- An Azure Container Registry task rebuilds your retrieval service image on every commit to the tracked branch. Compliance now requires a fresh build of the same image every night, including days when n
- To make builds reproducible, a colleague created your Azure Container Registry task with a context that pins a specific commit hash in the GitHub repository. Builds now produce an identical image ever
- Your team's Azure Container Registry task builds a model-serving image from a GitHub repository, and its context pins the release branch. Developers now merge daily work into a long-lived develop bran
- Your monorepo on GitHub holds several services, and the retrieval service you own lives in a subfolder with its own Dockerfile. You create an Azure Container Registry task pinned to the main branch, a
- An unexpected image tag appears in your Azure Container Registry overnight. The registry hosts one task that has a source commit trigger on a GitHub branch, a base image update trigger, and a nightly
- Your Azure Container Registry task has built an embedding service image on every commit for months. After a repository restructure, the team retires the branch the task was created against and merges
- An Azure Container Registry task with a source commit trigger failed during the night after a teammate pushed to the tracked branch. This morning you rerun the task manually and it succeeds, so the st
- Timer trigger runs a task on a cron schedule
A scheduled (timer) trigger runs the task on a fixed cron schedule regardless of source or base-image changes, which suits periodic rebuilds or a recurring purge job but cannot guarantee a rebuild at the moment a dependency changes.
Trap Using a schedule trigger when the requirement is to rebuild exactly when a base image changes.
8 questions test this
- A multi-step acr-task.yaml file that builds, tests, and pushes your Python service image is run on demand today. Management wants the full workflow to run every night at a fixed hour with nobody signe
- You have just created a task in Azure Container Registry that runs a maintenance container on a daily timer trigger. Before you leave the change in place, you must confirm that the task definition act
- You operate a shared Azure Container Registry for a Python AI platform team. Continuous integration pushes dozens of build tags every day, and storage growth is now a cost concern. The registry must b
- Your team maintains a Python inference image whose Dockerfile references a hardened base image stored in the same Azure Container Registry. A nightly timer-triggered task currently rebuilds the infere
- You support a production Python API image that is already deployed from Azure Container Registry. Site reliability engineers want a containerized smoke test executed against that production image at r
- A Python microservice image is rebuilt every night by a timer-triggered task in Azure Container Registry. Developers merge to the main branch several times a day and complain that a merged fix waits u
- A registry maintenance container in Azure Container Registry must run twice a day, early in the morning and again in the middle of the afternoon, and the two runs are not evenly spaced. Operations wan
- Your team in Berlin creates a task in Azure Container Registry that rebuilds a Python service image every night. The cron expression was written for the intended local time, but the run history shows
- Multi-step tasks define build, push, and cmd steps in YAML
A multi-step task uses an acr-task.yaml file to run ordered build, push, and cmd steps (for example build the image, run tests, then push) within a single task execution.
8 questions test this
- A multi-step acr-task.yaml file that builds, tests, and pushes your Python service image is run on demand today. Management wants the full workflow to run every night at a fixed hour with nobody signe
- A multi-step task in Azure Container Registry starts a Python API container in a detached cmd step and then runs a separate test container in a later cmd step. The test container must send HTTP reques
- A multi-step task in Azure Container Registry builds a Python application image and a separate test-runner image. The test-runner image is used only inside the task run to exercise the application, an
- You support a production Python API image that is already deployed from Azure Container Registry. Site reliability engineers want a containerized smoke test executed against that production image at r
- Your team builds a Python API container image in Azure Container Registry. A containerized functional test suite must run against the newly built image, and the image must reach the registry only when
- A developer converts a single-image build into a multi-step task defined in an acr-task.yaml file that contains a build step and a cmd step running unit tests. The run finishes successfully and the lo
- A multi-step task in Azure Container Registry builds an application image and an independent test-tooling image, then pushes both. The two builds do not depend on each other, yet the run takes far lon
- In a multi-step task in Azure Container Registry, one cmd step runs a Python test container that writes a coverage report file, and a later cmd step runs a different container that must read that repo
Deploy containers to Azure App Service
Read full chapterUnlock with Premium — includes all practice exams and the complete study guide.
Deploy applications to Azure Container Apps
Read full chapterUnlock with Premium — includes all practice exams and the complete study guide.
Event-driven scaling with KEDA
Read full chapterUnlock with Premium — includes all practice exams and the complete study guide.
Deploy to AKS with manifest files
Read full chapterUnlock with Premium — includes all practice exams and the complete study guide.
Monitor and troubleshoot AKS and Container Apps
Read full chapterUnlock with Premium — includes all practice exams and the complete study guide.
Develop AI solutions by using Azure data management services
Connect to and query Azure Cosmos DB for NoSQL with the SDK
Read full chapterCheat sheet
Sharp facts the exam loves — scan these before test day.
- CosmosClient is the SDK entry point, built from the account endpoint plus a credential and reused for the app lifetime
The azure-cosmos CosmosClient is constructed from the account URI and a credential — either the account key/resource token or a Microsoft Entra token via DefaultAzureCredential. A single CosmosClient is thread-safe and should be created once and reused, because per-request clients waste connections and warm-up cost.
Trap Constructing a fresh CosmosClient per request instead of reusing one for the app's lifetime.
5 questions test this
- Your team ports a latency-sensitive retrieval component from .NET to Python. The .NET version used direct connectivity, and the Python version now shows noticeably higher per-request latency against t
- A Python service reads and writes items in a multi-region Azure Cosmos DB for NoSQL account. To pin traffic to the closest replica, a developer hardcoded a region-specific endpoint hostname into the C
- You develop a Python retrieval API that runs on Azure Container Apps and reads document chunks from Azure Cosmos DB for NoSQL. Under load, replicas exhaust outbound sockets and p99 latency spikes, and
- You build a Python Azure Function app that stores conversation history in Azure Cosmos DB for NoSQL. Governance requires that no account key appear in source control, in application settings, or in a
- Your Python service runs in West US and East US against an Azure Cosmos DB for NoSQL account replicated to both regions. Each instance lists its own region first in the client's preferred regions, yet
- Item operations with Microsoft Entra ID require a Cosmos DB data-plane RBAC role, not just a management role
Passing DefaultAzureCredential authenticates with Entra ID, but reading or writing items also requires a Cosmos DB data-plane role assignment (for example Cosmos DB Built-in Data Reader or Data Contributor) scoped to the account. Azure RBAC management roles such as Contributor grant control-plane access only and do not authorize data operations.
Trap Owner/Contributor on the account does not grant data-plane read/write; you must assign a Cosmos DB built-in data role.
4 questions test this
- You deploy a Python API to Azure Container Apps that reads and writes items in Azure Cosmos DB for NoSQL by using DefaultAzureCredential and the app's system-assigned managed identity. The identity al
- A Python worker on Azure Container Apps authenticates to Azure Cosmos DB for NoSQL with its managed identity, which holds the Cosmos DB Built-in Data Contributor role at account scope. Item reads and
- You build a Python Azure Function app that stores conversation history in Azure Cosmos DB for NoSQL. Governance requires that no account key appear in source control, in application settings, or in a
- A read-only retrieval service for a RAG assistant runs on Azure App Service and queries an Azure Cosmos DB for NoSQL container with its managed identity. Least privilege requires that the service run
- Cosmos SDKs connect in Gateway (HTTPS) or Direct (TCP) mode; the Python SDK uses Gateway mode
Gateway mode routes every request through the account's HTTPS gateway on port 443, which is firewall-friendly, while Direct mode opens TCP connections straight to backend replicas for lower latency and higher throughput. The .NET and Java SDKs support both modes; the Python and JavaScript SDKs operate in Gateway mode.
Trap Expecting to switch the Python SDK into Direct mode for lower latency.
3 questions test this
- Your team ports a latency-sensitive retrieval component from .NET to Python. The .NET version used direct connectivity, and the Python version now shows noticeably higher per-request latency against t
- Two workloads share one Azure Cosmos DB for NoSQL account: a Python retrieval API on Azure Container Apps, and a .NET bulk ingestion job on Azure Kubernetes Service that must sustain the highest write
- You containerize a Python ingestion service that writes embeddings to Azure Cosmos DB for NoSQL. The service runs on a customer-managed network whose egress firewall permits only outbound HTTPS to the
- Enabling multi-region (multi-master) writes on CosmosClient
Multi-region writes are enabled at the ACCOUNT level, and the client must then opt in as well. Microsoft's Python instruction is to set multiple_write_locations=True in the client initialization AND set preferred_locations to the regions the data is replicated into, ordered by preference: CosmosClient(url, credential, multiple_write_locations=True, preferred_locations=['West US','East US']). enable_endpoint_discovery defaults to True, so the SDK routes to the first available region in that list and falls back across regions on a regional event. You order the list yourself, shortest distance or best latency first; it is .NET's ApplicationRegion that auto-populates preferred locations by geo-proximity, not the Python argument.
Trap Enabling multiple write regions rules out Strong consistency (a multi-write account supports at most Bounded Staleness), and the conflict-resolution policy reconciles concurrent writes but does NOT do the region routing.
3 questions test this
- A Python service reads and writes items in a multi-region Azure Cosmos DB for NoSQL account. To pin traffic to the closest replica, a developer hardcoded a region-specific endpoint hostname into the C
- Your Python service runs in West US and East US against an Azure Cosmos DB for NoSQL account replicated to both regions. Each instance lists its own region first in the client's preferred regions, yet
- You plan to enable multi-region writes on an Azure Cosmos DB for NoSQL account that currently uses Strong consistency and backs a Python chat service deployed to East US and West Europe. After the cha
- The SDK models the account → database → container hierarchy as client-side proxy objects
From a CosmosClient you obtain a DatabaseProxy via get_database_client(db_id) and a ContainerProxy via get_container_client(container_id); these proxies are lightweight client-side references to a named resource. Obtaining one does not confirm the resource is there: Microsoft describes a DatabaseProxy as an interface to a database that could, or couldn't, exist in the service yet, so a mistyped database or container name surfaces only when you call a real operation on the proxy.
Trap Treating a returned ContainerProxy as proof the container actually exists.
3 questions test this
- Your team runs a Python API on Azure App Service that stores conversation history in Azure Cosmos DB for NoSQL. Each request handler constructs a CosmosClient, then obtains a database client and a con
- You develop a Python worker that is deployed to development, test, and production environments. At startup the worker must guarantee that its Azure Cosmos DB for NoSQL database and container exist bef
- You develop a Python Azure Function that must create and read individual telemetry documents in an existing Azure Cosmos DB for NoSQL container named readings, which lives in a database named telemetr
- Each container has a partition key path whose value routes point operations and scopes queries
A container is created with a partition key path (for example /customerId), and each item's value at that path determines its logical partition. The SDK uses the partition key to route point reads and writes to the owning partition and to confine a query to a single physical partition when supplied.
6 questions test this
- You develop a Python service on Azure Container Apps that renders an order-details page from an Azure Cosmos DB for NoSQL container partitioned on /customerId. The incoming page request already carrie
- You develop a Python worker that is deployed to development, test, and production environments. At startup the worker must guarantee that its Azure Cosmos DB for NoSQL database and container exist bef
- You develop a Python Azure Function that must create and read individual telemetry documents in an existing Azure Cosmos DB for NoSQL container named readings, which lives in a database named telemetr
- You develop a Python back-office tool for an Azure Cosmos DB for NoSQL container partitioned on /customerId. Support has found several invoice documents that were ingested under the wrong customer id,
- Your team is creating a new Azure Cosmos DB for NoSQL container for an energy retailer's meter readings. Its thousands of sites are grouped into four regions, and each site has many meters. Almost eve
- You operate a Python ingestion pipeline that writes to an Azure Cosmos DB for NoSQL container partitioned on /country. Most documents share one country value, that logical partition is nearing its sto
- The SDK raises typed exceptions such as CosmosResourceNotFoundError (404) and CosmosResourceExistsError (409)
Resource errors surface as typed exceptions — CosmosResourceNotFoundError for a missing item/container (HTTP 404) and CosmosResourceExistsError for a create conflict (HTTP 409) — so code branches on the exception type instead of parsing status codes. Convenience calls like create_container_if_not_exists absorb the 409.
- Optimistic concurrency with _etag and If-Match
Cosmos DB items carry a system _etag that changes on every write; to prevent a lost update, read the item, then issue a conditional replace passing that etag (the if-match request header, expressed in the current Python SDK as the etag keyword argument plus match_condition=MatchConditions.IfNotModified on replace_item or upsert_item). If another writer changed the item first, the server rejects the replace with HTTP 412 Precondition Failed and the app re-reads and retries. This is single-region item-level concurrency control, separate from the multi-region conflict-resolution policy.
- A point read (read_item by id and partition key) is the cheapest, lowest-latency single-item fetch
read_item(item=id, partition_key=pk) performs a point read that retrieves one item directly from its partition, typically costing about 1 RU for a 1-KB document. When you know both the id and the partition key, a point read is always preferable to a query.
Trap SELECT * FROM c WHERE c.id=@id runs the query engine and costs more RUs than an equivalent point read.
6 questions test this
- Your Python chat service loads a tenant's entire message history from Azure Cosmos DB for NoSQL with a SELECT * statement on every turn, then keeps only the newest few messages and one property from e
- You develop a Python chat API on Azure Container Apps that stores each user's conversation state in Azure Cosmos DB for NoSQL, partitioned by /userId, with the item id set to the session id. On every
- You operate a Python service that reads one Azure Cosmos DB for NoSQL item per request by id and partition key. After the team began embedding the full source PDF text and a base64 preview image insid
- Your Python claims service on Azure Container Apps reads claim-line documents from an Azure Cosmos DB for NoSQL container partitioned by /claimId. Each review task names about forty line ids that belo
- You must decide whether a Python microservice should fetch a single Azure Cosmos DB for NoSQL item with read_item or with an equivalent SQL query, and your architect wants measured evidence rather tha
- You develop a Python retrieval API that reads a few dozen policy documents from an Azure Cosmos DB for NoSQL container by item id and partition key. Those documents are read thousands of times a minut
- query_items runs a SQL query through the query engine and returns a paged iterator
container.query_items(query=..., parameters=...) executes a SQL query and returns a paged iterable of matching items. Queries engage the indexing and query engine and are billed per RU based on the work performed, which exceeds a point read when fetching a single known item.
Trap Reaching for query_items to fetch one item whose id and partition key are already known.
8 questions test this
- Your Python chat service loads a tenant's entire message history from Azure Cosmos DB for NoSQL with a SELECT * statement on every turn, then keeps only the newest few messages and one property from e
- You are building a Python operations console over an Azure Cosmos DB for NoSQL container of pipeline run records that uses the default indexing policy. An operator types the leading characters of a ru
- You develop a Python chat API on Azure Container Apps that stores each user's conversation state in Azure Cosmos DB for NoSQL, partitioned by /userId, with the item id set to the session id. On every
- Your Python claims service on Azure Container Apps reads claim-line documents from an Azure Cosmos DB for NoSQL container partitioned by /claimId. Each review task names about forty line ids that belo
- A Python reporting job runs a SQL query against Azure Cosmos DB for NoSQL that matches tens of thousands of items. Logs show several responses for that one query, each carrying a different RU charge,
- You must decide whether a Python microservice should fetch a single Azure Cosmos DB for NoSQL item with read_item or with an equivalent SQL query, and your architect wants measured evidence rather tha
- Your Python ingestion-audit service queries an Azure Cosmos DB for NoSQL container whose items each describe one processed document and carry three arrays: extracted entities, reviewer assignments, an
- You develop a Python retrieval API that reads a few dozen policy documents from an Azure Cosmos DB for NoSQL container by item id and partition key. Those documents are read thousands of times a minut
- Passing partition_key confines a query to one partition; omitting it fans out cross-partition
Supplying partition_key=value to query_items scopes execution to a single logical partition, which is cheaper and faster. Without it (or with enable_cross_partition_query=True in older SDKs) the query fans out to every physical partition, raising RU cost and latency.
Trap Omitting partition_key and still expecting the query to touch a single partition.
2 questions test this
- You maintain a document-retrieval API on Azure Cosmos DB for NoSQL. The container holds several million chunks partitioned by libraryId, and each request searches inside exactly one library. The retri
- Your Python claims service on Azure Container Apps reads claim-line documents from an Azure Cosmos DB for NoSQL container partitioned by /claimId. Each review task names about forty line ids that belo
- Parameterized SQL passes values via a parameters list, preventing SQL injection
You author queries with @-prefixed placeholders and pass a parameters list of {"name": "@id", "value": v} entries to query_items, with the leading @ included in the name. Parameterization avoids string concatenation and is what provides robust handling and escaping of user input, preventing accidental exposure of data through SQL injection. Query plans are cached on the CLIENT, not by the service, keyed on the SQL query string, which is why an unparameterized query misses that cache; Microsoft documents the cache as enabled by default for the Java SDK 4.20.0+ and Spring Data 3.13.0+, and the documented Python lever for skipping the query-plan call is passing partition_key instead.
Trap Believing the service caches query plans, so a concatenated SQL string costs no more than a parameterized one.
4 questions test this
- You build a Python service that queries an Azure Cosmos DB for NoSQL container of support articles. Each caller may supply a list of allowed article categories whose length varies from request to requ
- You develop a Python service for Azure Cosmos DB for NoSQL. A colleague converts a concatenated filter into a parameterized query: the query text references a placeholder for the tenant identifier, bu
- Your team exposes an internal API over an Azure Cosmos DB for NoSQL container of product embeddings. Callers pass both a search term and the number of top results they want back. The current code buil
- You develop a Python back end for a retrieval-augmented generation assistant that stores document chunks in Azure Cosmos DB for NoSQL. A search endpoint builds its filter from a category value typed b
- Cross-partition queries execute per-partition and merge into pages; in Python only streamable ones resume by continuation token
The SDK runs a cross-partition query as parallel sub-queries per physical partition and merges results into pages; a continuation token resumes the next page after the client stops iterating. ORDER BY and aggregates across partitions require the SDK to gather and merge partial results, and in the Python SDK those are exactly the queries continuation tokens do NOT cover: cross-partition tokens are supported for streamable queries such as SELECT * FROM c WHERE ..., while aggregate cross-partition queries (sorting, counting, distinct) do not support continuation tokens. Separately, no SDK supports continuation tokens for GROUP BY, or for DISTINCT without an ORDER BY.
Trap Expecting a continuation token to resume a cross-partition ORDER BY or aggregate query in Python.
4 questions test this
- You develop an Azure Functions worker that re-embeds documents read from an Azure Cosmos DB for NoSQL container with a cross-partition query. The worker's loop stops as soon as a page arrives carrying
- You develop a Python export endpoint on Azure Container Apps that pages a large Azure Cosmos DB for NoSQL container and returns a next-page link carrying the query's continuation token. On the widest
- You develop a timer-triggered Azure Functions worker in Python that builds a nightly per-tenant usage summary from a large Azure Cosmos DB for NoSQL container. The worker saves the continuation token
- You develop a stateless Azure Container Apps API that returns pages of documents from an Azure Cosmos DB for NoSQL container. Each HTTP request may land on a different replica, and a client that asks
- max_item_count bounds page size and each page reports its cost in x-ms-request-charge
max_item_count on query_items is an upper bound on the items returned per page: the engine returns that number of items or fewer, never more. A page can therefore come back short, or even empty, when throttling, response size, execution time, or the engine's own efficiency choices split the results further, so correct code drains every page instead of trusting one round trip. The RU cost of each page is reported in the x-ms-request-charge response header (read in Python from container.client_connection.last_response_headers) so query cost can be measured and tuned.
3 questions test this
- You develop an Azure Functions worker that re-embeds documents read from an Azure Cosmos DB for NoSQL container with a cross-partition query. The worker's loop stops as soon as a page arrives carrying
- You develop a Python export endpoint on Azure Container Apps that pages a large Azure Cosmos DB for NoSQL container and returns a next-page link carrying the query's continuation token. On the widest
- Your team exposes an internal API over an Azure Cosmos DB for NoSQL container of product embeddings. Callers pass both a search term and the number of top results they want back. The current code buil
- Cosmos SQL JOINs are intra-document self-joins that unwind arrays within a single item
A JOIN in Cosmos DB SQL unwinds arrays inside one document (intra-document), not rows across documents, and queries can project shaped results and call built-in functions such as STARTSWITH, ARRAY_CONTAINS, and VectorDistance.
Optimize Cosmos DB RUs with indexing policies and consistency levels
Read full chapterCheat sheet
Sharp facts the exam loves — scan these before test day.
- Request Units (RUs) are the normalized currency billed for every read, write, and query
A Request Unit abstracts the CPU, memory, and IOPS of an operation, so all reads, writes, and queries are charged in RUs against the container or database throughput. A point read of a 1-KB item is about 1 RU; writes and queries cost more depending on item size, indexed paths, and query complexity.
4 questions test this
- Your retrieval service fetches one chunk document from an Azure Cosmos DB for NoSQL container by running a SQL query that filters on the item id and on chunkGroup, the container's partition key. The a
- You measure the request-unit cost of a query issued by an Azure Cosmos DB for NoSQL SDK client. The query returns several thousand items, the SDK returns them across many pages, and each page reports
- You develop an ingestion job that writes chunked product documentation and its embeddings into an Azure Cosmos DB for NoSQL container. The job already uses the bulk executor library, the item payload
- You develop a Python chat service that reads grounding documents from an Azure Cosmos DB for NoSQL container. Every turn issues point reads by item id and partition key, and the account is configured
- Read x-ms-request-charge to measure the exact RU cost of any operation
Every Cosmos response carries the RUs consumed in the x-ms-request-charge header, exposed through the SDK's response headers. Reading it is the authoritative way to profile and optimize a specific read, write, or query rather than estimating cost.
Trap Estimating an operation's RU cost from item size instead of reading x-ms-request-charge.
2 questions test this
- You measure the request-unit cost of a query issued by an Azure Cosmos DB for NoSQL SDK client. The query returns several thousand items, the SDK returns them across many pages, and each page reports
- You profile a Python service that uses the Azure Cosmos DB for NoSQL SDK. Two candidate query shapes return the same grounding chunks, and you must choose between them on the exact request units each
- Throughput is provisioned as manual RU/s, autoscale, or serverless, each with different scaling behavior
You allocate throughput at the database or container level as manual (fixed RU/s), autoscale (scales automatically between 10% and a configured maximum), or serverless (pay per consumed RU with no provisioning). Autoscale fits spiky or unpredictable traffic; serverless fits low, intermittent workloads.
3 questions test this
- Your team is prototyping an AI assistant that stores conversation transcripts in Azure Cosmos DB for NoSQL. Traffic is intermittent and hard to forecast, the store sits idle for most of the month, the
- You deploy a production retrieval API whose Azure Cosmos DB for NoSQL container must be replicated to three Azure regions. Traffic spikes without warning during marketing campaigns and falls away over
- You design an Azure Cosmos DB for NoSQL database for an AI application. One container serves vector retrieval and needs throughput that is reserved for it alone and backed by the throughput SLA. Four
- Time to Live (TTL) auto-expires items using background RUs; -1 enables TTL with no default expiry
A container's DefaultTimeToLive governs automatic expiry: a positive value is the default item lifetime in seconds, -1 enables TTL so only items carrying their own ttl expire, and null/absent disables it. Expired items disappear from queries immediately and are purged by a background task: on a provisioned throughput account that purge uses leftover RUs that user requests did not consume, while on a serverless account it is charged in RUs at the same rate as delete operations.
- Cosmos DB integrated cache via dedicated gateway
The integrated cache serves repeated point reads and identical queries from an in-memory cache on a provisioned dedicated gateway at effectively 0 RU — the lever for cutting RU on read-heavy repeat traffic. It requires connecting through the dedicated-gateway endpoint (gateway connection mode) with session or eventual consistency, and a MaxIntegratedCacheStaleness window bounds how stale a cached response may be.
- Exceeding provisioned throughput returns HTTP 429 with an x-ms-retry-after-ms hint
When consumption exceeds the provisioned RU/s, Cosmos rejects the request with HTTP 429 (Request rate too large) and includes an x-ms-retry-after-ms header stating how long to wait before retrying. Sustained 429s indicate under-provisioned throughput or a hot partition.
8 questions test this
- Your Python service writes large JSON documents into an Azure Cosmos DB for NoSQL container with manual throughput, and most of their properties are never queried. Creates return rate-limited errors t
- You develop a multitenant document store on Azure Cosmos DB for NoSQL that is partitioned by tenant identifier. Rate-limited responses now exceed ten percent of requests, and the Normalized RU Consump
- Your team runs a production Python API backed by an Azure Cosmos DB for NoSQL container. The Total Requests by Status Code chart shows about three percent of requests returning the rate-limited status
- A reviewer finds that your Python ingestion utility wraps every Azure Cosmos DB for NoSQL write in a loop that catches the rate-limited error and sleeps a hard-coded two hundred milliseconds before tr
- You develop a Python service on Azure Container Apps that writes embedding records to an Azure Cosmos DB for NoSQL container. During peak load the SDK's built-in throttling retries are exhausted and a
- You store vehicle telemetry in an Azure Cosmos DB for NoSQL container partitioned by the reading date, and every day's writes land on one logical partition, which returns rate-limited responses each e
- You develop a Python web service that creates a new CosmosClient per request and reads the database and container objects from the account before every operation. The service now receives responses st
- You run a nightly bulk load of embedded document chunks into an Azure Cosmos DB for NoSQL container that uses manual throughput. The loader already raised the client's maximum retry attempts on thrott
- The SDK automatically retries throttled requests up to a configurable maximum, honoring retry-after
By default the SDK transparently retries 429 responses, waiting the x-ms-retry-after-ms interval each time, up to a bounded number of attempts (nine by default, changed with the Python SDK's retry_total setting) and a maximum cumulative wait time (30 seconds by default, after which a CosmosHttpResponseError with status 429 reaches the application even if attempts remain). Raising these limits absorbs larger bursts at the cost of latency but does not add capacity.
Trap Increasing max retry attempts masks a hot partition or too-low RU/s; it does not provision more throughput.
5 questions test this
- Your Python service writes large JSON documents into an Azure Cosmos DB for NoSQL container with manual throughput, and most of their properties are never queried. Creates return rate-limited errors t
- Your team runs a production Python API backed by an Azure Cosmos DB for NoSQL container. The Total Requests by Status Code chart shows about three percent of requests returning the rate-limited status
- A reviewer finds that your Python ingestion utility wraps every Azure Cosmos DB for NoSQL write in a loop that catches the rate-limited error and sleeps a hard-coded two hundred milliseconds before tr
- You develop a Python service on Azure Container Apps that writes embedding records to an Azure Cosmos DB for NoSQL container. During peak load the SDK's built-in throttling retries are exhausted and a
- You run a nightly bulk load of embedded document chunks into an Azure Cosmos DB for NoSQL container that uses manual throughput. The loader already raised the client's maximum retry attempts on thrott
- A hot logical partition can throttle even when total RU/s appears sufficient
Because throughput is divided across physical partitions, a partition key that concentrates traffic on one logical partition can trigger 429s while overall utilization looks low. The remedy is a higher-cardinality, evenly distributed partition key, not simply more RU/s.
- Partition-key cardinality design rule
The design rule for even throughput is to pick a partition key with high cardinality whose access pattern spreads work uniformly — a per-user or per-device id distributes load, whereas a low-cardinality field (a status flag) or a monotonically increasing timestamp concentrates writes and creates a hot partition. Because provisioned throughput divides evenly across a container's physical partitions and every logical partition maps to exactly one of them, a skewed key throttles one physical partition even when total account RUs are ample.
- Cosmos indexes every property automatically by default; you tune write cost by excluding paths
A container's indexing policy defaults to automatic, consistent indexing of all paths (/*). Write RU cost scales with the number of indexed paths, so excluding properties you never filter or sort on reduces write and storage cost without affecting the queries you actually run.
Trap Assuming properties you never filter or sort on are free because no query touches them.
7 questions test this
- You develop a Python ingestion service that upserts several million retrieval-augmented generation chunks into an Azure Cosmos DB for NoSQL container. Each item stores a large chunkText string plus sm
- An Azure Cosmos DB for NoSQL container holds scraped product manuals under a single doc property that carries several megabytes of raw text plus a small doc.meta.section string. Ingest writes are expe
- You trimmed the indexing policy of an Azure Cosmos DB for NoSQL container that stores chat transcripts, excluding every path except the ones your equality filters use. A nightly Python report that sor
- You must backfill 400 million historical records into a new Azure Cosmos DB for NoSQL container before its retrieval API goes live. No time-to-live is configured, the container is queried only after t
- A container in Azure Cosmos DB for NoSQL uses an opt-in indexing policy: /* sits in excludedPaths and three scalar paths are listed in includedPaths. Queries that filter on the container's partition k
- You store agent session state in an Azure Cosmos DB for NoSQL container. Every access is a point read on the item id and partition key, no query is ever issued against the container, and expired sessi
- Your team wants to lower the write RU charge of an Azure Cosmos DB for NoSQL container that backs a document retrieval API. The container still uses the default indexing policy, and nobody is sure whi
- includedPaths and excludedPaths use JSON path expressions such as /category/? and /*
Indexing paths use JSON path syntax: /* matches everything recursively, /category/? indexes the scalar at that path, and /metadata/* indexes a subtree. The most specific matching rule wins, so you can include /* while excluding a large subtree like /rawText/*.
Trap Assuming a broad /* include outranks a more specific excludedPaths entry.
5 questions test this
- You develop a Python ingestion service that upserts several million retrieval-augmented generation chunks into an Azure Cosmos DB for NoSQL container. Each item stores a large chunkText string plus sm
- An Azure Cosmos DB for NoSQL container holds scraped product manuals under a single doc property that carries several megabytes of raw text plus a small doc.meta.section string. Ingest writes are expe
- You trimmed the indexing policy of an Azure Cosmos DB for NoSQL container that stores chat transcripts, excluding every path except the ones your equality filters use. A nightly Python report that sor
- An Azure Cosmos DB for NoSQL container stores agent conversations. Each item holds a messages array whose elements contain a role string, a large content string, and a createdAt value. Your Python ret
- A container in Azure Cosmos DB for NoSQL uses an opt-in indexing policy: /* sits in excludedPaths and three scalar paths are listed in includedPaths. Queries that filter on the container's partition k
- indexingMode consistent keeps the index in sync with writes; none disables indexing entirely
indexingMode consistent (the default) updates the index synchronously as you create, update, or delete items, so read queries see the consistency configured for the account rather than a lagging index; none removes the index — suitable for a pure key/value point-read store where any query would otherwise scan. A third mode, lazy, can return inconsistent or incomplete query results and can no longer be selected for new containers.
Trap Setting indexingMode to none on a container that still has to answer queries.
2 questions test this
- You must backfill 400 million historical records into a new Azure Cosmos DB for NoSQL container before its retrieval API goes live. No time-to-live is configured, the container is queried only after t
- You store agent session state in an Azure Cosmos DB for NoSQL container. Every access is a point read on the item id and partition key, no query is ever issued against the container, and expired sessi
- Excluding a vector or large-text path from the standard index avoids paying to index data you search specially
Large properties such as embedding arrays or raw document text add write RU and storage when covered by the default index. Adding their path to excludedPaths while defining a dedicated vector index keeps writes cheap without losing the specialized search path.
- A composite index is required to ORDER BY two or more properties
A single-property range index handles ORDER BY on one field, but ordering by multiple properties (for example ORDER BY c.lastName ASC, c.firstName ASC) requires a compositeIndexes entry listing those paths with their sort orders, or the query fails.
Trap Expecting two single-property range indexes to satisfy an ORDER BY over both.
6 questions test this
- You review four queries that a Python service will run against a new Azure Cosmos DB for NoSQL container. The container uses the default indexing policy, and no composite indexes have been defined on
- You develop a Python API on Azure Container Apps that stores support tickets in an Azure Cosmos DB for NoSQL container created with the default indexing policy. A new endpoint must return tickets orde
- You maintain a Python reporting job that queries an Azure Cosmos DB for NoSQL container whose indexing policy defines one composite index on /storeId, /category, and /restockedOn, all ascending. A new
- You develop a Python storefront API that queries an Azure Cosmos DB for NoSQL container of product items. A new price-comparison page must return items ordered by c.price ascending and then by c.categ
- Your team adds a compliance report to a Python service that queries an Azure Cosmos DB for NoSQL container of shipment records, each with region, warehouse, carrier, and shippedOn properties. The repo
- You develop an Azure Functions app in Python that reads audit events from an Azure Cosmos DB for NoSQL container. The query filters on an equality predicate for c.tenantId and returns the matching eve
- Composite index property order and direction must match the query, including its exact reverse
A composite index defined as (name ASC, age ASC) serves ORDER BY name ASC, age ASC and its exact reverse (name DESC, age DESC), but not (name ASC, age DESC). Define the composite index to mirror the query's property sequence and directions.
Trap Assuming one composite index serves every combination of sort directions on its properties.
6 questions test this
- You maintain a Python reporting job that queries an Azure Cosmos DB for NoSQL container whose indexing policy defines one composite index on /storeId, /category, and /restockedOn, all ascending. A new
- You develop a Python storefront API that queries an Azure Cosmos DB for NoSQL container of product items. A new price-comparison page must return items ordered by c.price ascending and then by c.categ
- You develop a Python catalog API on Azure App Service that reads from an Azure Cosmos DB for NoSQL container. Its indexing policy contains a composite index on /brand and /releasedOn, both ascending,
- Your team adds a compliance report to a Python service that queries an Azure Cosmos DB for NoSQL container of shipment records, each with region, warehouse, carrier, and shippedOn properties. The repo
- You support a Python HR service backed by an Azure Cosmos DB for NoSQL container whose indexing policy contains a single composite index on /lastName and /hireDate, both ascending. An existing roster
- You develop an Azure Functions app in Python that reads audit events from an Azure Cosmos DB for NoSQL container. The query filters on an equality predicate for c.tenantId and returns the matching eve
- Composite indexes can also lower RU for queries that filter on one property and sort or range on another
Beyond multi-property ORDER BY, a composite index can reduce the RU charge of queries that filter on one property and range-filter or sort on another, because the engine resolves them from the composite index instead of a broader index scan.
- Cosmos offers five consistency levels from Strong to Eventual, with Session as the default
The five levels — Strong, Bounded Staleness, Session, Consistent Prefix, and Eventual — trade read consistency against latency, availability, and RU cost. Session, the default, guarantees read-your-own-writes and monotonic reads within a client session and satisfies most applications.
6 questions test this
- A Python web tier on Azure App Service writes an order to an Azure Cosmos DB for NoSQL account left at its default consistency level, then queues a message that a background worker picks up in order t
- You change the default consistency level of an Azure Cosmos DB for NoSQL account from Session to Bounded Staleness in the Azure portal. A Python service on Azure App Service holds one long-lived Cosmo
- You develop a Python profile API on Azure Container Apps that writes to an Azure Cosmos DB for NoSQL account with a single write region and two read regions. Each signed-in user must immediately see v
- A Python ingestion service that writes items across thousands of logical partitions runs on one set of Azure Container Apps replicas, while a separate confirmation service on other replicas must read
- An Azure Cosmos DB for NoSQL account keeps Strong as its default consistency level for a settlement service that cannot tolerate stale reads. A separate Python reporting service on Azure Container App
- A Python reconciliation job runs in the West Europe read region of an Azure Cosmos DB for NoSQL account whose only write region is East US. The job issues no writes, and it must never process data tha
- Strong and Bounded Staleness reads consume roughly double the RUs of weaker levels
Strong guarantees a linearizable, always-latest read but adds latency and is unavailable with multi-region writes; Bounded Staleness bounds lag by versions or time. Reads at Strong or Bounded Staleness cost about twice the RUs of Session, Consistent Prefix, or Eventual reads.
Trap Strong consistency is not compatible with multi-region (multi-master) write accounts.
5 questions test this
- An Azure Cosmos DB for NoSQL account in East US uses Strong as its default consistency level, and a Python API runs on Azure Container Apps in both East US and West Europe. The business now requires t
- You develop a Python profile API on Azure Container Apps that writes to an Azure Cosmos DB for NoSQL account with a single write region and two read regions. Each signed-in user must immediately see v
- A Python telemetry pipeline inserts several thousand small items per second into an Azure Cosmos DB for NoSQL container, and the account's default consistency level is Bounded Staleness. The inserts n
- An Azure Cosmos DB for NoSQL account keeps Strong as its default consistency level for a settlement service that cannot tolerate stale reads. A separate Python reporting service on Azure Container App
- A Python reconciliation job runs in the West Europe read region of an Azure Cosmos DB for NoSQL account whose only write region is East US. The job issues no writes, and it must never process data tha
- Session consistency is carried by a session token emitted on the write response
Under Session consistency each write response returns a session token; to preserve read-your-own-writes across processes or nodes you capture that token and supply it on later requests' options. The token is produced by the operation response, not configured on the client.
Trap Hunting for the session token as a client setting instead of on the write response.
2 questions test this
- A Python web tier on Azure App Service writes an order to an Azure Cosmos DB for NoSQL account left at its default consistency level, then queues a message that a background worker picks up in order t
- A Python ingestion service that writes items across thousands of logical partitions runs on one set of Azure Container Apps replicas, while a separate confirmation service on other replicas must read
- A request can relax to a weaker consistency than the account default; the ConsistencyLevel override cannot strengthen it
The account's default consistency applies to all requests, but an individual read may request a weaker level than the default (for example Eventual on a Strong account) to save RUs and latency. With the per-request ConsistencyLevel option that override can only relax consistency; moving to a level stronger than the account default means changing the account's own default.
- Conflict-resolution policy for multi-region write accounts
When a multi-region write account takes concurrent writes to the same item in different regions, the container's conflict-resolution policy reconciles them: Last-Writer-Wins (the default, on a numeric/timestamp conflict path such as _ts) or a Custom policy backed by a merge stored procedure. The policy decides WHICH version wins; it does not route writes to the nearest region (that is the preferred-regions list).
Store embeddings and run vector similarity search in Cosmos DB
Read full chapterCheat sheet
Sharp facts the exam loves — scan these before test day.
- A container's vector embedding policy declares the vector path, data type, distance function, and dimensions
To store embeddings you define a vector embedding policy at container creation listing each vector's path, dataType (for example float32), distanceFunction (cosine, dotproduct, or euclidean), and dimensions. The dimensions must equal the embedding model's output size, and the policy is set when the container is created.
Trap Planning to attach or change a vector embedding policy on a container that already exists.
5 questions test this
- You are modeling a container in Azure Cosmos DB for NoSQL for an assistant that answers questions from safety bulletins. A colleague proposes one item per bulletin, holding an array of chunk objects w
- You are creating an Azure Cosmos DB for NoSQL container for a media-archive assistant. An Azure OpenAI deployment produces the embeddings, and the team cannot change that deployment or the number of d
- A compliance team keeps policy bulletins in Azure Cosmos DB for NoSQL and edits them constantly. Today an Azure Function reads the change feed, calls a Microsoft Foundry embedding deployment, and writ
- You are creating an Azure Cosmos DB for NoSQL container for a veterinary triage service. Each item must carry both a clinician's typed symptom note and a photo of the affected area, along with shared
- You are creating an Azure Cosmos DB for NoSQL container for a retrieval workload. Your deployment script writes an indexing policy that defines a diskANN vector index on an embedding property, but the
- The policy's distance function must match how similarity is computed and the model's recommended metric
The distanceFunction chosen in the embedding policy (cosine, dotproduct, euclidean) defines how VectorDistance ranks similarity, so it must align with the embedding model's recommended metric — for example cosine for normalized text embeddings. Mismatching it degrades retrieval relevance.
Trap Assuming any distance function ranks a given model's embeddings equally well.
2 questions test this
- You are writing the vector embedding policy for a container that will hold embeddings of support-article chunks in Azure Cosmos DB for NoSQL. The chunks vary widely in length, so their vectors differ
- You are creating an Azure Cosmos DB for NoSQL container for a media-archive assistant. An Azure OpenAI deployment produces the embeddings, and the team cannot change that deployment or the number of d
- Embeddings are stored as an array property in the same item as their source content and metadata
A vector is a numeric array field on the document, co-located with the chunk text and its metadata (id, title, page). Storing them together lets one query return both the similarity ranking and the fields needed to ground and cite an answer.
5 questions test this
- You are modeling a container in Azure Cosmos DB for NoSQL for an assistant that answers questions from safety bulletins. A colleague proposes one item per bulletin, holding an array of chunk objects w
- A compliance team keeps policy bulletins in Azure Cosmos DB for NoSQL and edits them constantly. Today an Azure Function reads the change feed, calls a Microsoft Foundry embedding deployment, and writ
- You are creating an Azure Cosmos DB for NoSQL container for a veterinary triage service. Each item must carry both a clinician's typed symptom note and a photo of the affected area, along with shared
- A nightly job loads embeddings into an Azure Cosmos DB for NoSQL container whose vector embedding policy declares the embedding path, its dimensions, and its distance function. The vector search query
- You are designing storage for a grounded assistant on Azure Cosmos DB for NoSQL. A colleague proposes a lean container holding only an id and an embedding, with each chunk's text and metadata left in
- The indexing policy defines a vector index of type flat, quantizedFlat, or diskANN
Separate from the embedding policy, the indexing policy's vectorIndexes specifies a vector index type per path: flat (exact brute-force), quantizedFlat (compressed vectors for less storage and faster scan), or diskANN (graph-based approximate nearest neighbor for large collections).
Trap Assuming the vector embedding policy also creates the vector index.
7 questions test this
- You create a container in Azure Cosmos DB for NoSQL for a field-service platform. One property holds 1,536-dimension embeddings of roughly 9 million incident reports that are searched across all depot
- You design a container in Azure Cosmos DB for NoSQL for a pharmaceutical label review tool. The draft model stores one document per label with an array of chunk objects, each chunk carrying its own em
- You plan to add semantic retrieval to an existing Azure Cosmos DB for NoSQL account that has never stored vectors. Your Python deployment script will create a new container whose indexing policy speci
- You develop a clinical-trial protocol assistant on Azure Cosmos DB for NoSQL. Protocol chunks carry 1,536-dimension embeddings, every search is filtered to a single trial holding about 8,000 vectors,
- You are creating a container in Azure Cosmos DB for NoSQL whose depot-scoped semantic searches will run against a quantizedFlat vector index over 1,536-dimension embeddings. Bench tests put recall sli
- Your team is creating an Azure Cosmos DB for NoSQL container for semantic search over 1,536-dimension embeddings indexed with diskANN. A pilot showed recall against exhaustive results below what revie
- You develop a Python retrieval service on Azure Cosmos DB for NoSQL that stores 1,536-dimension chunk embeddings for a maritime logistics knowledge base. The container will hold roughly 12 million vec
- diskANN is a graph ANN; quantizedFlat is a compressed scan; flat is exact
flat computes exact distances by scanning every candidate vector — accurate but costly at scale. quantizedFlat still scans, but over quantized (compressed) vectors, cutting RU and latency at a small accuracy cost. diskANN builds a true graph-based approximate-nearest-neighbor index that scales to millions of vectors at low latency. Choose diskANN for very large collections, quantizedFlat for a mid-size compressed scan, and flat only for small sets or when exact recall is required.
Trap Choosing flat for a million-vector collection because it is the most accurate.
7 questions test this
- You create a container in Azure Cosmos DB for NoSQL for a field-service platform. One property holds 1,536-dimension embeddings of roughly 9 million incident reports that are searched across all depot
- Your production Azure Cosmos DB for NoSQL container serves semantic search over 1,536-dimension embeddings through a diskANN vector index. Before a release you must measure how often the served result
- You develop a clinical-trial protocol assistant on Azure Cosmos DB for NoSQL. Protocol chunks carry 1,536-dimension embeddings, every search is filtered to a single trial holding about 8,000 vectors,
- Your team builds a Python service on Azure Cosmos DB for NoSQL that matches free-text laboratory requests against a controlled vocabulary of roughly 450 approved test names, each stored as a 384-dimen
- You are creating a container in Azure Cosmos DB for NoSQL whose depot-scoped semantic searches will run against a quantizedFlat vector index over 1,536-dimension embeddings. Bench tests put recall sli
- Your team is creating an Azure Cosmos DB for NoSQL container for semantic search over 1,536-dimension embeddings indexed with diskANN. A pilot showed recall against exhaustive results below what revie
- You develop a Python retrieval service on Azure Cosmos DB for NoSQL that stores 1,536-dimension chunk embeddings for a maritime logistics knowledge base. The container will hold roughly 12 million vec
- The vector path is typically excluded from the standard index while covered by the dedicated vector index
Because a raw embedding array is large, teams add its path to excludedPaths in the standard index to avoid needless write RU, while defining the vectorIndexes entry that actually powers similarity search on that same path.
- VectorDistance() computes similarity between a stored vector and a query vector in a SQL query
The VectorDistance(c.embedding, @queryVector) system function returns the distance or similarity between a stored embedding and a supplied query vector using the container's configured metric, and can be projected as a score in the SELECT clause.
5 questions test this
- You develop a retrieval service over an Azure Cosmos DB for NoSQL container whose vector embedding policy declares the euclidean distance function. The service projects VectorDistance as an aliased sc
- You develop a Python retrieval service that queries an Azure Cosmos DB for NoSQL container, projecting VectorDistance as an aliased score and ordering by the same expression. The service calls an Azur
- You develop a semantic retrieval feature over an Azure Cosmos DB for NoSQL container whose vector embedding policy declares cosine as the distance function, holding several hundred thousand indexed ch
- Your team is designing the response contract for a semantic retrieval API backed by an Azure Cosmos DB for NoSQL container that carries a vector embedding policy on the chunk embedding path. A reviewe
- You develop a retrieval-augmented generation service over an Azure Cosmos DB for NoSQL container. For each question it retrieves the 10 nearest chunks and passes all of them to the model. On narrow qu
- ORDER BY VectorDistance(...) with TOP k performs the k-nearest-neighbor search using the vector index
A query of the form SELECT TOP @k c.text, VectorDistance(c.embedding, @q) AS score FROM c ORDER BY VectorDistance(c.embedding, @q) returns the k most semantically similar items and engages the vector index for efficient nearest-neighbor retrieval - approximate on a diskANN index, exact on a flat one.
Trap VectorDistance in SELECT alone does not use the vector index for ranking; the ORDER BY VectorDistance clause is what drives the k-NN search.
4 questions test this
- You review the semantic retrieval query that an Azure Cosmos DB for NoSQL microservice issues on every user turn. The query projects VectorDistance as an aliased score and orders by the same expressio
- You prototype semantic retrieval on a new Azure Cosmos DB for NoSQL container that carries a vector embedding policy on the embedding path but no vector index, and that holds roughly 400 chunk documen
- You develop a Python service that runs semantic search over an Azure Cosmos DB for NoSQL container partitioned by libraryId. Each request must search a caller-supplied set of eight libraries, so a sin
- You develop a retrieval component for an Azure Cosmos DB for NoSQL container. Its query selects the top 10 chunk texts and projects VectorDistance against the caller's query embedding as an aliased sc
- The query vector is passed as a parameter and the projected score enables ranking and thresholding
You pass the query embedding as a query parameter (a numeric array) and project VectorDistance as an aliased score, letting the application rank matches and optionally drop results beyond a similarity threshold before sending context to the model.
5 questions test this
- You develop a Python service that queries an Azure Cosmos DB for NoSQL container for semantically similar chunks on every request. The current build formats the 1,536-element embedding returned by an
- You develop a retrieval service over an Azure Cosmos DB for NoSQL container whose vector embedding policy declares the euclidean distance function. The service projects VectorDistance as an aliased sc
- Your team is designing the response contract for a semantic retrieval API backed by an Azure Cosmos DB for NoSQL container that carries a vector embedding policy on the chunk embedding path. A reviewe
- You develop a Python service that runs semantic search over an Azure Cosmos DB for NoSQL container partitioned by libraryId. Each request must search a caller-supplied set of eight libraries, so a sin
- You develop a retrieval-augmented generation service over an Azure Cosmos DB for NoSQL container. For each question it retrieves the 10 nearest chunks and passes all of them to the model. On narrow qu
- Filtered vector search combines a WHERE metadata predicate with ORDER BY VectorDistance
To restrict semantic retrieval to a subset (for example one tenant or document category), add a WHERE clause on indexed metadata alongside ORDER BY VectorDistance. Cosmos applies the filter and returns the top-k nearest within that scope — the core metadata-filtered RAG pattern.
8 questions test this
- You are adding grounded retrieval to a clinical policy assistant that stores policy chunks and embeddings in Azure Cosmos DB for NoSQL. The retrieval query filters on the department and orders by Vect
- You maintain a document-retrieval API on Azure Cosmos DB for NoSQL. The container holds several million chunks partitioned by libraryId, and each request searches inside exactly one library. The retri
- You develop a multitenant contract-review assistant on Azure Cosmos DB for NoSQL. All tenants' clause chunks and embeddings live in one container. The service runs an unfiltered top-10 similarity sear
- You maintain an IT service-desk assistant on Azure Cosmos DB for NoSQL. Each item holds an article chunk and its embedding, and the container already has a full-text policy and index on the chunk text
- You design a per-project drawing-search container in Azure Cosmos DB for NoSQL. Chunks carry 1,536-dimension embeddings from Azure OpenAI, every query filters on projectId so a single search covers on
- Your team runs a product-support retrieval service on Azure Cosmos DB for NoSQL. Millions of article chunks span 40 product lines, and every query filters on one productLine value before ordering by V
- A knowledge-base assistant on Azure Cosmos DB for NoSQL stores each passage with two embeddings on separate vector paths: one built from the passage text and one from its parent document's summary. Hy
- An investigations assistant ranks case notes in Azure Cosmos DB for NoSQL with ORDER BY RANK RRF over FullTextScore and VectorDistance. Reviewers now want the ten returned notes presented newest first
- Returning source metadata (id, title, page) with each match is what enables grounded citations
Because embeddings live in the same document as their source fields, the vector query projects document id, title, and page next to the score. The application uses that returned metadata to ground the generated answer and attach an accurate citation to each retrieved chunk.
3 questions test this
- A travel-support assistant shows a match strength beside each citation, computed from the similarity value that its filtered vector query projects from Azure Cosmos DB for NoSQL. After the team rebuil
- An e-learning assistant answers with citations drawn from lesson chunks in Azure Cosmos DB for NoSQL, using a filtered vector query that projects only the lesson id, the lesson title, and the item's p
- An investigations assistant ranks case notes in Azure Cosmos DB for NoSQL with ORDER BY RANK RRF over FullTextScore and VectorDistance. Reviewers now want the ten returned notes presented newest first
- Cosmos supports hybrid search that fuses full-text and vector ranking with Reciprocal Rank Fusion
Beyond pure vector search, Cosmos DB for NoSQL offers full-text search (for example FullTextScore) and hybrid queries that blend keyword and vector relevance using Reciprocal Rank Fusion (RRF), improving recall when lexical and semantic matches differ.
Implement a Cosmos DB change feed processor
Read full chapterCheat sheet
Sharp facts the exam loves — scan these before test day.
- The change feed is a persistent, per-partition ordered record of creates and updates
The change feed exposes items in the order they were modified within each logical partition, so downstream consumers can react to new or changed data. In its default mode it shows only the latest version of each changed item and does not surface deletes.
Trap Expecting the default change feed to replay every intermediate version of an item.
8 questions test this
- You develop a Python service that builds an audit log from an Azure Cosmos DB for NoSQL container. The account runs in continuous backup mode with the all versions and deletes change feed feature enab
- Your team runs a product catalog in Azure Cosmos DB for NoSQL and mirrors it into a downstream search index by reading the container's change feed. Deleted products keep appearing in search results. C
- An existing Azure Functions pipeline processes an Azure Cosmos DB for NoSQL container's change feed in latest-version mode and must keep running unchanged. A second team now needs delete events from t
- Your team keeps an Azure AI Search index in sync with an Azure Cosmos DB for NoSQL container that takes a sustained high write rate. The sync must pick up new and updated items within seconds, must no
- You develop an order-processing service on Azure Cosmos DB for NoSQL. Every customer action, such as adding an item, removing an item, and checking out, is written as its own document, and a change fe
- Your team must rebuild a downstream analytics store from an Azure Cosmos DB for NoSQL container that has existed for years. Every create and update since the container was created has to be replayed,
- You maintain a telemetry pipeline on Azure Cosmos DB for NoSQL. One device document is updated many times per second, and a change feed consumer must observe every intermediate state rather than only
- You store IoT readings in an Azure Cosmos DB for NoSQL container that uses a container-level time to live to age out readings, and a change feed consumer in the default mode forwards each reading to a
- Latest-version mode omits deletes; all-versions-and-deletes mode captures inserts, updates, and deletes
Latest-version (formerly incremental) mode returns the most recent state of changed items and no deletes. All-versions-and-deletes (full-fidelity) mode also emits deletes and intermediate versions, but it requires continuous backup / retention to be enabled on the account.
Trap Switching to all-versions-and-deletes mode on an account with no continuous backup enabled.
9 questions test this
- You develop a Python service that builds an audit log from an Azure Cosmos DB for NoSQL container. The account runs in continuous backup mode with the all versions and deletes change feed feature enab
- Your team runs a product catalog in Azure Cosmos DB for NoSQL and mirrors it into a downstream search index by reading the container's change feed. Deleted products keep appearing in search results. C
- You build a Python consumer that reads an Azure Cosmos DB for NoSQL change feed in all versions and deletes mode using the pull model, on an account configured for continuous backups. Deployments rest
- An existing Azure Functions pipeline processes an Azure Cosmos DB for NoSQL container's change feed in latest-version mode and must keep running unchanged. A second team now needs delete events from t
- You plan to add delete-aware processing to an existing Azure Cosmos DB for NoSQL account. The application must read the change feed in all versions and deletes mode, but the portal does not offer that
- An auditing consumer reads an Azure Cosmos DB for NoSQL container in all versions and deletes mode and stores a checkpoint after each batch. Following a multi-week failure that exceeded the account's
- Your team must rebuild a downstream analytics store from an Azure Cosmos DB for NoSQL container that has existed for years. Every create and update since the container was created has to be replayed,
- You maintain a telemetry pipeline on Azure Cosmos DB for NoSQL. One device document is updated many times per second, and a change feed consumer must observe every intermediate state rather than only
- You store IoT readings in an Azure Cosmos DB for NoSQL container that uses a container-level time to live to age out readings, and a change feed consumer in the default mode forwards each reading to a
- A soft-delete-plus-TTL pattern lets latest-version consumers observe logical deletions
Because the default change feed does not emit hard deletes, a common pattern marks an item deleted with a flag (optionally with a TTL) so latest-version consumers see the update as a change. Use all-versions-and-deletes mode when true delete events must be captured.
- The change feed processor has four components: monitored container, lease container, compute host, and delegate
The processor reads from the monitored (source) container, records progress in a separate lease container, runs on one or more compute instances (hosts), and invokes your delegate/handler with each batch of changes. All four pieces are required to build a processor.
Trap Expecting the processor to checkpoint into the monitored container without a separate lease container.
8 questions test this
- You operate a change feed processor that projects order documents from an Azure Cosmos DB for NoSQL container into a downstream search index. A weekly platform patch stops every processor instance for
- You must host the compute instance for a change feed processor that reads an Azure Cosmos DB for NoSQL container. Changes arrive continuously through the day, the delegate must pick them up with as li
- A change feed processor over an Azure Cosmos DB for NoSQL container calls an external scoring API from its delegate. One malformed document makes the delegate throw every time it is delivered, and tha
- Two independent Azure Functions consume the change feed of the same Azure Cosmos DB for NoSQL container: one sends notifications and one maintains a materialized view. To control cost, both are config
- You add real-time enrichment to a product catalog in Azure Cosmos DB for NoSQL: whenever an item changes, its description must be re-embedded and the vector written to a second container. A change fee
- A production change feed processor has been checkpointing an Azure Cosmos DB for NoSQL container for months. A new downstream system needs the container's entire change history replayed once. A develo
- Your team writes its Azure back-end services in Python. A new service must react to every insert and update in an Azure Cosmos DB for NoSQL container, resume after instance restarts without replaying
- Your team is building a service that must react to every insert and update in an Azure Cosmos DB for NoSQL container named Orders. A prototype reads the change feed on one machine, loses its position
- The lease container stores per-partition leases and checkpoints so work is distributed and resumable
Each physical partition range gets a lease document in the lease container recording its continuation (checkpoint). Multiple host instances sharing the same lease container automatically balance partition ranges among themselves and resume from the last checkpoint after a restart.
11 questions test this
- A change feed processor deployment with three instances feeds a downstream index from an Azure Cosmos DB for NoSQL container. Business users report that the index is stale during evening traffic. Befo
- You operate a change feed processor that projects order documents from an Azure Cosmos DB for NoSQL container into a downstream search index. A weekly platform patch stops every processor instance for
- You must host the compute instance for a change feed processor that reads an Azure Cosmos DB for NoSQL container. Changes arrive continuously through the day, the delegate must pick them up with as li
- A change feed processor over an Azure Cosmos DB for NoSQL container calls an external scoring API from its delegate. One malformed document makes the delegate throw every time it is delivered, and tha
- An Azure Container Apps deployment runs a single change feed processor instance that consumes an Azure Cosmos DB for NoSQL telemetry container, and the delegate is falling behind during peak ingestion
- Two independent Azure Functions consume the change feed of the same Azure Cosmos DB for NoSQL container: one sends notifications and one maintains a materialized view. To control cost, both are config
- You add real-time enrichment to a product catalog in Azure Cosmos DB for NoSQL: whenever an item changes, its description must be re-embedded and the vector written to a second container. A change fee
- A change feed processor consumes an Azure Cosmos DB for NoSQL container whose data currently occupies four physical partitions. To clear a backlog, an operator raised the consumer from four replicas t
- A production change feed processor has been checkpointing an Azure Cosmos DB for NoSQL container for months. A new downstream system needs the container's entire change history replayed once. A develo
- Your team writes its Azure back-end services in Python. A new service must react to every insert and update in an Azure Cosmos DB for NoSQL container, resume after instance restarts without replaying
- Your team is building a service that must react to every insert and update in an Azure Cosmos DB for NoSQL container named Orders. A prototype reads the change feed on one machine, loses its position
- Instances share work only when they share a lease container AND a processor name, and leases cap the count
Instances cooperate only as one deployment unit, which takes three things at once: the same lease container configuration, the same processor name, and a different instance name for each. Meet all three and the processor distributes every lease across the running instances using an equal-distribution algorithm and rebalances as instances come and go. A lease is owned by one instance at any time, so the number of instances shouldn't be greater than the number of leases, and a differing processor name builds a second deployment unit that reads the whole feed again instead of sharing the work.
Trap Expecting instances with different processor names to share the work rather than each read the whole feed.
5 questions test this
- A change feed processor deployment with three instances feeds a downstream index from an Azure Cosmos DB for NoSQL container. Business users report that the index is stale during evening traffic. Befo
- An Azure Container Apps deployment runs a single change feed processor instance that consumes an Azure Cosmos DB for NoSQL telemetry container, and the delegate is falling behind during peak ingestion
- A change feed processor consumes an Azure Cosmos DB for NoSQL container whose data currently occupies four physical partitions. To clear a backlog, an operator raised the consumer from four replicas t
- A production change feed processor has been checkpointing an Azure Cosmos DB for NoSQL container for months. A new downstream system needs the container's entire change history replayed once. A develo
- Your team writes its Azure back-end services in Python. A new service must react to every insert and update in an Azure Cosmos DB for NoSQL container, resume after instance restarts without replaying
- A partitioned lease container is required to have an /id partition key, and it consumes its own RUs
The lease container is a separate container that acts as state storage and coordinates processing across workers; it can sit in the same account as the monitored container or in another account, and partitioned lease containers are required to have a /id partition key definition. It consumes its own request units for lease reads, writes and checkpoints, and throttling it delays change feed events or can end processing altogether. You normally provision it yourself, but the Azure Functions trigger can create it for you when CreateLeaseContainerIfNotExists is set to true (the default is false).
- Checkpointing after a batch succeeds yields at-least-once delivery, so handlers must be idempotent
The processor advances the lease continuation (checkpoints) only after your delegate finishes a batch, so semantics are at-least-once: a host crash mid-batch causes the next owner to reprocess from the last checkpoint. Delegates must therefore be idempotent.
Trap Change feed processing is at-least-once, not exactly-once; make the handler idempotent to tolerate re-delivery.
5 questions test this
- You develop a Python Azure Function that uses an Azure Cosmos DB trigger on an orders container and writes an enriched copy of each changed order to a downstream container. During a load test an insta
- You operate a change feed processor deployment that reads an Azure Cosmos DB for NoSQL container and calls a partner API for each change. One malformed item makes the delegate throw on every attempt,
- A change feed processor deployment has been running for months against an Azure Cosmos DB for NoSQL container. After a bug in the delegate is fixed, the team sets the start time back one week and rede
- You review a change feed processor delegate that reads an Azure Cosmos DB for NoSQL container. For each change the delegate starts an asynchronous call to a downstream service and returns immediately
- Your team builds a Python solution that must react to every insert and update in an Azure Cosmos DB for NoSQL container by refreshing a vector index. The team wants the platform to track processing po
- The start setting controls where a new lease begins; an existing checkpoint always takes precedence
When a lease is first created you can start reading from now (default — only future changes), from the container's beginning, or from a specific start time. Once a checkpoint exists the processor resumes from it and ignores the start setting.
Trap Setting start-from-beginning to re-read the feed when a lease checkpoint already exists.
5 questions test this
- You operate a change feed processor deployment that reads an Azure Cosmos DB for NoSQL container and calls a partner API for each change. One malformed item makes the delegate throw on every attempt,
- You add a semantic search feature to an existing app backed by an Azure Cosmos DB for NoSQL container that already holds several million product items. A new change feed processor deployment must embe
- You add a change feed processor to an Azure Cosmos DB for NoSQL container that already holds five years of customer records. The processor sends a push notification for each change, and existing recor
- A change feed processor deployment has been running for months against an Azure Cosmos DB for NoSQL container. After a bug in the delegate is fixed, the team sets the start time back one week and rede
- You review a change feed processor delegate that reads an Azure Cosmos DB for NoSQL container. For each change the delegate starts an asynchronous call to a downstream service and returns immediately
- Changes are delivered in modification order within a partition key, batched by page, not ordered across ranges
Within a single logical partition the change feed preserves modification order, and the processor hands the delegate batches bounded by a max-items-per-page setting. Ordering is not guaranteed across different partition key ranges.
Trap Assuming the change feed delivers changes in one global order across every partition.
4 questions test this
- You develop a Python Azure Function that uses an Azure Cosmos DB trigger on an orders container and writes an enriched copy of each changed order to a downstream container. During a load test an insta
- A Python Azure Function with an Azure Cosmos DB trigger enriches telemetry items. After a bulk import, invocations began receiving very large batches and hitting the function timeout, and the monitore
- You build an order-tracking service on Azure Cosmos DB for NoSQL. Each status change is written as a new item, and a change feed consumer maintains a materialized view of the current status of each or
- Your change feed consumer for an Azure Cosmos DB for NoSQL container is falling behind: the estimator shows a growing backlog while one host processes every lease, and the account reports no throttled
- The change feed estimator reports processing lag so you can scale consumers
The change feed estimator compares each lease's checkpoint against the latest change to report the remaining backlog (estimated pending items). A growing estimate signals that consumers are falling behind and that more processor instances or throughput are needed.
4 questions test this
- You operate an Azure Cosmos DB for NoSQL change feed processor deployment that runs as six pods in Azure Kubernetes Service, all sharing one lease container. Operations wants continuous lag reporting
- A change feed estimator reports a steadily rising number of pending changes for your Azure Cosmos DB for NoSQL processor deployment, which runs six identically configured hosts. Overall throughput loo
- Your team adds lag monitoring to an Azure Cosmos DB for NoSQL change feed processor that already runs in production. The estimator you deployed was created with its own new, empty lease container, and
- You run a change feed processor deployment on Azure Kubernetes Service that reads an Azure Cosmos DB for NoSQL container and forwards each change to an embedding pipeline. During traffic spikes, downs
- The push (processor) model auto-manages leases; the pull model queries the change feed manually
The change feed processor is the push model: it polls, distributes leases, and invokes your delegate automatically. The pull model (query_items_change_feed with a continuation) gives manual control over which partition range and how much to read, but you must manage checkpoints yourself.
Trap Assuming the pull model manages leases and checkpoints the way the processor does.
5 questions test this
- A Python service in Azure Container Apps consumes an Azure Cosmos DB for NoSQL change feed with the pull model, starting each iterator from the beginning of the container. Whenever a pod restarts, the
- A multitenant Azure Cosmos DB for NoSQL container uses tenantId as its partition key. A compliance job must replay one tenant's changes into an audit store, and the job must not read or process change
- Two Azure Functions must both react to every change in the same Azure Cosmos DB for NoSQL container: one refreshes a vector index and the other writes an audit record. Both use the Azure Cosmos DB tri
- A Python worker consumes an Azure Cosmos DB for NoSQL change feed with the pull model. The worker treats any page that returns zero items as proof that it has reached the end of the feed, so it stops
- A serverless team must react to every insert and update in an Azure Cosmos DB for NoSQL container by writing an embedding to a vector store. They will not run or patch any long-lived worker hosts, and
- The Azure Functions Cosmos DB trigger is a hosted change feed processor
The Azure Functions Cosmos DB trigger wraps the change feed processor: you supply the monitored container and a lease container, and the platform runs the processor and scales instances for you, making a Function the serverless way to consume the change feed.
Implement Azure Managed Redis caching, expiration, and invalidation
Read full chapterUnlock with Premium — includes all practice exams and the complete study guide.
Implement Azure Managed Redis vector indexing for similarity search
Read full chapterUnlock with Premium — includes all practice exams and the complete study guide.
Connect and query Azure Database for PostgreSQL with SDKs
Read full chapterUnlock with Premium — includes all practice exams and the complete study guide.
Model PostgreSQL schemas, data types, and indexes
Read full chapterUnlock with Premium — includes all practice exams and the complete study guide.
Optimize query latency and reduce pgvector compute
Read full chapterUnlock with Premium — includes all practice exams and the complete study guide.
Configure compute, memory, and storage for vector workloads
Read full chapterUnlock with Premium — includes all practice exams and the complete study guide.
Run vector similarity search and RAG on PostgreSQL
Read full chapterUnlock with Premium — includes all practice exams and the complete study guide.
Optimize PostgreSQL connections for throughput and latency
Read full chapterUnlock with Premium — includes all practice exams and the complete study guide.
Connect to and consume Azure services
Queue and process back-end operations with Azure Service Bus
Read full chapterCheat sheet
Sharp facts the exam loves — scan these before test day.
- A Service Bus queue delivers each message to exactly one competing consumer (point-to-point)
A Service Bus queue is a point-to-point channel: many consumers can compete for messages, but each message is delivered to and processed by only one receiver. Choose a queue (not a topic) when a back-end operation must be handled exactly once by a single worker.
Trap A topic with multiple subscriptions is fan-out — each subscription gets its own copy — so it violates single-consumer delivery.
5 questions test this
- A billing back end publishes every invoice to a Service Bus topic that also feeds an analytics subscription and a compliance subscription, and both of those must keep receiving all invoices. Three mor
- An order-fulfillment worker has consumed from a Service Bus queue named orders for a year. Last week a newly built audit service was pointed at the same queue. Since then the fulfillment worker proces
- A document-ingestion worker runs as a container replica set that scales between two and ten instances. Every uploaded document must be embedded and written to the vector store exactly one time, no ins
- A consolidation project sets the forwarding target of an intake queue to a shared work queue in the same namespace so that older producers can keep sending to intake unchanged. The long-running worker
- A platform team is designing the notification path for a support-ticket system. Every ticket event must reach three independent consumers, each consumer must be able to abandon and retry a message and
- A topic with subscriptions is publish/subscribe fan-out — each subscription receives its own copy
A Service Bus topic delivers a published message to every matching subscription, and each subscription is itself an independent queue read by its own consumer(s). Use topics + subscriptions when several independent consumers must each process the same event.
13 questions test this
- A notification service reads from a subscription named notify on a Service Bus topic named events, while two other subscriptions on the same topic stay healthy. Repeated processing failures in the not
- Two Service Bus namespaces serve two regions. Every event published to the orders topic in the first namespace must also reach a topic in the second namespace, the publishers in the first region must
- A billing back end publishes every invoice to a Service Bus topic that also feeds an analytics subscription and a compliance subscription, and both of those must keep receiving all invoices. Three mor
- An order topic feeds a single subscription named enrich, and your team defined three separately named rules on it, each carrying an annotation action that stamps routing metadata onto the messages it
- An order-fulfillment worker has consumed from a Service Bus queue named orders for a year. Last week a newly built audit service was pointed at the same queue. Since then the fulfillment worker proces
- A document-ingestion worker runs as a container replica set that scales between two and ten instances. Every uploaded document must be embedded and written to the vector store exactly one time, no ins
- A Python provisioning job onboards each new tenant by creating a dedicated Service Bus namespace together with the tenant's topic and its per-consumer subscriptions. The job authenticates to Azure wit
- An event-distribution topic in a Service Bus namespace already carries close to the maximum number of subscriptions that a topic accepts, and a partner onboarding program will add several thousand mor
- A claims topic feeds four subscriptions. The consumer of the fraud-review subscription needs every message it receives to carry a channel property whose value is priority, the publishing application c
- A platform team is designing the notification path for a support-ticket system. Every ticket event must reach three independent consumers, each consumer must be able to abandon and retry a message and
- A deployment identity creates subscriptions on an events topic every night and must now create one whose messages are forwarded into a reporting queue in the same namespace. The identity holds Manage
- An Azure Functions app is configured to trigger on a Service Bus topic named telemetry, and the app's managed identity already holds the Azure Service Bus Data Owner role on the namespace. The topic's
- An order-routing solution publishes every order to a Service Bus topic. Three regional back ends must divide that stream so that the broker delivers each order only to the region that owns it, publish
- Subscription rules (SQL and correlation filters) select which topic messages a subscription receives
Each subscription can carry rules that filter the topic stream: a correlation filter matches system/application properties (fast, exact match), while a SQL filter evaluates a SQL-like expression over message properties. A subscription with no filter receives every message via the default TrueFilter.
Trap Assuming a subscription with no rule receives nothing until a filter is added.
7 questions test this
- An order topic receives messages whose JSON payload contains a priority field. A new subscription must receive only the high-priority orders, and the broker itself must perform the selection so that c
- Messages published to a Service Bus topic in a document-processing pipeline carry a correlation identifier naming the tenant that submitted the work. One subscription must select only the messages of
- An order topic feeds a single subscription named enrich, and your team defined three separately named rules on it, each carrying an annotation action that stamps routing metadata onto the messages it
- A rush-order subscription on a Service Bus topic has to hold each selected message briefly before its consumer sees it. A developer added a rule action on that subscription which sets the scheduled en
- A subscription named alerts was created on a Service Bus topic without any rule being specified, and its consumer now receives every message published to the topic. It should receive only the messages
- A claims topic feeds four subscriptions. The consumer of the fraud-review subscription needs every message it receives to carry a channel property whose value is priority, the publishing application c
- An order-routing solution publishes every order to a Service Bus topic. Three regional back ends must divide that stream so that the broker delivers each order only to the region that owns it, publish
- PeekLock is a two-stage receive: the message is locked, then explicitly Completed after processing succeeds
In PeekLock mode the broker hands the message to one receiver and locks it for the lock duration; the receiver must call complete after successful work to remove it. This makes processing at-least-once and safe: a crash before Complete releases the lock so the message is redelivered.
Trap Treating a PeekLock receive as having already removed the message from the queue.
14 questions test this
- A queue consumer posts each message to an internal REST service that returns HTTP 503 for about two minutes every night while that service restarts. During the window the handler fails, and the team w
- During a scale-in event, several orders that a queue consumer had already pulled never reached the order database. The team checks the queue and finds no active messages for those orders, and the dead
- Your team must add a second, throughput-oriented drain path for an existing Azure Service Bus queue: a Python job that reads batches and treats every delivered message as consumed the moment it arrive
- An orchestration service defers Azure Service Bus messages whose prerequisite work has not finished, recording each sequence number in a local cache. A container restart wipes that cache, and the defe
- An invoicing consumer receives from a Service Bus queue in PeekLock mode and writes each invoice to Azure Cosmos DB before completing the message. Logs show the Complete call sometimes failing after t
- Your team plans to raise the lock duration on a live Azure Service Bus queue because handlers occasionally exceed the current value. Roughly two hundred messages are under peek-lock at any moment, and
- Enrichment work in a queue consumer calls an embedding model and routinely runs longer than the lock duration configured on the queue. Completing the message then throws a lock-lost error, the same en
- A Python consumer on Azure Container Apps pulls documents from an Azure Service Bus queue and generates embeddings, which takes roughly forty seconds per message. To lift throughput the team raised th
- An Azure Service Bus consumer logs message-lock-lost errors on its completion calls several times an hour, and the captured locked-until timestamps still show time remaining on those locks. The team a
- A queue consumer hands each received message to a background task and lets the receiver's context manager close as soon as the batch loop ends; the background task calls Complete when its own work fin
- A telemetry pipeline on Azure Container Apps drains a Service Bus queue of device heartbeat readings and writes rolling averages to a cache. Heartbeats are re-sent every few seconds, so losing an occa
- A code review covers a Python queue consumer that raises prefetch_count above zero to lift throughput on a busy Service Bus queue. The container hosting the consumer is restarted during every deployme
- An enrichment consumer calls a model whose latency ranges from seconds to several minutes, so the team attaches an automatic lock renewer to the Azure Service Bus receiver. Renewal occasionally stops
- A generic retry decorator wraps an Azure Service Bus handler and replays the whole handler body, including its completion call, whenever any exception escapes. On second attempts the consumer now logs
- ReceiveAndDelete settles the message at delivery, so a mid-processing failure loses it
ReceiveAndDelete removes the message from the queue the instant it is delivered, before processing begins. It is faster and simpler but offers no retry: if the consumer crashes mid-work the message is gone. Use it only for high-throughput, loss-tolerant data.
Trap Reliable single-consumer processing needs PeekLock + Complete, never ReceiveAndDelete.
7 questions test this
- An on-call engineer must read the payloads of the oldest messages sitting on a busy production Azure Service Bus queue to confirm a suspected producer bug. The live consumers must keep receiving norma
- During a scale-in event, several orders that a queue consumer had already pulled never reached the order database. The team checks the queue and finds no active messages for those orders, and the dead
- Your team must add a second, throughput-oriented drain path for an existing Azure Service Bus queue: a Python job that reads batches and treats every delivered message as consumed the moment it arrive
- An invoicing consumer receives from a Service Bus queue in PeekLock mode and writes each invoice to Azure Cosmos DB before completing the message. Logs show the Complete call sometimes failing after t
- A telemetry pipeline on Azure Container Apps drains a Service Bus queue of device heartbeat readings and writes rolling averages to a cache. Heartbeats are re-sent every few seconds, so losing an occa
- A code review covers a Python queue consumer that raises prefetch_count above zero to lift throughput on a busy Service Bus queue. The container hosting the consumer is restarted during every deployme
- A moderation consumer reads Azure Service Bus messages and calls a classifier that is unavailable for a few minutes whenever a new model version is swapped in. Only the messages needing the classifier
- A locked message can be Completed, Abandoned, Dead-lettered, or Deferred
Beyond complete, the SDK exposes abandon (release the lock for immediate redelivery, incrementing the delivery count), dead_letter (move to the DLQ with a reason), and defer (set aside for later retrieval by sequence number). Each is an explicit settlement action only valid on a PeekLock message.
Trap Calling abandon or dead_letter on a message received in ReceiveAndDelete mode.
12 questions test this
- An on-call engineer must read the payloads of the oldest messages sitting on a busy production Azure Service Bus queue to confirm a suspected producer bug. The live consumers must keep receiving norma
- About one message in a thousand on an orders queue carries a payload that fails schema validation, and the identical payload fails on every delivery. Support engineers must later be able to see which
- A queue consumer posts each message to an internal REST service that returns HTTP 503 for about two minutes every night while that service restarts. During the window the handler fails, and the team w
- An internal repair tool your team maintains receives from a queue's dead-letter subqueue, fixes each payload, and sends the corrected message back to the main queue. The main queue drains normally, bu
- An orchestration service defers Azure Service Bus messages whose prerequisite work has not finished, recording each sequence number in a local cache. A container restart wipes that cache, and the defe
- Your team plans to raise the lock duration on a live Azure Service Bus queue because handlers occasionally exceed the current value. Roughly two hundred messages are under peek-lock at any moment, and
- Enrichment work in a queue consumer calls an embedding model and routinely runs longer than the lock duration configured on the queue. Completing the message then throws a lock-lost error, the same en
- An Azure Service Bus consumer logs message-lock-lost errors on its completion calls several times an hour, and the captured locked-until timestamps still show time remaining on those locks. The team a
- A fulfillment workflow receives a payment-confirmation message from the provider before the matching purchase order has propagated from the storefront, so the handler cannot process the confirmation y
- A queue consumer hands each received message to a background task and lets the receiver's context manager close as soon as the batch loop ends; the background task calls Complete when its own work fin
- A moderation consumer reads Azure Service Bus messages and calls a classifier that is unavailable for a few minutes whenever a new model version is swapped in. Only the messages needing the classifier
- A generic retry decorator wraps an Azure Service Bus handler and replays the whole handler body, including its completion call, whenever any exception escapes. On second attempts the consumer now logs
- Locks expire after the lock duration unless renewed; the max delivery count governs redelivery
A PeekLock lock is held only for the entity's lock duration; long-running work must renew the lock (for example with an auto lock renewer) or the message unlocks and is redelivered. Repeated redeliveries eventually exceed the max delivery count.
- The dead-letter queue is a secondary sub-queue of its parent entity, not an entity you provision
Dead-lettered messages land in a dead-letter queue (DLQ), a secondary sub-queue belonging to the queue or topic subscription itself rather than a separate entity. It can't be deleted or managed independently of the main entity, messages can only be submitted to it via the dead-letter operation of the parent, time-to-live isn't observed there, and there's no automatic cleanup: messages stay until you receive and complete them. What you configure is the entity's dead-lettering settings, never the sub-queue itself.
Trap Expecting dead-lettered messages to age out of the DLQ on their own.
12 questions test this
- You develop a Python service that consumes an Azure Service Bus topic named Events through a subscription named Scoring, one of three subscriptions on that topic. Only Scoring dead-lettered a batch of
- You develop a Python batch-scoring worker that reads an Azure Service Bus queue. Each request message carries a short time to live because a stale score is worthless to the caller. Compliance now requ
- You develop a Python triage service for an Azure Service Bus namespace in which eight queues each forward their dead-lettered messages to one queue named repairs. The service receives from repairs and
- You develop a Python reprocessing job that runs nightly in Azure Container Apps and must replay the messages that an Azure Service Bus queue named Ingest rejected during the day. You use the azure-ser
- You develop a Python consumer on Azure Container Apps that receives Azure Service Bus messages in PeekLock mode and parses each JSON payload before enriching it with an embedding. A small share of mes
- You develop a Python scoring worker that reads an Azure Service Bus topic subscription whose SQL rule selects messages by an application property. A recent publisher change makes that rule fail while
- You develop a Python producer that sends inference requests to an Azure Service Bus queue named Intake. Intake is configured to autoforward into a session-enabled queue named Ordered, where a downstre
- You build a Python order-fulfillment worker that consumes an Azure Service Bus queue. When a payment notification arrives before its matching purchase order, the worker defers the message and moves on
- You support thirty Azure Service Bus queues in one namespace that feed Python inference workers on Azure Container Apps. The platform team must be paged as soon as messages start landing in any queue'
- You develop a Python triage job for an Azure Service Bus namespace in which a subscription named Handoff autoforwards enriched inference results into a partner-owned queue. That queue was disabled for
- You develop a Python service that consumes an Azure Service Bus topic named Telemetry through a subscription named Enrich. A dashboard shows the topic's active message count sitting at zero while the
- Your team builds a Python worker on Azure Functions that reads an Azure Service Bus queue and calls a model endpoint. A design review proposes provisioning a second Service Bus queue named orders-fail
- Messages dead-letter when the max delivery count is exceeded, TTL expires, or the app calls dead_letter
Service Bus moves a message to the DLQ automatically when it exceeds the max delivery count (repeated abandon/lock loss) or when its time-to-live expires with dead-lettering on expiration enabled. The application can also dead-letter a message explicitly (for example, a poison/unparseable payload).
Trap Expecting an expired message to reach the DLQ with dead-lettering on expiration switched off.
10 questions test this
- You develop a Python service on Azure Kubernetes Service that receives Azure Service Bus messages in PeekLock mode, hands each one to a background task, and closes the receiver as soon as the batch lo
- You develop a Python batch-scoring worker that reads an Azure Service Bus queue. Each request message carries a short time to live because a stale score is worthless to the caller. Compliance now requ
- You develop a Python consumer on Azure Container Apps that receives Azure Service Bus messages in PeekLock mode and parses each JSON payload before enriching it with an embedding. A small share of mes
- You develop a Python scoring worker that reads an Azure Service Bus topic subscription whose SQL rule selects messages by an application property. A recent publisher change makes that rule fail while
- You develop a Python producer that sends inference requests to an Azure Service Bus queue named Intake. Intake is configured to autoforward into a session-enabled queue named Ordered, where a downstre
- You develop a Python drain job that reads an Azure Service Bus queue's dead-letter subqueue in PeekLock mode and republishes each repaired message. Some messages can never be repaired. The team assume
- You develop a Python coordinator on Azure Container Apps that defers each Azure Service Bus request whose tenant index is still rebuilding, recording the sequence number of every deferred request. The
- You build a Python order-fulfillment worker that consumes an Azure Service Bus queue. When a payment notification arrives before its matching purchase order, the worker defers the message and moves on
- You develop a Python worker that consumes an Azure Service Bus queue in a Standard-tier namespace. When enrichment raises an unrecoverable error the worker dead-letters the message and puts the failur
- Your team builds a Python worker on Azure Functions that reads an Azure Service Bus queue and calls a model endpoint. A design review proposes provisioning a second Service Bus queue named orders-fail
- Read the DLQ by opening a receiver on the entity's /$deadletterqueue sub-path
To inspect or reprocess dead-lettered messages you open a receiver against the sub-queue formatted as /$DeadLetterQueue (or /subscriptions//$DeadLetterQueue). In the Python SDK this is done via the sub_queue=ServiceBusSubQueue.DEAD_LETTER option when creating the receiver.
8 questions test this
- You develop a Python service that consumes an Azure Service Bus topic named Events through a subscription named Scoring, one of three subscriptions on that topic. Only Scoring dead-lettered a batch of
- You develop a Python triage service for an Azure Service Bus namespace in which eight queues each forward their dead-lettered messages to one queue named repairs. The service receives from repairs and
- You develop a Python reprocessing job that runs nightly in Azure Container Apps and must replay the messages that an Azure Service Bus queue named Ingest rejected during the day. You use the azure-ser
- You develop a Python repair job for a session-enabled Azure Service Bus queue in which each session carries one customer's ordered updates. The job receives from the dead-letter subqueue, corrects eac
- You develop a Python drain job that reads an Azure Service Bus queue's dead-letter subqueue in PeekLock mode and republishes each repaired message. Some messages can never be repaired. The team assume
- You develop a Python coordinator on Azure Container Apps that defers each Azure Service Bus request whose tenant index is still rebuilding, recording the sequence number of every deferred request. The
- You develop a Python triage job for an Azure Service Bus namespace in which a subscription named Handoff autoforwards enriched inference results into a partner-owned queue. That queue was disabled for
- You develop a Python service that consumes an Azure Service Bus topic named Telemetry through a subscription named Enrich. A dashboard shows the topic's active message count sitting at zero while the
- Dead-lettered messages carry DeadLetterReason and DeadLetterErrorDescription properties
When a message is dead-lettered the broker (or app) records DeadLetterReason and DeadLetterErrorDescription in the message's application properties, letting an operator triage why delivery failed before reprocessing.
- Sessions provide guaranteed FIFO ordering for all messages sharing a session id
Enabling sessions on a queue/subscription groups messages by SessionId and locks an entire session to one receiver, guaranteeing first-in-first-out processing within that session. This is how you achieve ordered, related-message processing that a plain competing-consumer queue cannot.
Trap A session must be enabled at entity creation; you cannot get per-key ordering from a non-session queue just by setting SessionId.
10 questions test this
- A Python worker on Azure Container Apps holds one session of a session-enabled Azure Service Bus queue in which each session carries one patient's chart updates. To raise throughput the team now recei
- A partner's ordering system publishes to your session-enabled Azure Service Bus queue over AMQP 1.0 using a generic client library rather than an Azure SDK. Its orders must join the same per-customer
- An order pipeline uses a session-enabled Azure Service Bus queue keyed by order identifier, and some sessions sit idle for hours while an upstream approval completes. Auditors report that an entire or
- An Azure Service Bus queue in production has been receiving unordered work items for two years. A porting team now stamps every message with a session ID matching the tenant and rewrites the consumer
- A telemetry publisher packs several hundred device readings into a single Azure Service Bus message batch and sends it to a session-enabled queue, using each device's identifier as the session ID so a
- A claims service on Azure Kubernetes Service runs eight workers, each holding one session of a session-enabled Azure Service Bus queue keyed by claim number. A worker keeps its session receiver open a
- An order pipeline uses one Azure Service Bus session per order on a session-enabled queue, and an order's messages can arrive over several hours. A worker must recognize when an order is complete so t
- A worker pool on Azure Kubernetes Service drains a session-enabled Azure Service Bus queue in which each session corresponds to one customer order. The publisher creates sessions dynamically, so no wo
- A pricing service publishes quote requests from many client instances onto one Azure Service Bus request queue, and a pool of workers writes each answer onto a shared, session-enabled reply queue. Eve
- A billing reconciliation service on Azure Container Apps runs several replicas that all consume one Azure Service Bus queue. Ledger events for a single account must be applied in the order the publish
- A session receiver accepts a specific or the next available session and holds a session lock
To read a session-enabled entity you create a session receiver, which locks one session and delivers its messages in order. In Python there is no separate accept call: the session is chosen through the same receiver factory, either get_queue_receiver(queue_name=..., session_id="") for a named session or session_id=NEXT_AVAILABLE_SESSION to take whichever session is free. Session state can be persisted on the broker through the receiver's session object to checkpoint per-session progress.
Trap Hunting for a separate accept-session call in the Python SDK.
10 questions test this
- A Python worker on Azure Container Apps holds one session of a session-enabled Azure Service Bus queue in which each session carries one patient's chart updates. To raise throughput the team now recei
- A loan-origination workflow on Azure Container Apps records each application's progress in the session state of its Azure Service Bus session, keyed by application number, so a restarted worker resume
- A support dashboard must list the messages still waiting on a session-enabled Azure Service Bus queue, grouped by session, and refresh that list every minute. The worker fleet processing those session
- An Azure Service Bus queue in production has been receiving unordered work items for two years. A porting team now stamps every message with a session ID matching the tenant and rewrites the consumer
- A long-running document-approval workflow processes one Azure Service Bus session per case, and a case's messages can arrive over several hours. When a worker instance is evicted mid-case, another ins
- A claims service on Azure Kubernetes Service runs eight workers, each holding one session of a session-enabled Azure Service Bus queue keyed by claim number. A worker keeps its session receiver open a
- An order pipeline uses one Azure Service Bus session per order on a session-enabled queue, and an order's messages can arrive over several hours. A worker must recognize when an order is complete so t
- A worker pool on Azure Kubernetes Service drains a session-enabled Azure Service Bus queue in which each session corresponds to one customer order. The publisher creates sessions dynamically, so no wo
- A pricing service publishes quote requests from many client instances onto one Azure Service Bus request queue, and a pool of workers writes each answer onto a shared, session-enabled reply queue. Eve
- A billing reconciliation service on Azure Container Apps runs several replicas that all consume one Azure Service Bus queue. Ledger events for a single account must be applied in the order the publish
- Message time-to-live expires undelivered messages, optionally routing them to the DLQ
Each message has a time-to-live (defaulting to the entity's default TTL, capped by it); once it expires the message is removed, and if dead-lettering on message expiration is enabled it is moved to the DLQ instead of being silently dropped.
Trap Setting a per-message TTL longer than the entity's default and expecting it to hold.
6 questions test this
- An ingestion queue in Azure Service Bus was created with a default message time-to-live of one hour. A new publisher sets a seven-day time-to-live on every message it sends so that a weekend outage of
- An order pipeline uses a session-enabled Azure Service Bus queue keyed by order identifier, and some sessions sit idle for hours while an upstream approval completes. Auditors report that an entire or
- An operations console browses an Azure Service Bus queue with the peek operation and lists, for every waiting message, how long is left before it expires. The queue carries a default message time-to-l
- A pricing service sends quotes to an Azure Service Bus queue with a short message time-to-live and dead-lettering on message expiration enabled, so a quote nobody consumed in time is captured for audi
- A media-transcoding consumer reads from an Azure Service Bus queue in peek-lock mode, and some jobs take longer than the message time-to-live configured on the queue. Dead-lettering on message expirat
- An audit rule states that no copy of an event delivered through an Azure Service Bus topic may stay retrievable for longer than one hour, and product teams keep creating new subscriptions on that topi
- ServiceBusClient is the connection factory that creates senders and receivers
A single ServiceBusClient (built from a namespace + DefaultAzureCredential or a connection string) is the entry point; you call get_queue_sender / get_queue_receiver (or the topic/subscription variants) to obtain a ServiceBusSender for publishing and a ServiceBusReceiver for consuming. Messages are ServiceBusMessage objects.
8 questions test this
- You are moving a Python message producer from a developer laptop to Azure Container Apps, where the revision runs under a user-assigned managed identity holding the Azure Service Bus Data Sender role
- Your ingestion service publishes extraction requests to an Azure Service Bus queue from a Python worker. The excerpt carried by each request varies widely in size, and the worker currently passes a li
- An Azure Service Bus queue drives a batch-scoring service that you develop in Python. When a job is accepted, the service must place a cleanup message that becomes available to consumers six hours lat
- A Python service publishes to an Azure Service Bus queue that has duplicate detection enabled. For each accepted transcription job it schedules a follow-up message for two hours later and immediately
- A nightly reconciliation job must read the messages that Azure Service Bus moved to the dead-letter subqueue of a queue named invoices, inspect each dead-letter reason, and complete the ones it can di
- Your document-extraction service publishes work items to an Azure Service Bus topic named jobs and consumes them from a subscription named ocr on that topic. The Python worker authenticates with Defau
- A Python web API that you maintain on Azure Container Apps publishes one Azure Service Bus message per HTTP request. Each request handler constructs a ServiceBusClient, obtains a queue sender from it,
- You deploy a Python consumer for an Azure Service Bus queue to an Azure Kubernetes Service cluster whose egress firewall permits outbound TCP 443 only. The pod authenticates with a managed identity an
- The processor model registers message/error handler callbacks and can auto-complete on success
The event-driven ServiceBusProcessor (.NET) registers a message handler and an error handler and continuously pumps messages, auto-completing them on success unless auto-complete is disabled; the Python SDK achieves the same by iterating a ServiceBusReceiver and settling each message explicitly.
Trap Expecting the Python receiver to auto-complete messages the way the .NET processor does.
6 questions test this
- You maintain a long-running Python consumer for an Azure Service Bus queue that has to keep pulling and settling messages for as long as its container runs, rather than issuing a fresh request for eac
- You are adding a support endpoint to a Python service that lists the messages currently waiting in an Azure Service Bus queue so the team can see what is backed up. The listing must not consume or loc
- A team is porting a Service Bus consumer from the .NET ServiceBusProcessor, which completed each message automatically when the handler returned successfully, to Python with the azure-servicebus libra
- A summarization worker receives Service Bus messages in the default peek-lock mode and calls a model that routinely runs longer than the queue's lock duration, which is already at the documented maxim
- A .NET back-end service registers a message handler and an error handler on a Service Bus processor and leaves the processor's automatic completion enabled. The handler wraps its whole body in a catch
- A .NET consumer on Azure Container Apps processes Azure Service Bus messages through a processor whose handlers are registered once at startup. A downstream vector store is taken offline for maintenan
- Duplicate detection discards messages with a repeated MessageId within a configured time window
When duplicate detection is enabled on a queue/topic, the broker ignores any incoming message whose MessageId matches one seen within the configured detection history window (default 10 minutes, minimum 20 seconds, maximum 7 days). A suppressed send still reports success to the sender, and no part of the message other than the MessageId is considered, so the sender must set a stable, reconstructible MessageId for this to work.
Trap Expecting a send suppressed by duplicate detection to surface as an error.
6 questions test this
- Your ingestion worker receives Service Bus messages in peek-lock mode, writes each result to Azure Cosmos DB, and then completes the message. When a replica is evicted mid-batch, the broker redelivers
- An Azure Service Bus queue that is partitioned and has duplicate detection enabled receives enrichment requests. The publisher stamps every message with a stable MessageId and with a partition key equ
- An existing Azure Service Bus queue named ingest was created without duplicate detection. Its publisher has started resending messages after transient failures, and the team now wants the broker itsel
- A Python service publishes to an Azure Service Bus queue that has duplicate detection enabled. For each accepted transcription job it schedules a follow-up message for two hours later and immediately
- You are sizing duplicate detection for an Azure Service Bus queue that carries a high, steady volume of embedding requests. The publisher's retry policy gives up a few minutes after the first attempt,
- A publisher writes enrichment requests to an Azure Service Bus queue on the Standard tier that has duplicate detection enabled. When the network drops an acknowledgment, the publisher's retry policy s
- Messages can be scheduled for future enqueue via a scheduled enqueue time
A sender can schedule a message to become available at a future instant by setting its scheduled enqueue time (or calling schedule_messages), which returns a sequence number that can be used to cancel the scheduled delivery before it fires.
Implement event-driven workflows with Azure Event Grid
Read full chapterCheat sheet
Sharp facts the exam loves — scan these before test day.
- Applications publish custom events to a custom topic's endpoint URI, authenticated by access key or identity
A custom (application) topic exposes an HTTPS endpoint to which your app POSTs events; the publisher authenticates with the topic's access key (or SAS token, or a managed identity with the EventGrid Data Sender role). This is how first-party app events enter Event Grid.
14 questions test this
- A Python reconciliation job in your on-premises data center publishes custom events to an Event Grid custom topic with a valid topic access key. After the security team hardened the topic, every reque
- A Python order service publishes custom events to an Event Grid custom topic in a single Azure region. The business requires that publishing resume within minutes of that region becoming unavailable,
- A Python ingestion service on Azure Container Apps publishes custom events to an Event Grid custom topic with its managed identity. Your security baseline states that the service's identity must never
- Six Python microservices, each deployed as its own Azure Container Apps app, publish custom events to one Event Grid custom topic. The platform team wants a single identity to authorize all six, wants
- You develop a Python telemetry service for a SaaS product that has several thousand customer organizations. Each customer must be able to subscribe to the events raised for its own organization only,
- Your Python service posts one JSON object per event to an Event Grid custom topic's endpoint with a valid access key in the aeg-sas-key header. Every request returns 400 Bad Request even though the ob
- You develop a Python scoring service that runs on virtual machines in an Azure virtual network and publishes custom events to an Event Grid custom topic. A new policy states that traffic between the s
- You develop a Python order-processing service that runs in Azure Container Apps. The service raises its own business events, such as order-created, and several Azure Functions must react to them throu
- Your Python release service pushes container images to Azure Container Registry and then publishes an image-published custom event to an Event Grid custom topic that an Azure Function consumes. Two bu
- Your Python service accumulates custom events and posts them to an Event Grid custom topic. During a nightly reconciliation run it gathers thousands of events and posts them in a single request; Event
- You develop a Python inventory service hosted on Azure App Service that publishes custom events to an Event Grid custom topic named Topic1. A new security standard forbids the service from holding any
- Your Python publisher sends CNCF CloudEvents 1.0 messages to an Event Grid domain that was created with the CloudEvents v1.0 input schema. The domain holds one topic per partner, and each message has
- A deployment pipeline writes the Event Grid publishing target into your Python service's configuration. After a pipeline change, every POST from the service is answered with 404 Not Found, although th
- A partner team must publish events to your Event Grid custom topic named Topic1 during a two-week integration test. The partner's application runs outside your Microsoft Entra tenant, so you cannot as
- An Event Grid schema event requires id, subject, eventType, eventTime, and data; dataVersion, topic, and metadataVersion are optional
A custom event in the native Event Grid schema must supply id, subject, eventType, eventTime, and data (the payload). dataVersion is optional and is stamped with an empty value when omitted, while topic and metadataVersion are stamped by Event Grid. The subject and eventType are the fields most subscriptions filter on, so publishers set them deliberately to enable routing.
Trap Treating topic as a field the publisher has to populate on a custom event.
8 questions test this
- A Python billing service publishes invoice-created events to an Event Grid custom topic, and an Azure Function subscriber posts one ledger entry per event. After a partial outage, operations confirmed
- Your Python service publishes custom events to an Event Grid custom topic. You are adding three fields to the data payload, and several subscribers will lag behind that change, so each subscriber must
- You develop a Python telemetry service for a SaaS product that has several thousand customer organizations. Each customer must be able to subscribe to the events raised for its own organization only,
- Your Python service posts one JSON object per event to an Event Grid custom topic's endpoint with a valid access key in the aeg-sas-key header. Every request returns 400 Bad Request even though the ob
- Your team is standardizing on Event Grid namespaces. One Python publisher is a packaged component you cannot modify: it posts arrays of events in the native Event Grid schema, and its events must keep
- A code review of your Python publisher shows that the events it posts to an Event Grid custom topic set id, subject, eventType, eventTime, data, and dataVersion, but never set topic or metadataVersion
- A legacy Python component publishes JSON objects whose fields are named myEventTypeField, resource, and resourceData. Those objects must be routed through a new Event Grid custom topic to Azure Functi
- A deployment pipeline writes the Event Grid publishing target into your Python service's configuration. After a pipeline change, every POST from the service is answered with 404 Not Found, although th
- Event Grid supports the CNCF CloudEvents 1.0 JSON schema in addition to its native schema
A topic can be configured to use the CloudEvents 1.0 schema (fields include specversion, type, source, id, time, subject, and data) for interoperability with other CloudEvents systems. The schema is set with two separate knobs, not one: the input schema is fixed when the topic is created (--input-schema), while the output (delivery) schema is chosen per event subscription (--event-delivery-schema). Event Grid input can be delivered as CloudEvents, but CloudEvents input cannot be delivered in the Event Grid schema, because CloudEvents extension attributes have no place in it.
Trap Assuming a single schema setting on the topic governs both input and delivery.
6 questions test this
- Your team integrates a third-party workflow engine that already emits CNCF CloudEvents 1.0 JSON messages and cannot be modified. Those messages must enter a new Event Grid custom topic and then be pus
- An Event Grid custom topic was created with the CloudEvents v1.0 input schema and already serves several standards-based subscribers. You must now deliver the same category of events to an internal ha
- Several in-house Python services already publish to an Event Grid custom topic in the native Event Grid schema, and you cannot change them. A new partner subscriber accepts only CNCF CloudEvents 1.0 J
- Your team is standardizing on Event Grid namespaces. One Python publisher is a packaged component you cannot modify: it posts arrays of events in the native Event Grid schema, and its events must keep
- You add an Event Grid publisher to a Python microservice with a CloudEvents client library that can send an event in binary content mode, with the CloudEvents attributes as individual HTTP headers, or
- Your Python publisher sends CNCF CloudEvents 1.0 messages to an Event Grid domain that was created with the CloudEvents v1.0 input schema. The domain holds one topic per partner, and each message has
- Subject filtering routes events with subjectBeginsWith and subjectEndsWith prefix/suffix matches
An event subscription can filter on the event's subject using subjectBeginsWith (for example a folder path prefix) and subjectEndsWith (for example a file extension), plus a case-sensitivity flag. This is the lightweight first-line filter for narrowing which events a handler receives.
11 questions test this
- You develop an Azure Function app that generates thumbnails for a marketing site. One Azure Storage container receives mixed uploads: .jpg photos, .csv price lists, and .pdf brochures. A system topic
- You maintain a compliance handler that must be notified whenever a partner deletes a report from the reports container of an Azure Storage account. Reports are the only .csv files in that container, a
- Two Azure Container Apps write to one Azure Storage account: one to a container named model-inputs and one to a container named eval-results. A single Azure Function must be invoked for blobs created
- You develop a document-ingestion service that runs on Azure Container Apps. One Azure Storage account holds containers named invoices, invoices-archive, and invoices-staging, and a system topic publis
- An Azure Storage account backs a retrieval-augmented generation pipeline that runs on Azure Container Apps. A system topic publishes blob events for the whole account, and a housekeeping handler must
- You subscribe a handler to a custom Azure Event Grid topic whose publisher sets every subject in the form /region/tenant/workload/action. The handler must receive the events of one tenant regardless o
- Your team subscribes an Azure Function to the blob events of an Azure Storage account that several partners upload to. Some partners write to container paths that use uppercase folder names, and the f
- You add an audit handler to an Azure Storage account whose blob events are published through a system topic. The audit handler must receive Microsoft.Storage.BlobCreated events for every blob in every
- Partners upload files into one container of an Azure Storage account through a portal that strips file extensions, so blobs arrive with names such as 7f3a-9c21 and no suffix at all. A system topic pub
- Your Python service publishes ingestion events to a custom Azure Event Grid topic. Two teams will each create an event subscription that uses only the subject prefix filter: one team wants every event
- A data pipeline writes each Parquet extract into an Azure Data Lake Storage Gen2 account that has a hierarchical namespace, staging it under a .tmp name and renaming it to its final name once the writ
- Advanced filters test individual event fields with operators such as StringContains and NumberGreaterThan
Advanced filters evaluate a specific key inside the event (including data payload fields) with operators like StringIn, StringContains, NumberGreaterThan, and BoolEquals, allowing precise content-based routing beyond subject prefixes. Multiple advanced filters combine with AND semantics.
Trap Expecting multiple advanced filters to match when only one of them is satisfied.
19 questions test this
- You build a retrieval-augmented generation ingestion pipeline. Partners upload large documents to an Azure Data Lake Storage Gen2 account that has a hierarchical namespace enabled, and each Microsoft.
- Your Python publisher enriches every event that it sends to a custom Azure Event Grid topic with a claim whose property name is literally user.email, dot included, inside the data object. You add an a
- Your Python enrichment service publishes a document-indexed event to an Azure Event Grid custom topic for every chunked document, and it sets the data payload's summary field to null whenever the summ
- Your Python service publishes document-ingested events to an Azure Event Grid custom topic and stamps each event's dataVersion with the schema version of its data object. You are about to publish a se
- Your Python publisher sends events to a custom Azure Event Grid topic, and each event's data payload carries a labels field that holds an array of strings such as invoice, urgent, and partner. A handl
- Your Python service publishes model-evaluation events to a custom Azure Event Grid topic, and each payload carries a modelFamily string and an isProduction boolean. A dashboards handler must receive o
- You maintain a compliance handler that must be notified whenever a partner deletes a report from the reports container of an Azure Storage account. Reports are the only .csv files in that container, a
- Several partners upload documents over SFTP into one Azure Data Lake Storage Gen2 account, each authenticating as its own local user, and every partner writes into the same directory. A system topic p
- Your Python service publishes document-ingestion events to a custom Azure Event Grid topic, and each event's data payload carries a numeric pageCount field. A premium handler must receive only the eve
- Two Azure Container Apps write to one Azure Storage account: one to a container named model-inputs and one to a container named eval-results. A single Azure Function must be invoked for blobs created
- An Azure Storage account backs a retrieval-augmented generation pipeline that runs on Azure Container Apps. A system topic publishes blob events for the whole account, and a housekeeping handler must
- An Azure App Configuration store holds one set of keys whose values are separated per environment by the labels test, staging and production. A system topic publishes the store's key-value events, and
- Your Python publisher sends events to a custom Azure Event Grid topic. Most events carry a data field named channel, but the events from an older client omit that field entirely. A handler must receiv
- You subscribe a handler to a custom Azure Event Grid topic whose publisher sets every subject in the form /region/tenant/workload/action. The handler must receive the events of one tenant regardless o
- Partners upload files into one container of an Azure Storage account through a portal that strips file extensions, so blobs arrive with names such as 7f3a-9c21 and no suffix at all. A system topic pub
- An Azure Container Registry holds a model-serving image repository named scoring-api alongside about forty base and utility repositories, and platform teams add repositories often. A system topic publ
- Your Python evaluation service publishes a job-completed event to an Azure Event Grid custom topic for every model evaluation run, and each event's data payload carries a numeric durationSeconds value
- Your Python ingestion service publishes custom events to an Azure Event Grid custom topic. The event types follow a naming scheme such as Contoso.Ingestion.DocumentReceived, Contoso.Ingestion.Document
- A data pipeline writes each Parquet extract into an Azure Data Lake Storage Gen2 account that has a hierarchical namespace, staging it under a .tmp name and renaming it to its final name once the writ
- includedEventTypes limits a subscription to specific event types
A subscription can restrict delivery to a named list of event types via includedEventTypes; omitting it delivers all event types published to the topic. This is the coarsest, most common filter for custom-event workflows.
- Event Grid retries failed deliveries with exponential back-off, bounded by max attempts and event TTL
If a handler does not return success, Event Grid retries with an exponential back-off schedule until either the configured maximum delivery attempts or the event time-to-live is reached. Tuning these two retry-policy values controls how long a transient handler outage is tolerated.
Trap Raising max delivery attempts when the event time-to-live is what expires first.
14 questions test this
- An Azure Event Grid custom topic has eight event subscriptions. One of them feeds a payments handler, and the on-call team must be paged as soon as that subscription starts dead-lettering, without bei
- A Python handler on Azure App Service receives events from an Azure Event Grid custom topic. It finishes processing each event in under a second, then replies 206 Partial Content because it echoes onl
- An Azure Event Grid subscription delivers blob-created events to a webhook that was down for an hour. The handler is healthy again and now returns 200 OK to everything it receives, yet both the backlo
- To cut HTTP overhead your team turned on output batching for an Azure Event Grid subscription and set a high maximum events per batch. The Python webhook needs about a minute to finish a full batch an
- An Azure Event Grid subscription batches events to a webhook whose gateway rejects any request body over a fixed size with 413 Request Entity Too Large. Your team set the subscription's preferred batc
- A cleanup script deleted the storage container that an Azure Event Grid subscription used as its dead-letter destination. Two days later the subscription's webhook was unreachable for a full weekend w
- Your team operates an Azure Event Grid custom topic whose webhook handler fails intermittently for short periods. The team wants Event Grid to retry every 30 seconds for one hour rather than following
- You develop a Python handler on Azure App Service that receives events from an Azure Event Grid custom topic and writes one Azure Cosmos DB item per event. Under load the handler occasionally returns
- You subscribe a Python webhook to an Azure Event Grid custom topic. The handler returns 400 Bad Request for events whose data version it can't parse. Dead-lettering to an existing blob container is en
- You subscribe an HTTPS webhook to a custom Azure Event Grid topic that publishes inference-completion events. The webhook goes offline for planned maintenance windows of about two hours, and every eve
- An Azure Event Grid custom topic subscription delivers inference-completion events to an HTTPS handler that has been failing steadily for the past hour. The subscription keeps the default retry policy
- An Azure Event Grid custom topic has two event subscriptions carrying the same events, both left on the default retry policy. One delivers to an Azure Service Bus queue and the other to an HTTPS webho
- Your Python webhook, hosted on Azure App Service, must stay on App Service. It receives events from an Azure Event Grid custom topic and generates embeddings that take two to three minutes before it r
- You set the event time-to-live on an Azure Event Grid subscription to 15 minutes and configure dead-lettering to an existing blob container. During a two-hour handler outage, your team finds that dead
- Undelivered events dead-letter to an Azure Storage blob container, which must exist first
When retries are exhausted, Event Grid writes the event to a dead-letter destination that is an Azure Storage blob container; the storage account and container must already exist before the subscription is created, and Event Grid names each blob after the subscription in upper case. Enabling a system- or user-assigned managed identity for dead-lettering is OPTIONAL, and only when one is enabled must that identity hold an RBAC role permitting writes to the storage. Storage queues are not a valid Event Grid dead-letter target.
Trap Expecting Event Grid to create the dead-letter storage container for you.
15 questions test this
- An Azure Event Grid subscription writes undelivered events to a dead-letter blob container in a general-purpose v2 storage account. Your operations team must be notified within a minute of any event l
- An Azure Event Grid custom topic has eight event subscriptions. One of them feeds a payments handler, and the on-call team must be paged as soon as that subscription starts dead-lettering, without bei
- A Python handler on Azure App Service receives events from an Azure Event Grid custom topic. It finishes processing each event in under a second, then replies 206 Partial Content because it echoes onl
- You enable dead-lettering on an Azure Event Grid custom topic subscription and select the topic's system-assigned managed identity for the dead-letter destination, an existing blob container. Company
- To cut HTTP overhead your team turned on output batching for an Azure Event Grid subscription and set a high maximum events per batch. The Python webhook needs about a minute to finish a full batch an
- An Azure Event Grid subscription batches events to a webhook whose gateway rejects any request body over a fixed size with 413 Request Entity Too Large. Your team set the subscription's preferred batc
- A cleanup script deleted the storage container that an Azure Event Grid subscription used as its dead-letter destination. Two days later the subscription's webhook was unreachable for a full weekend w
- A push event subscription on an Azure Event Grid namespace topic carries two custom delivery properties: a routing header and an API key that was marked as a secret when the subscription was created.
- You subscribe a Python webhook to an Azure Event Grid custom topic. The handler returns 400 Bad Request for events whose data version it can't parse. Dead-lettering to an existing blob container is en
- An Azure Event Grid custom topic subscription delivers inference-completion events to an HTTPS handler that has been failing steadily for the past hour. The subscription keeps the default retry policy
- One Azure Event Grid custom topic feeds four event subscriptions: two Azure Functions, an Azure Service Bus queue and a partner webhook. Only the webhook subscription has a dead-letter destination. A
- You write a Python reconciliation job that reads dead-lettered events from an Azure Event Grid dead-letter container and republishes them to the topic. The job deserializes each blob into a single eve
- You set the event time-to-live on an Azure Event Grid subscription to 15 minutes and configure dead-lettering to an existing blob container. During a two-hour handler outage, your team finds that dead
- A Python consumer app uses pull delivery to read CloudEvents from a queue event subscription on an Azure Event Grid namespace topic, and the subscription has a dead-letter destination. Some events car
- A publisher sends CloudEvents to an Azure Event Grid namespace topic in binary content mode, using a binary media type for the payload. Some events are dead-lettered to your blob container. You are wr
- Some handler responses are non-retriable and dead-letter immediately
Certain HTTP responses from a webhook handler (for example 400 Bad Request or 413 Payload Too Large) are treated as non-retriable, so Event Grid stops retrying and, if dead-lettering is configured on the subscription, dead-letters the event right away; dead-lettering is off by default, and with no dead-letter destination configured the event is dropped instead. 5xx responses and timeouts are retried under the back-off policy.
- A custom webhook endpoint must complete the subscription validation handshake before it receives events
When you create a subscription to a webhook that Azure does not validate automatically (which includes an HTTP-triggered Azure Function, not only endpoints outside Azure), Event Grid sends a SubscriptionValidationEvent containing a validationCode; the endpoint must echo that code back in a validationResponse (synchronous) or use the manual validationUrl handshake, proving ownership before delivery begins.
Trap Assuming an HTTP-triggered Azure Function is validated automatically because it lives in Azure.
14 questions test this
- You place a Python webhook handler behind an Azure Application Gateway that has the web application firewall enabled, then create an Event Grid event subscription that targets its public HTTPS URL. Su
- You deploy a Python function app that must handle Blob Storage created events routed through an Event Grid system topic. The team will not write any code that answers the subscription validation hands
- An Event Grid event subscription currently delivers to a webhook hosted at an old hostname. Your team stands up a replacement service at a new HTTPS hostname and plans to point the existing subscripti
- Your team hosts a Python event handler on Azure App Service, reachable at a public HTTPS URL that is secured with a self-signed certificate the team generated. Creating an Event Grid event subscriptio
- An Event Grid event subscription targets a partner HTTPS endpoint that acknowledges the validation POST but cannot echo the code, so the subscription is awaiting manual action. Company policy requires
- Your team protects a public Python webhook so that Event Grid must present a bearer token for a Microsoft Entra application before any event is accepted, and the subscription's destination URL also ca
- A business team must be emailed whenever an Event Grid event reports that a customer contract blob was replaced, and the same workflow has to route the change to a manager for approval. The team canno
- Your public Python webhook already answers the Event Grid synchronous handshake, and your team owns every event subscription that targets it. Security asks you to make sure the endpoint refuses to com
- You publish events to an Azure Event Grid custom topic that uses the Event Grid event schema. You add an event subscription whose endpoint is a Python web API hosted on Azure Container Apps behind a p
- A colleague created an Event Grid event subscription for a third-party HTTPS endpoint that returns 200 but never echoes the validation code, so the subscription entered AwaitingManualAction. Nobody op
- You must subscribe an existing Python function to Blob Storage events raised by an Event Grid system topic. Security has already protected the function app with a Microsoft Entra ID application, and t
- You must deliver Event Grid events from a custom topic to a non-Microsoft SaaS automation service such as Zapier or IFTTT. Its HTTPS endpoint returns HTTP 200 to the validation POST, but the vendor ca
- An Event Grid system topic raises an event whenever a virtual machine is created in your subscription. Your operations team must react by running an existing Azure Automation runbook that tags the new
- Your team routes events from an Azure Event Grid custom topic to a partner's public HTTPS endpoint, and the event subscription is configured to deliver the CloudEvents v1.0 schema rather than the Even
- Event Grid delivers to first-party handlers (Functions, Logic Apps, Service Bus, Storage Queues) and generic webhooks
A subscription's endpoint can be an Azure Function, Logic App, Service Bus queue/topic, Storage Queue, Event Hub, or an arbitrary HTTPS webhook. Azure-native handlers (like Functions with the Event Grid trigger) auto-complete the validation handshake, unlike a raw webhook.
13 questions test this
- An Event Grid custom topic delivers order events to an Azure Service Bus queue that a Python worker consumes. Transient failures at the queue occasionally cause Event Grid to redeliver an event, and t
- You deploy a Python function app that must handle Blob Storage created events routed through an Event Grid system topic. The team will not write any code that answers the subscription validation hands
- Your Azure Event Grid custom topic must push events to a partner's HTTPS webhook. The partner protects that webhook with a Microsoft Entra application registered in the partner's own Microsoft Entra t
- A Python worker enriches each uploaded document, and one run can take several minutes, far longer than a webhook may take to answer Event Grid. The team wants Event Grid to hand each blob created even
- Your enterprise order service consumes Event Grid events from a Service Bus queue that has sessions enabled, so that all events about one order are processed in order by a single consumer. You create
- A business team must be emailed whenever an Event Grid event reports that a customer contract blob was replaced, and the same workflow has to route the change to a manager for approval. The team canno
- An Event Grid custom topic delivers to a partner webhook that requires a custom HTTP header carrying each event's routing region, and the region differs from event to event. Your publisher nests that
- You must subscribe an existing Python function to Blob Storage events raised by an Event Grid system topic. Security has already protected the function app with a Microsoft Entra ID application, and t
- Your Event Grid custom topic has four event subscriptions: one to a partner HTTPS webhook that validates a fixed bearer token it cannot change, one to a Service Bus queue, one to an event hub, and one
- An Event Grid system topic raises an event whenever a virtual machine is created in your subscription. Your operations team must react by running an existing Azure Automation runbook that tags the new
- An Event Grid custom topic delivers events to a queue in an Azure Storage account that the platform team has just placed behind a storage firewall, and that firewall must stay in place. Company policy
- A security review requires that events from an Event Grid custom topic reach a Service Bus queue without the queue's namespace being reachable from the public internet. The team asks you to attach a p
- Blob created events from an Event Grid system topic must reach a listener application that runs on servers inside your corporate network. Security will not publish an inbound HTTPS endpoint for that l
- CloudEvents-schema webhooks validate via the HTTP OPTIONS abuse-protection handshake instead of the validation event
When a subscription uses the CloudEvents 1.0 schema, endpoint validation follows the CloudEvents abuse-protection flow — an HTTP OPTIONS request carrying WebHook-Request-Origin that the endpoint answers with WebHook-Allowed-Origin — rather than echoing a validationCode.
Build serverless APIs with Azure Functions triggers and bindings
Read full chapterUnlock with Premium — includes all practice exams and the complete study guide.
Configure and deploy Azure function apps
Read full chapterUnlock with Premium — includes all practice exams and the complete study guide.
Secure, monitor, and troubleshoot Azure solutions
Secure secrets with Azure Key Vault
Read full chapterCheat sheet
Sharp facts the exam loves — scan these before test day.
- SecretClient authenticated with DefaultAzureCredential retrieves a secret by name from a vault
Instantiate SecretClient(vault_url="https://.vault.azure.net", credential=DefaultAzureCredential()) and call get_secret(name) to read a secret at runtime; DefaultAzureCredential uses the app's managed identity in Azure and developer credentials locally, so no secret or connection string is embedded in code.
Trap Passing a raw API key or hard-coded credential to SecretClient defeats the purpose — the client is meant to be reached with a managed identity via DefaultAzureCredential.
11 questions test this
- Your team rotates a PostgreSQL password that is stored in Azure Key Vault, and each rotation adds a new version under the same secret name. A Python service in Azure Container Apps reads that password
- A Python service in Azure Container Apps authenticates to a partner API with mutual TLS, so it must hold a client certificate and its private key in memory. The certificate is stored in a key vault as
- A Python API on Azure Container Apps reads three secrets from a key vault during startup. After you turn on dependency tracing, every cold start records an HTTP 401 from the vault endpoint followed a
- A Python inference service on Azure Kubernetes Service reads a shared certificate password from a platform-wide key vault and its own model-registry token from a vault dedicated to that service, follo
- A Python API in Azure Container Apps reads several secrets from Azure Key Vault while handling a request. Support tickets show the API reporting 'secret not configured' for values that operators confi
- A Python service reads an API key from Azure Key Vault at startup by supplying only the secret name. During a support investigation you must be able to state exactly which secret version each running
- Your team ships one Python container image that runs both in a commercial Azure subscription and, for a government customer, in an Azure Government subscription. The image builds its SecretClient from
- A Python API on Azure App Service calls Azure Key Vault for the same downstream API key on every incoming request. Under peak load the vault starts returning HTTP 429 responses and request latency ris
- A Python worker caches a downstream service password that it read from Azure Key Vault by name when the process started. After the password is rotated in the vault, the worker keeps presenting the old
- A Python service that reads secrets from Azure Key Vault runs correctly on a developer workstation but fails on its first vault call after you deploy it to an Azure virtual machine. The failure is rai
- A Python inference service scales to dozens of replicas in Azure Kubernetes Service. Every replica reads the same three secrets from one key vault while it starts, and a large scale-out event now driv
- A versionless secret identifier returns the current version; a versioned identifier pins one exact version
A secret identifier without a version segment (.../secrets/), which Key Vault calls a base identifier, resolves to the latest version of the object, while appending a version (.../secrets//) pins that immutable version. get_secret with no version argument returns the latest version.
Trap Pinning a versioned URI means a rotated secret is NOT picked up; use the versionless identifier when you want rotation to flow through automatically.
6 questions test this
- Your team rotates a PostgreSQL password that is stored in Azure Key Vault, and each rotation adds a new version under the same secret name. A Python service in Azure Container Apps reads that password
- An incident review requires you to re-run last month's data-ingestion job exactly as it originally ran, using the same Azure Storage account key that the job used at the time. That key is held in Azur
- A Python service reads an API key from Azure Key Vault at startup by supplying only the secret name. During a support investigation you must be able to state exactly which secret version each running
- A partner API key held in a production key vault appears in a support transcript shared outside the company. Your incident lead has already stamped an expiration timestamp two hours in the past onto t
- An operations engineer stored a database connection string in a key vault with the wrong port number. A change ticket requires the vault to hold the corrected value under the same secret name, and req
- A Python worker caches a downstream service password that it read from Azure Key Vault by name when the process started. After the password is rotated in the vault, the worker keeps presenting the old
- Keys, secrets, and certificates each have a dedicated Key Vault client
The SDK exposes SecretClient for secrets, KeyClient for cryptographic keys, and CertificateClient for certificates; they are separate clients against the same vault endpoint because the three object types have distinct operations and permissions.
- Expiry and not-before are informational for a secret get; only enabled=false blocks retrieval
The exp and nbf attributes on a Key Vault secret are informational for a get - the docs carry a dedicated Date-time controlled operations section stating that a get works for not-yet-valid and expired secrets, so they can be used for test and recovery scenarios. Only enabled=false blocks a get. A get against a disabled version fails and the value cannot be read until the version is re-enabled with update_secret_properties(name, enabled=True).
Trap Setting an expiration date does not stop an application from reading the secret - code that must hard-stop access to a compromised credential has to DISABLE the secret version, not merely expire it.
3 questions test this
- Your team pre-stages next quarter's database credential as a new version in a production key vault six weeks before the cutover and sets that version's not-before attribute to the cutover date. Before
- A partner API key held in a production key vault appears in a support transcript shared outside the company. Your incident lead has already stamped an expiration timestamp two hours in the past onto t
- A Python worker on Azure Container Apps reads five secrets from one key vault at startup with a single client and a single identity. Four reads succeed and the fifth fails on every attempt, and the de
- A Key Vault SDK client's first call returns 401 by design - the challenge that discovers the tenant
Key Vault SDK clients for secrets, keys and certificates send their first request without an access token on purpose: Key Vault answers HTTP 401 with a WWW-Authenticate header naming the authorization endpoint and the resource, and the client then retries with a valid token. A 401 on a process's first Key Vault call is the expected handshake, not a misconfiguration; only a 401 that persists after the retry indicates a real credential or access problem.
Trap A 401 in traces or logs for the first Key Vault call does NOT mean DefaultAzureCredential failed - the handshake is how the client learns which tenant to authenticate against, so chasing it as a credential bug wastes the investigation.
- A SecretClient binds to one vault endpoint, and Managed HSM has no secrets surface at all
A SecretClient is constructed against exactly one vault's data-plane endpoint, and the DNS suffix is cloud-specific (.vault.azure.net in the public cloud, .vault.azure.cn and .vault.usgovcloudapi.net in the sovereign clouds), so the vault URL must be configuration rather than a literal in code that runs across clouds. Managed HSM is a keys-only container reached at .managedhsm.azure.net: it supports HSM-protected keys and nothing else, so secret retrieval has no Managed HSM equivalent.
Trap Managed HSM is not a higher-security drop-in for a vault that stores secrets - it exposes only /keys, so a workload that must RETRIEVE secrets still needs a key vault no matter how strong its HSM requirement is.
5 questions test this
- A release pipeline for an Azure Functions ingestion app needs the value of a storage connection string that is held in a key vault so it can run a post-deployment smoke test. An engineer added a step
- A Python service in Azure Container Apps authenticates to a partner API with mutual TLS, so it must hold a client certificate and its private key in memory. The certificate is stored in a key vault as
- A Python inference service on Azure Kubernetes Service reads a shared certificate password from a platform-wide key vault and its own model-registry token from a vault dedicated to that service, follo
- Your team ships one Python container image that runs both in a commercial Azure subscription and, for a government customer, in an Azure Government subscription. The image builds its SecretClient from
- A compliance review requires that your AI platform's cryptographic key material sit in single-tenant, FIPS 140-3 Level 3 validated hardware. A platform engineer proposes provisioning an Azure Key Vaul
- Key Vault throttles per vault per region, and the subscription ceiling is only five times one vault
Key Vault's transaction budget is enforced per vault per region and answers HTTP 429 once a client exceeds it, so a single high-traffic vault is the bottleneck rather than the subscription. Retrieval scales by caching secrets in memory and re-reading only when the cached copy stops working, and by splitting traffic across multiple vaults - but the subscription-wide ceiling is only five times a single vault's limit, so adding vaults inside one subscription stops helping.
Trap Retrying a 429 immediately does not help; and because the throttle scope is the vault resource, 'use a bigger vault' is not an available move - the levers are caching, more vaults, and eventually more subscriptions.
- Key Vault emits Event Grid events such as SecretNearExpiry and SecretNewVersionCreated to drive rotation
Key Vault publishes lifecycle events (Microsoft.KeyVault.SecretNearExpiry, SecretExpired, SecretNewVersionCreated) to Event Grid; subscribing an Azure Function to SecretNearExpiry lets you generate a new credential in the backing service and add it as a new secret version before the old one expires.
Trap Polling the vault on a timer to check expiry is the anti-pattern the event model replaces — rotation should be event-driven off SecretNearExpiry, not scheduled scanning.
14 questions test this
- An Event Grid-triggered rotation function regenerates the Azure Storage account key that your key vault holds as a secret. A mobile app uploads images into a blob container by using shared access sign
- An Event Grid-triggered function rotates an Azure Storage account access key that your key vault holds as a secret, regenerating the key at the storage account on each near-expiry event. A partner dow
- Your organization's rotation logic already runs in an HTTP-triggered Azure Function that is protected by a Microsoft Entra ID application, so it has to be registered on the Key Vault event subscriptio
- Your platform protects data with a customer-managed key that the security team imported into Azure Key Vault from its own on-premises hardware security module, and the key carries an expiration date.
- An Azure Key Vault secret exposes an Azure Storage account access key to a Python worker running on Azure Container Apps. You must rotate that access key from an Event Grid-triggered function, and the
- Three key vaults, one for production, one for test, and one that a partner manages, each hold a secret named apikey, and each vault has a near-expiry event subscription that delivers to the same rotat
- A rotation function subscribed to a key vault's near-expiry events replaced a database password once and has never run since, although the event subscription is healthy. Each rotation writes the new p
- You are wiring a new Python Azure Function that rotates database credentials to the near-expiry events of an Azure Key Vault. Event Grid must prove ownership of the endpoint without you writing any ha
- An Event Grid-triggered Azure Function rotates an Azure Storage account access key that your key vault holds as a secret. The function app's managed identity already reads and writes the vault's secre
- An API key that your key vault stores as a secret appeared in a support transcript that was shared outside the company, so the credential must be replaced immediately. The vault's near-expiry event fo
- A single Event Grid-triggered Azure Function rotates credentials for several different backing services. When a near-expiry event arrives, the function has to work out which resource to call, which of
- A shared Azure Function app rotates the credentials behind six secrets in one Azure Key Vault, and each secret is wired to the app through its own Event Grid event subscription. One backing service is
- A Python API on Azure Container Apps caches a database password in memory so that it does not call Azure Key Vault on every request. An Event Grid-driven function already rotates that password. You mu
- You develop a Python service on Azure Container Apps that calls a partner API with a key held as a secret in Azure Key Vault. The key must be replaced automatically before the stored secret reaches it
- Rotating a secret creates a new version, and versionless consumers pick it up automatically
Rotation does not overwrite in place; set_secret adds a new version and the prior version stays recoverable. Consumers that reference the secret by its versionless identifier begin resolving the new version automatically, which is what allows rotation without a redeploy.
Trap Thinking rotation overwrites the secret in place, so the previous value is gone.
6 questions test this
- An Event Grid-triggered function rotates an Azure Storage account access key that your key vault holds as a secret, regenerating the key at the storage account on each near-expiry event. A partner dow
- An Event Grid-triggered Azure Function has generated a replacement password in a backing database and now has to publish it to Azure Key Vault. Applications that read the secret without naming a versi
- An Azure Key Vault secret exposes an Azure Storage account access key to a Python worker running on Azure Container Apps. You must rotate that access key from an Event Grid-triggered function, and the
- A rotation function subscribed to a key vault's near-expiry events replaced a database password once and has never run since, although the event subscription is healthy. Each rotation writes the new p
- A rotation function subscribed to a key vault's near-expiry events wrote a malformed password into a secret, and a Python service that reads that secret without naming a version can no longer sign in
- A Python API on Azure Container Apps caches a database password in memory so that it does not call Azure Key Vault on every request. An Event Grid-driven function already rotates that password. You mu
- Cryptographic keys support a built-in automatic rotation policy
For keys (not secrets), Key Vault offers a rotation policy that regenerates the key on a defined interval and can fire a near-expiry Event Grid notification; secret rotation of external credentials still relies on a custom rotation handler.
- An app setting of the form @Microsoft.KeyVault(...) resolves a secret at runtime without code
Set an App Service or Functions application setting to @Microsoft.KeyVault(SecretUri=) (or @Microsoft.KeyVault(VaultName=...;SecretName=...)); the platform resolves it from Key Vault using the app's managed identity and injects the plain value as an environment variable, so the secret never appears in source control or configuration files.
Trap The app's managed identity still needs Get permission on the vault (Key Vault Secrets User under RBAC); without it the reference FAILS TO RESOLVE and the platform injects the literal '@Microsoft.KeyVault(...)' reference string as the setting value — it is never blank.
9 questions test this
- A Python Azure Functions app uses a Service Bus queue trigger. The queue connection string currently sits in a Key Vault reference application setting. A security review asks the team to eliminate the
- Your governance baseline requires every secret belonging to a function app to live in Azure Key Vault. The app's connection strings already resolve through Key Vault references. The remaining gap is t
- Your platform team keeps every credential in Azure Key Vault. An Azure Functions app already reads its connection string from an @Microsoft.KeyVault(...) application setting. A new Azure Container App
- Your Python function app in Azure reads SEARCH_KEY from an @Microsoft.KeyVault(...) application setting. Teammates must also run the same project on their laptops against a development search instance
- Your team runs a Linux Python function app on an Elastic Premium plan with regional virtual network integration. Its application settings are Key Vault references to a vault reachable only through a p
- Your team adds five Key Vault reference application settings to a Python App Service web app. Four resolve against the vault, but code reading the fifth receives the literal reference text. The app's
- You operate a Python Azure Functions app whose SEARCH_API_KEY application setting is a Key Vault reference. During a subscription cleanup, the role assignment that let the app read vault secrets was r
- You automate creation of an Elastic Premium function app with Bicep. To keep credentials out of the repository, you set the app's content share connection setting, WEBSITE_CONTENTAZUREFILECONNECTIONST
- You create a Python function app on an Elastic Premium plan from a single Bicep file that also creates the app's identity, its vault role assignment, and the Azure Files content-share settings whose c
- A versionless Key Vault reference automatically picks up a rotated secret; a versioned one pins it
When the reference omits the version, App Service periodically refreshes the resolved value (within about a day, or immediately on an application-settings change or restart) so a rotated secret flows in with no redeploy and no downtime; a versioned reference stays fixed to that version.
Trap Expecting a version-pinned Key Vault reference to follow a rotated secret.
2 questions test this
- Your team runs a Linux Python function app on an Elastic Premium plan with regional virtual network integration. Its application settings are Key Vault references to a vault reachable only through a p
- An on-call engineer rotates a compromised API key in Key Vault. A production Azure Functions app reads that key through a versionless Key Vault reference. Long-running queue processing must not be int
- Grant the workload's managed identity the Key Vault Secrets User role for read access
Assign the app's system- or user-assigned managed identity the data-plane role Key Vault Secrets User (get/list secrets) scoped to the vault; the app then authenticates with that identity via DefaultAzureCredential and reads secrets with no stored credential.
Trap Key Vault Secrets User grants only read (get/list); creating or rotating secrets requires Key Vault Secrets Officer — don't over- or under-grant the role.
11 questions test this
- You deploy a Python API to Azure Container Apps that reads a database password from an Azure key vault using the Azure role-based access control permission model. The app's managed identity must retri
- An Azure Functions admin job stores newly issued third-party API keys in the same Azure key vault that a Python service on Azure Container Apps reads them from. The vault uses the Azure RBAC permissio
- An audit of the subscription holding your AI services' key vaults lists many Key Vault Secrets User assignments whose principal is shown as Identity not found. They were left by function apps that wer
- Two product teams keep their application secrets in one shared Azure key vault that uses the Azure RBAC permission model. Each team's Python service must be able to read only its own secrets, and neit
- A developer runs your Python service on a workstation against a shared development Azure key vault that uses the Azure RBAC permission model. Deployed to Azure Container Apps the service reads its sec
- You move a Python service from Azure Container Apps to an AKS Standard cluster without changing its code, which builds a Key Vault client from DefaultAzureCredential. The user-assigned managed identit
- Your platform team authorizes every workload on its key vaults by creating Azure role assignments at the vault, and a deployment pipeline automates that step. The platform now adds an Azure Key Vault
- You are onboarding six Python Azure Functions apps to a single Azure key vault that uses the Azure RBAC permission model. Audit records must show which specific function app read a secret, and when an
- Two platform operators must be able to repair broken secrets in the key vaults that hold your Python AI services' credentials during an incident, which needs Key Vault Administrator across the resourc
- A production key vault still uses the vault access policy permission model. Your developers hold Contributor on its resource group so they can deploy. A security review finds that any of them can give
- A directory transfer moves the Azure subscription that holds your Python services and their key vaults from one Microsoft Entra tenant to another. The workloads' user-assigned managed identities have
- A vault uses either Azure RBAC or vault access policies, not both at once
Each vault's permission model is set by enableRbacAuthorization: Azure RBAC uses role assignments that inherit from subscription/resource-group scope, while the legacy vault-access-policy model assigns per-principal permissions on the vault itself. Microsoft recommends RBAC for consistent, scopeable management.
Trap Expecting a leftover vault access policy to still grant access once the vault moves to Azure RBAC.
10 questions test this
- An Azure Functions admin job stores newly issued third-party API keys in the same Azure key vault that a Python service on Azure Container Apps reads them from. The vault uses the Azure RBAC permissio
- An audit of the subscription holding your AI services' key vaults lists many Key Vault Secrets User assignments whose principal is shown as Identity not found. They were left by function apps that wer
- Your platform group must let an application team add and remove Key Vault data-plane role assignments on their own vaults so they can onboard new services themselves. The team must not be able to gran
- Two product teams keep their application secrets in one shared Azure key vault that uses the Azure RBAC permission model. Each team's Python service must be able to read only its own secrets, and neit
- A production Azure key vault still uses the legacy access policy model, and several Python services and a Functions app read secrets from it. Your team must move the vault to the Azure RBAC permission
- Your platform team authorizes every workload on its key vaults by creating Azure role assignments at the vault, and a deployment pipeline automates that step. The platform now adds an Azure Key Vault
- A platform team runs a shared Python diagnostics service that must read a health-probe secret from every key vault in a resource group, including vaults that other teams will create there later. The t
- Two platform operators must be able to repair broken secrets in the key vaults that hold your Python AI services' credentials during an incident, which needs Key Vault Administrator across the resourc
- A production key vault still uses the vault access policy permission model. Your developers hold Contributor on its resource group so they can deploy. A security review finds that any of them can give
- A directory transfer moves the Azure subscription that holds your Python services and their key vaults from one Microsoft Entra tenant to another. The workloads' user-assigned managed identities have
- DefaultAzureCredential chain and user-assigned identity client-id
DefaultAzureCredential tries an ordered chain of credentials - environment variables, then workload/managed identity, then developer credentials (Azure CLI / VS Code) - so the same SDK code authenticates locally and in Azure with no code change. Configuration is what differs: when the workload must authenticate as a USER-ASSIGNED managed identity, name it by client id (the AZURE_CLIENT_ID environment variable, or ManagedIdentityCredential(client_id=...)), because IMDS resolves an unnamed request to the system-assigned identity when one is enabled and rejects it outright when several user-assigned identities exist.
Trap Supplying no client id does NOT reliably fail: with a system-assigned identity enabled, IMDS defaults to it, so a role granted only to a user-assigned identity produces a 403 authorization error rather than an authentication error. The request fails outright only when no system-assigned identity is enabled and two or more user-assigned identities exist.
6 questions test this
- A developer runs your Python service on a workstation against a shared development Azure key vault that uses the Azure RBAC permission model. Deployed to Azure Container Apps the service reads its sec
- You move a Python service from Azure Container Apps to an AKS Standard cluster without changing its code, which builds a Key Vault client from DefaultAzureCredential. The user-assigned managed identit
- You are onboarding six Python Azure Functions apps to a single Azure key vault that uses the Azure RBAC permission model. Audit records must show which specific function app read a secret, and when an
- Your Python API runs in Azure Container Apps with one user-assigned managed identity, and developers also run the same code on their workstations, where they sign in with the Azure CLI. A standard req
- A Python API on Azure Container Apps reads secrets from a key vault with DefaultAzureCredential. In the staging environment every read fails, and the raised error carries one message for each credenti
- An Azure Container Apps app has a system-assigned managed identity and two user-assigned managed identities attached. Only one of the user-assigned identities holds the Key Vault Secrets User role on
- Soft-delete retains deleted vaults and secrets for a retention period so they can be recovered
Soft-delete (enabled by default and not disableable) keeps a deleted vault or secret in a recoverable state for its configured retention period; you recover the object during that window instead of losing it permanently.
Trap Assuming soft-delete can be switched off to make a delete immediate.
12 questions test this
- Your team already runs a Python retrieval service in one Azure region with its secrets in an Azure Key Vault, and is now standing up a second deployment of that service in another region. A compliance
- You operate an Azure Key Vault that stores API keys for a production AI workload, and soft delete is enabled on it. A threat-model review concludes that an attacker who takes over an administrative ac
- Your infrastructure pipeline tries to recover a production Azure Key Vault that was deleted by accident, but the deployment fails with a RequestDisallowedByPolicy error. The subscription carries a cus
- Your CI pipeline deploys a Bicep template that provisions an Azure Key Vault into a per-feature resource group, and a teardown job deletes that resource group when the branch merges. The pipeline reus
- Your Python housekeeping job runs nightly against your team's Azure Key Vault and must alert the on-call engineer while a mistakenly deleted secret can still be brought back, so it needs the moment at
- A colleague enabled purge protection on a shared Azure Key Vault that served a workload your team has now retired. The team deleted that vault yesterday, and a new project wants to provision a fresh v
- Your team's Python operations job uses the Azure Key Vault secrets client to bring back a credential that an engineer soft-deleted, and the same job run must then read that credential and hand it to a
- Your team keeps a wrapping key and several service credentials that cannot be regenerated from any other source in an Azure Key Vault with soft delete and purge protection enabled. An audit asks how t
- An engineer deletes a secret that holds a database password from your team's Azure Key Vault, and the Azure Function that reads it starts failing. The vault has soft delete and purge protection enable
- You develop a Python service on Azure Container Apps that reads credentials from Azure Key Vault. A decommissioned partner credential is stored as a secret, and a compliance ruling requires that value
- You provision an Azure Cosmos DB for NoSQL account that will hold your retrieval-augmented generation workload's embeddings under a customer-managed key. Your platform team already holds the RSA key i
- Your production Azure Key Vault was deleted by mistake and then recovered from the soft-deleted state well inside its retention period. The vault and every secret are back, but the Azure Function app
- Purge protection blocks permanent deletion until the retention period elapses
With purge protection enabled, a soft-deleted vault or secret cannot be purged (permanently deleted) before its retention period ends, defeating an attacker or accident that tries to erase secrets immediately. Purge protection cannot be turned off once enabled.
Trap Soft-delete alone still allows an immediate purge; only purge protection prevents early permanent deletion — the two settings are distinct.
10 questions test this
- Your team already runs a Python retrieval service in one Azure region with its secrets in an Azure Key Vault, and is now standing up a second deployment of that service in another region. A compliance
- You operate an Azure Key Vault that stores API keys for a production AI workload, and soft delete is enabled on it. A threat-model review concludes that an attacker who takes over an administrative ac
- Your CI pipeline deploys a Bicep template that provisions an Azure Key Vault into a per-feature resource group, and a teardown job deletes that resource group when the branch merges. The pipeline reus
- Your platform team needs a break-glass identity that can permanently remove soft-deleted Azure Key Vaults left behind by decommissioned AI workloads. Governance requires that the same identity must ne
- A colleague enabled purge protection on a shared Azure Key Vault that served a workload your team has now retired. The team deleted that vault yesterday, and a new project wants to provision a fresh v
- Your team keeps a wrapping key and several service credentials that cannot be regenerated from any other source in an Azure Key Vault with soft delete and purge protection enabled. An audit asks how t
- An engineer deletes a secret that holds a database password from your team's Azure Key Vault, and the Azure Function that reads it starts failing. The vault has soft delete and purge protection enable
- You develop a Python service on Azure Container Apps that reads credentials from Azure Key Vault. A decommissioned partner credential is stored as a secret, and a compliance ruling requires that value
- You provision an Azure Cosmos DB for NoSQL account that will hold your retrieval-augmented generation workload's embeddings under a customer-managed key. Your platform team already holds the RSA key i
- An audit finds that a departing administrator backed up the Azure Key Vault key that wraps your Azure Storage account's encryption key and restored that backup into another key vault. Purge protection
Store and retrieve settings with Azure App Configuration
Read full chapterUnlock with Premium — includes all practice exams and the complete study guide.
Trace distributed systems with OpenTelemetry
Read full chapterUnlock with Premium — includes all practice exams and the complete study guide.
Analyze logs and metrics with KQL
Read full chapterUnlock with Premium — includes all practice exams and the complete study guide.