SaveMyCert
Log in
5 of 5 free questions left today·for 10 a day
AI-200 practice

AI-200 sample questions — 25 answered and explained

25 AI-200 sample questions written to the official Microsoft Certified: Azure AI Cloud Developer Associate exam guide, grouped by exam domain and weighted like the real exam. Each shows the correct answer, why every other option is wrong, and the lesson that teaches it. None of them repeat the examples on the other AI-200 practice pages.

On this page
25
answers included
Full bank
400
on the practice page
Domains
4
weighted like the exam
Free, no account
5/day
a free account allows 10 a day

Domain 1: Develop containerized solutions on Azure

24% of the AI-200 exam, so 6 of the 25 questions on this page.

Question 1Develop containerized solutions on Azure

A developer's managed laptop has the Azure CLI but can't run a Docker engine. The developer needs to build the Dockerfile in the current folder and push the result to the registry contosoacr as web:v1. Which command should the developer run?

Choose one.

  • a
    az acr import --name contosoacr --source ./ --image web:v1

    Import copies an existing image from another registry; it doesn't build from a local folder.

  • b
    az acr build --registry contosoacr --image web:v1 . Correct

    A quick task uploads the local build context, builds it on ACR Tasks compute and pushes the image, with no local Docker engine.

  • c
    az acr login --name contosoacr, then docker build -t contosoacr.azurecr.io/web:v1 .

    This builds locally and needs the Docker engine the laptop can't run.

  • d
    az acr run --registry contosoacr --cmd contosoacr.azurecr.io/web:v1 .

    A cmd run starts a container from an image; it doesn't build the Dockerfile in the context.

The concept

az acr build runs a quick task: cloud build and push from a local or Git context.

Why that’s the answer

ACR Tasks quick tasks move docker build into Azure. az acr build packs the current folder, sends it to the registry's task runner, builds it and pushes the tagged image to that registry. Import needs an existing image, docker build needs a local engine, and az acr run with --cmd runs a container rather than building one.

How to reason it out
  1. Note the constraint: no local Docker engine.
  2. Identify the action: build from a Dockerfile, then push.
  3. Choose the ACR Tasks quick-task command.

Exam tip: No Docker locally? az acr build builds and pushes in the cloud.

AI-200 Container Hosting: Azure Container Registry, ACR Tasks and App Service Containers — the lesson that teaches this.

Question 2Develop containerized solutions on Azure

A team is adding ARM64-based nodes and needs an ARM64 variant of its image. The CI agents are x64 machines without cross-build tooling, and the team wants ACR Tasks to produce the image from the existing Dockerfile with the least effort. Which command should the team use?

Choose one.

  • a
    az acr build --registry reg --image api:2.0-arm64 --build-arg TARGETARCH=arm64 .

    A build argument only sets a variable for the Dockerfile; base images and output are still built for the default linux/amd64 platform.

  • b
    az acr build --registry reg --image api:2.0-arm64 --agent-pool arm-pool .

    Dedicated agent pools set the compute size and network for tasks (Premium); they don't select the target CPU architecture.

  • c
    az acr build --registry reg --image api:2.0-arm64 --platform linux/arm64 . Correct

    The --platform argument tells the quick task to build for the ARM64 architecture on ACR Tasks compute.

  • d
    az acr import --name reg --source reg.azurecr.io/api:2.0 --image api:2.0-arm64

    Import copies the existing x64 image under a new tag; it doesn't rebuild it for another architecture.

The concept

ACR Tasks builds for a target OS and architecture with --platform.

Why that’s the answer

The quick task's --platform argument selects the target OS/architecture, for example linux/arm64, so the same Dockerfile is built for ARM64 without local emulation. A build argument such as TARGETARCH is only an input the Dockerfile can read; it doesn't change the platform the build runs for. Agent pools and import don't change the architecture either.

How to reason it out
  1. Identify the need: a different CPU architecture from the same Dockerfile.
  2. Rule out options that only rename or copy the existing image.
  3. Pick the argument that sets the target platform.

Exam tip: Cross-architecture image in ACR Tasks: az acr build --platform linux/arm64.

AI-200 Container Hosting: Azure Container Registry, ACR Tasks and App Service Containers — the lesson that teaches this.

Question 3Develop containerized solutions on Azure

A developer creates an ACR task for a GitHub repository. The image must rebuild on every commit to the main branch and also every Sunday at 02:00 UTC so that weekly package updates are picked up. Which arguments should the developer add to az acr task create, alongside --context https://github.com/contoso/api.git#main and --file Dockerfile?

Choose one.

  • a
    --git-access-token $PAT --schedule "0 0 2 * * Sun"

    ACR Tasks cron expressions have five fields; a seconds field isn't supported, so this expression isn't valid.

  • b
    --commit-trigger-enabled false --schedule "0 2 * * Sun"

    This keeps the weekly timer but turns off the source commit trigger the team also needs.

  • c
    --git-access-token $PAT --schedule "2 0 * * Sun"

    The first field is the minute, so this runs at 00:02 UTC on Sundays rather than 02:00.

  • d
    --git-access-token $PAT --schedule "0 2 * * Sun" Correct

    The token lets ACR register the commit webhook, and the five-field cron expression fires at minute 0, hour 2 UTC on Sundays.

The concept

An ACR task can combine a source commit trigger with one or more timer triggers.

Why that’s the answer

A task created from a GitHub context gets a commit trigger, which needs a personal access token so ACR can create the webhook. A timer trigger is added with --schedule and a five-field cron expression in UTC: minute, hour, day, month, day of week. "0 2 * * Sun" is 02:00 on Sundays. A six-field expression with seconds isn't supported, swapping the first two fields changes the time, and disabling the commit trigger drops half the requirement.

How to reason it out
  1. Map each requirement to a trigger: commit trigger and timer trigger.
  2. Remember the commit trigger needs a Git access token.
  3. Read the cron fields in order: minute, hour, day, month, weekday (UTC).

Exam tip: ACR Tasks cron = five fields, UTC; commit triggers need a Git token.

AI-200 Container Hosting: Azure Container Registry, ACR Tasks and App Service Containers — the lesson that teaches this.

Question 4Develop containerized solutions on Azure

A task builds this multi-stage Dockerfile and was created with default trigger settings and run once:FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /src COPY . . RUN dotnet publish -c Release -o /app FROM mcr.microsoft.com/dotnet/aspnet:8.0 COPY --from=build /app /app ENTRYPOINT ["dotnet", "/app/Api.dll"]Microsoft later publishes patched images under both tags. How does the task behave?

Choose one.

  • a
    A patch to either image triggers a run within seconds, because base image triggers are on by default

    The trigger is on by default, but build-stage images aren't tracked, and public images are polled rather than detected instantly.

  • b
    No patch triggers a run, because tracking covers base images stored in an Azure registry

    Public repositories in Docker Hub and Microsoft Container Registry are tracked too, just on a polling interval.

  • c
    A patch to aspnet:8.0 triggers a run within about an hour; a patch to sdk:8.0 triggers nothing Correct

    ACR Tasks tracks only the runtime (final-stage) base image, and checks public MCR or Docker Hub images at a random interval of 10 to 60 minutes.

  • d
    A patch to sdk:8.0 triggers a run, while aspnet:8.0 needs importing into the registry first

    This reverses the rule: the final runtime image is the one tracked, and it doesn't need importing first.

The concept

Base image update triggers track the runtime base image only, and poll public registries periodically.

Why that’s the answer

Two facts decide this. First, ACR Tasks tracks base image updates only for the application (runtime) image, here aspnet:8.0, not for intermediate build-stage images such as sdk:8.0. Second, for base images in public Docker Hub or MCR repositories, ACR checks for updates at a random interval between 10 and 60 minutes; only base images in an Azure container registry trigger immediately. The trigger is enabled by default, and the task has already run once, so its dependencies are recorded.

How to reason it out
  1. Identify which FROM is the runtime base: the last stage.
  2. Recall that build-stage images aren't tracked.
  3. Recall the timing: public registries are polled every 10 to 60 minutes, ACR bases trigger immediately.

Exam tip: Base image triggers watch the final-stage FROM; public bases are polled, ACR bases fire at once.

AI-200 Container Hosting: Azure Container Registry, ACR Tasks and App Service Containers — the lesson that teaches this.

Question 5Develop containerized solutions on Azure

A developer creates an ACR task with default settings that builds an application image FROM contosoacr.azurecr.io/base/node:20, a stable tag in the same registry. Before the task has ever run, the platform team pushes a patched image to base/node:20. No run is queued. What explains this?

Choose one.

  • a
    Base images stored in an Azure registry are checked for updates at 10 to 60 minute intervals

    That polling interval applies to public Docker Hub and MCR images; a base image in an Azure registry triggers a run immediately.

  • b
    Base image triggers are off by default and need --base-image-trigger-enabled set to true

    The base image trigger is enabled by default when a task is created with az acr task create.

  • c
    Base image tracking needs the base image to be in a different registry from the task

    Tracking covers the same registry, other Azure registries and public Docker Hub or MCR repositories.

  • d
    The task hasn't run yet, so it hasn't discovered and recorded its base image dependency Correct

    ACR Tasks learns an image's base image dependencies when it builds; a task must run at least once before base image updates can trigger it.

The concept

A base image trigger needs one completed run to discover the image's dependencies.

Why that’s the answer

ACR Tasks discovers base image dependencies dynamically while it builds. Until the task has built the image at least once, it has no record that the application depends on base/node:20, so a push to that tag queues nothing. Running the task once (for example with az acr task run) fixes it. The other options misstate defaults, timings or supported locations.

How to reason it out
  1. Check the defaults: base image trigger is on.
  2. Check the location: same registry, so updates trigger immediately.
  3. Notice the task never ran, so no dependency is recorded yet.

Exam tip: Run a new task once so it can learn its base image.

AI-200 Container Hosting: Azure Container Registry, ACR Tasks and App Service Containers — the lesson that teaches this.

Question 6Develop containerized solutions on Azure

An application Dockerfile starts with FROM contosoacr.azurecr.io/base/node:20.11.1. The platform team publishes every patch as a new tag, such as 20.11.2 and 20.11.3. The application team's ACR task has run many times, but it never rebuilds when a patch is published. The team wants patched rebuilds to happen automatically. What should the teams do?

Choose one.

  • a
    Add a nightly timer trigger so the task rebuilds the image from its node base regularly

    The nightly rebuild would still use FROM node:20.11.1, so it would never pick up the newer patch tags.

  • b
    Have the platform team run az acr task update with --base-image-trigger-enabled true

    The trigger is already enabled by default; the problem is that nothing updates the tag the Dockerfile references.

  • c
    Import each new node patch tag, such as 20.11.2, into the application registry

    Importing creates more new tags; the Dockerfile still references 20.11.1, so no rebuild picks up the patch.

  • d
    Have the platform team also move a stable tag, such as node:20, and reference it in FROM Correct

    Base image triggers fire when the referenced tag is updated, so the Dockerfile must reference a stable tag that moves with each patch.

The concept

Base image triggers follow updates to the exact tag in FROM, so base images need stable tags.

Why that’s the answer

A base image update trigger fires when the image behind the referenced tag changes. Publishing each patch under a new version tag never changes node:20.11.1, so nothing triggers. If the platform team also updates a stable tag such as node:20 with each patch and the application references it, every patch triggers a rebuild. A timer rebuild or import doesn't help because the Dockerfile still pins the old tag.

How to reason it out
  1. Ask what tag the Dockerfile references and whether it ever changes.
  2. Recall that new version tags don't trigger base image updates.
  3. Reference a stable tag that the base image maintainers move with each patch.

Exam tip: Base image triggers need a stable tag that moves; new version tags never fire them.

AI-200 Container Hosting: Azure Container Registry, ACR Tasks and App Service Containers — the lesson that teaches this.

Domain 2: Develop AI solutions by using Azure data management services

28% of the AI-200 exam, so 7 of the 25 questions on this page.

Question 7Develop AI solutions by using Azure data management services

A catalog query sorts results with ORDER BY c.category ASC, c.price DESC. The developer is reviewing proposed composite index definitions for the container's indexing policy. Which two definitions can serve this ORDER BY clause? (Select TWO.)

Choose TWO.

  • a
    (/category ascending, /price descending) Correct

    The path sequence and both directions match the ORDER BY clause exactly.

  • b
    (/category descending, /price ascending) Correct

    Each direction is the exact reverse of the query's, which Cosmos DB can traverse backwards to serve the same sort.

  • c
    (/category ascending, /price ascending)

    Only the first direction matches; the second neither matches nor is part of a full reversal, so the index cannot serve the sort.

  • d
    (/price descending, /category ascending)

    The directions are right for each property, but the path sequence is swapped, and composite index order must follow the ORDER BY clause.

  • e
    (/category descending, /price descending)

    Reversing only one of the two directions gives a combination that matches neither the query nor its exact reverse.

The concept

Composite indexes are traversed forwards or backwards: a definition works when it matches the ORDER BY or is its exact reverse, with the same path order.

Why that’s the answer

For ORDER BY category ASC, price DESC, the index (category ascending, price descending) matches directly, and (category descending, price ascending) is the full reverse, which the engine reads backwards. Partially reversed definitions fail because the combined sort order differs, and swapping the path sequence fails because the first sort key changes.

How to reason it out
  1. Write down the ORDER BY sequence and directions.
  2. Accept a definition with the same sequence and the same directions.
  3. Also accept the definition with the same sequence and every direction flipped; reject partial flips and reordered paths.

Exam tip: A composite index serves an ORDER BY when it matches it exactly or is its exact reverse.

AI-200 Azure Cosmos DB for NoSQL: SDK Queries, RUs, Vector Search and Change Feed — the lesson that teaches this.

Question 8Develop AI solutions by using Azure data management services

A single-region chat application on Cosmos DB for NoSQL must guarantee that a user who posts a message sees it immediately when their own client reloads the conversation. Other users can see the message a moment later. The team wants the lowest read latency and RU cost that meets this. Which default consistency level should they configure?

Choose one.

  • a
    Strong

    Strong would meet the requirement but reads from two replicas, costing about twice the read RU, which the other users' tolerance makes unnecessary.

  • b
    Session Correct

    Session guarantees read-your-writes within the client's session while reading from a single replica, the cheapest level that meets the requirement.

  • c
    Bounded staleness

    Bounded staleness also reads from two replicas, so it costs more than needed, and its guarantee is about lag limits rather than one client's own writes.

  • d
    Consistent prefix

    Consistent prefix keeps write order but does not guarantee that a client sees its own latest write.

The concept

Session consistency gives read-your-writes for a client session at single-replica read cost.

Why that’s the answer

The requirement is per-user: each writer must see its own writes. Session consistency provides exactly that through a session token while reading from one replica. Strong and Bounded Staleness read from two replicas and cost about twice as much per read. Consistent prefix and Eventual do not guarantee read-your-writes.

How to reason it out
  1. Identify whose reads need the guarantee: the user who wrote the data.
  2. Map read-your-writes for a client to Session consistency.
  3. Reject stronger levels that cost more and weaker levels that drop the guarantee.

Exam tip: Read-your-own-writes at the lowest cost = Session consistency (the default).

AI-200 Azure Cosmos DB for NoSQL: SDK Queries, RUs, Vector Search and Change Feed — the lesson that teaches this.

Question 9Develop AI solutions by using Azure data management services

An account's default consistency is Strong because a payments service needs it. A separate recommendations API reads the same container heavily and tolerates slightly stale data. The team wants to reduce that API's read RU consumption without changing the account's configuration or affecting the payments service. What should the developer do?

Choose one.

  • a
    Create the API's CosmosClient with consistency_level="BoundedStaleness"

    Bounded staleness still reads from two replicas, so read RU stays at about the Strong level.

  • b
    Enable multiple write regions on the account for the API's traffic

    This changes the account configuration, and Strong consistency cannot be used with multiple write regions.

  • c
    Enable autoscale throughput on the container the API reads

    Autoscale changes how much throughput is provisioned, not how many RUs each read consumes.

  • d
    Create the API's CosmosClient with consistency_level="Session" Correct

    A client can relax consistency below the account default. Session reads use a single replica, so they cost about half of Strong reads.

The concept

The account default can be relaxed per client or request; levels below Bounded Staleness read one replica and halve read RU.

Why that’s the answer

Strong and Bounded Staleness reads use a local minority quorum of two replicas, so a read costs about twice as many RUs as at Session, Consistent Prefix or Eventual. The SDK can set a weaker level on the client the recommendations API uses, which leaves the account default and the payments service unchanged. Bounded staleness does not reduce cost, the multi-region write change is both a configuration change and incompatible with Strong, and autoscale does not change per-read cost.

How to reason it out
  1. Note the constraint: no account change, and only this API is affected.
  2. Recall that read RU doubles at Strong and Bounded Staleness.
  3. Relax consistency on this API's client to a single-replica level such as Session.

Exam tip: Lower one app's read cost under a Strong account: relax consistency on that app's client, below Bounded Staleness.

AI-200 Azure Cosmos DB for NoSQL: SDK Queries, RUs, Vector Search and Change Feed — the lesson that teaches this.

Question 10Develop AI solutions by using Azure data management services

An ingestion API writes a document chunk to Cosmos DB for NoSQL (default consistency Session), then queues a message. A separate worker process with its own CosmosClient reads the chunk by id and partition key as soon as the message arrives, and occasionally gets 404 Not Found. The worker must always see the chunk, and read RU costs must not rise for other workloads. What should the developer do?

Choose one.

  • a
    Change the account default from Session to Strong consistency

    Strong would make the read succeed, but it doubles read RU for every workload on the account and adds write latency, which breaks the cost constraint.

  • b
    Forward the write's session token to the worker and supply it on the read Correct

    Session guarantees apply to whoever presents the session token. Passing the writer's token makes the worker's read wait for a replica that has the write.

  • c
    Set consistency_level="ConsistentPrefix" on the worker's client session

    Consistent prefix is weaker than Session and still does not give the worker read-your-writes for another client's write.

  • d
    Retry the worker's read_item call with exponential backoff after each 404

    Retries usually succeed eventually but add delay and still give no guarantee, while the requirement is that the worker always sees the chunk.

The concept

Session consistency is scoped to the session token; another client gets read-your-writes only if it presents that token.

Why that’s the answer

The worker has its own client, so its session token cache has no record of the API's write and its reads behave like Eventual consistency for that partition. Forwarding the session token returned by the write and supplying it on the worker's read restores the read-your-writes guarantee without changing the account. Strong works but raises read cost for everyone, Consistent prefix is weaker, and retries are a best-effort workaround.

How to reason it out
  1. Notice that the writer and the reader are different clients.
  2. Recall that Session guarantees follow the session token, which each client caches separately.
  3. Share the token instead of raising the account-wide level.

Exam tip: Read-your-writes across processes under Session: pass the session token along with the work item.

AI-200 Azure Cosmos DB for NoSQL: SDK Queries, RUs, Vector Search and Change Feed — the lesson that teaches this.

Question 11Develop AI solutions by using Azure data management services

A developer is creating a Cosmos DB for NoSQL container to store embeddings for semantic retrieval. Before any similarity query can run, the container must record which property holds the embeddings, their number of dimensions, their data type and the metric used to compare them. Where are these settings defined?

Choose one.

  • a
    In the container's vector embedding policy Correct

    The vector embedding policy holds path, dataType, dimensions and distanceFunction for each vector property.

  • b
    In the container's vector indexes list inside the indexing policy

    The vectorIndexes entry names the path and index type (flat, quantizedFlat or diskANN), not the dimensions, data type or distance function.

  • c
    In the container's full-text policy for each searchable path

    The full-text policy configures keyword search language per path; it holds no vector settings.

  • d
    In the container's composite indexes inside the indexing policy

    Composite indexes serve multi-property ORDER BY and filters, not vector comparison.

The concept

The vector embedding policy describes each vector path: path, dataType, dimensions and distanceFunction.

Why that’s the answer

Cosmos DB for NoSQL needs a container vector embedding policy (vectorEmbeddings) before VectorDistance can compare vectors. Each entry has a path, a data type (float32, float16, int8 or uint8), dimensions and a distance function (cosine, dotproduct or euclidean). The vector index in the indexing policy is optional and names only the path and index type.

How to reason it out
  1. List the settings asked for: path, dimensions, data type, metric.
  2. Match them to the policy that describes vector data: the vector embedding policy.
  3. Keep the indexing policy for the index type only.

Exam tip: Vector embedding policy = what the vectors are; vector index = how they are indexed.

AI-200 Azure Cosmos DB for NoSQL: SDK Queries, RUs, Vector Search and Change Feed — the lesson that teaches this.

Question 12Develop AI solutions by using Azure data management services

A support knowledge base will hold about 20,000 article chunks in one Cosmos DB for NoSQL container, embedded with text-embedding-3-large at 3,072 dimensions. Queries search the whole container. The team wants recall as close to exact as possible with low RU cost. Which vector index type should the developer configure?

Choose one.

  • a
    flat

    flat gives exact results but supports at most 505 dimensions, so it cannot index 3,072-dimension vectors.

  • b
    diskANN

    diskANN supports the dimensions, but it is an approximate index recommended when searches span more than about 50,000 vectors.

  • c
    quantizedFlat Correct

    quantizedFlat supports up to 4,096 dimensions and runs a brute-force search over compressed vectors, recommended when 50,000 or fewer vectors are in scope.

  • d
    No vector index, with VectorDistance over the stored vectors

    Without a vector index, every search compares against full vectors with higher RU and latency than an indexed search.

The concept

Index choice depends on dimensions (flat ≤ 505; quantizedFlat and diskANN ≤ 4,096) and the number of vectors a search spans (quantizedFlat up to about 50,000).

Why that’s the answer

The 3,072 dimensions rule out flat, whose limit is 505. Of the two remaining types, quantizedFlat is a brute-force search over quantized vectors with near-exact recall and is Microsoft's recommendation when 50,000 or fewer vectors are in scope. diskANN is approximate and pays off on larger sets. No index at all costs more per query.

How to reason it out
  1. Check the dimension count against each index type's limit.
  2. Check how many vectors each search spans.
  3. Pick the brute-force compressed index for a small set that needs near-exact recall.

Exam tip: Over 505 dimensions and up to about 50,000 vectors in scope: quantizedFlat.

AI-200 Azure Cosmos DB for NoSQL: SDK Queries, RUs, Vector Search and Change Feed — the lesson that teaches this.

Question 13Develop AI solutions by using Azure data management services

A multitenant RAG service stores 6 million 1,536-dimension chunks in one container partitioned on /tenantId. Every vector query includes the tenant's partition key, and no tenant has more than 15,000 chunks. Product owners want results as close to exact as possible at low RU, and approximate result ordering that varies between runs is unacceptable. Which vector index type best fits?

Choose one.

  • a
    diskANN on /embedding

    diskANN suits searches over very large sets, but it is approximate and results can vary between runs, which the product owners rejected; each search here spans only one tenant.

  • b
    flat on /embedding

    flat would give exact results but supports at most 505 dimensions, so it cannot index 1,536-dimension vectors.

  • c
    quantizedFlat on /embedding Correct

    Each search is scoped by partition key to at most 15,000 vectors, within quantizedFlat's recommended range, and its brute-force search gives near-exact, stable results.

  • d
    No vector index, filtering each query by tenantId

    Without a vector index, each search compares full vectors with higher RU cost than an indexed brute-force search.

The concept

The index decision follows the number of vectors a query spans after filters and partition scoping, not the container's total.

Why that’s the answer

The tempting answer is diskANN because the container holds 6 million vectors. But every query is scoped to one tenant, so each search covers at most 15,000 vectors, well inside quantizedFlat's guidance of 50,000 or fewer. quantizedFlat is a brute-force search with near-exact recall and stable results, while diskANN is approximate and Microsoft notes its results can vary between runs. flat is ruled out by the dimension limit, and no index raises cost.

How to reason it out
  1. Work out how many vectors one query actually searches: the tenant's share, not the container total.
  2. Apply the size guidance (quantizedFlat up to about 50,000 vectors in scope).
  3. Check the remaining constraints: dimensions within limit, stable near-exact results.

Exam tip: Size the vector index by the vectors a filtered query spans, not by the container's total count.

AI-200 Azure Cosmos DB for NoSQL: SDK Queries, RUs, Vector Search and Change Feed — the lesson that teaches this.

Domain 3: Connect to and consume Azure services

24% of the AI-200 exam, so 6 of the 25 questions on this page.

Question 14Connect to and consume Azure services

A Python worker reads from a Service Bus queue in peek-lock mode and writes each summary to Azure Cosmos DB successfully. Yet every message is processed about ten times and then appears in the dead-letter subqueue with the reason MaxDeliveryCountExceeded. The queue uses default settings. What is the most likely cause?

Choose one.

  • a
    The queue's message time-to-live is shorter than the worker's processing time

    Expiry would dead-letter (if enabled) with the reason TTLExpiredException, not MaxDeliveryCountExceeded after about ten deliveries.

  • b
    The senders do not set a session ID on the messages they send to the queue

    Session IDs only matter on a session-enabled queue; the queue uses default settings, which have sessions off.

  • c
    The worker never calls complete_message after it finishes processing each message Correct

    Without completion, each lock expires, the message is redelivered with a higher delivery count, and after the default limit of 10 it is dead-lettered.

  • d
    The queue's duplicate detection window is shorter than the worker's processing time

    Duplicate detection drops repeated sends by message ID at enqueue time; it does not cause redelivery to receivers.

The concept

In peek-lock mode a message that is never settled is redelivered when its lock expires, and the delivery count rises each time.

Why that’s the answer

Processing succeeds, but the broker never hears about it. Each time the lock expires the message becomes available again and its delivery count increases; at the default maximum delivery count of 10 it is moved to the dead-letter subqueue with MaxDeliveryCountExceeded. Calling complete_message before closing the receiver fixes it. The other options would produce different reasons or no redelivery at all.

How to reason it out
  1. Match the reason code: MaxDeliveryCountExceeded means repeated deliveries.
  2. Successful processing plus redelivery means settlement is missing.
  3. Default max delivery count is 10, matching about ten deliveries.

Exam tip: Processed but redelivered until MaxDeliveryCountExceeded = the receiver never completes the message.

AI-200 Service Bus and Event Grid: Messaging and Event-Driven AI Solutions — the lesson that teaches this.

Question 15Connect to and consume Azure services

A developer creates a 'priority-high' subscription on a Service Bus topic in the portal, then adds a SQL filter rule priority = 'high'. Newly sent messages whose application property priority is 'low' still arrive in the subscription. What should the developer do?

Choose one.

  • a
    Delete the subscription's $Default rule, which matches every message Correct

    A new subscription gets a $Default rule with a true filter; a message is copied when any rule matches, so the extra rule cannot narrow anything until $Default is removed.

  • b
    Rewrite the SQL filter rule as sys.priority = 'high' on the subscription

    The sys. prefix refers to broker system properties such as sys.Label; priority is an application property, referenced by its name.

  • c
    Replace the SQL filter rule with a correlation filter on the priority property

    A correlation filter would match the same messages, but the $Default rule would still copy every message into the subscription.

  • d
    Recreate the subscription with sessions enabled before adding the SQL filter rule

    Sessions control ordered, single-receiver processing; they play no part in which messages a subscription receives.

The concept

A subscription receives a message if any of its rules matches; new subscriptions start with a $Default rule whose filter is always true.

Why that’s the answer

Rules on a subscription are evaluated independently and combine as OR: if any rule matches, the message is copied in. The $Default rule (a 1=1 true filter) created with the subscription therefore matches everything, so adding priority = 'high' alongside it changes nothing. Remove $Default (or create the subscription with the SQL filter as its default rule). The sys. prefix is for system properties, a correlation filter has the same OR problem, and sessions are unrelated.

How to reason it out
  1. New subscriptions come with a $Default true-filter rule.
  2. Multiple rules combine as OR: any match copies the message.
  3. So the narrowing rule only works once $Default is removed.

Exam tip: A subscription gets a copy if ANY rule matches; remove the $Default true filter before relying on your own filter.

AI-200 Service Bus and Event Grid: Messaging and Event-Driven AI Solutions — the lesson that teaches this.

Question 16Connect to and consume Azure services

A high-volume Service Bus topic carries model-inference requests. One subscription must receive only messages whose subject is 'transcribe' and whose application property region equals 'eu'. Both checks are exact equality. The team wants the lowest filter evaluation overhead on the broker. Which rule should the developer add to the subscription (after removing $Default)?

Choose one.

  • a
    A SQL filter on the subject and property: sys.Label = 'transcribe' AND region = 'eu'

    This matches the same messages, but SQL filters are evaluated less efficiently than correlation filters, which the constraint rules out.

  • b
    A correlation filter that matches Subject 'transcribe' and property region 'eu' Correct

    Correlation filters match exact values on system and application properties and are evaluated more efficiently than SQL filters.

  • c
    A SQL filter on the subject and property: sys.Label LIKE 'transcribe%' AND region = 'eu'

    LIKE adds pattern matching that is not needed for exact values and is costlier to evaluate, and it would also match other subjects.

  • d
    A true filter plus a rule action that sets the region property to 'eu' by subject

    A true filter matches every message, and a rule action only modifies properties of messages that matched; it does not filter.

The concept

Correlation filters handle exact-match conditions on message properties and are the more efficient filter type; SQL filters add expressions at higher cost.

Why that’s the answer

Both conditions are equality checks on a system property (Subject) and an application property (region), which is exactly what a correlation filter expresses; Microsoft recommends correlation filters over SQL filters when they suffice because they are cheaper to evaluate at high volume. The SQL equality rule works but costs more, LIKE is both costlier and broader, and a rule action changes properties rather than selecting messages.

How to reason it out
  1. All conditions are exact equality.
  2. Exact equality on properties is a correlation filter's job.
  3. The efficiency constraint favours correlation over SQL.

Exam tip: Exact property matches: correlation filter (cheaper). Expressions, ranges, LIKE: SQL filter.

AI-200 Service Bus and Event Grid: Messaging and Event-Driven AI Solutions — the lesson that teaches this.

Question 17Connect to and consume Azure services

A chat-assistant back end sends each customer's messages to an existing Service Bus queue that was created with default settings. Messages for one customer must be processed in order by one worker at a time, while different customers are processed in parallel by several workers. Which two actions should the developer take? (Select TWO.)

Choose TWO.

  • a
    Enable sessions on the existing queue from the queue's settings in the portal

    Sessions cannot be enabled or disabled on an existing queue; they are fixed at creation.

  • b
    Create a new queue with sessions enabled and move senders and workers to it Correct

    Sessions can only be enabled when a queue is created, so the existing queue cannot be switched over.

  • c
    Set session_id to the customer ID on every message the senders publish Correct

    Messages that share a session ID are locked to one session receiver and delivered in order, while other sessions go to other workers.

  • d
    Set message_id to the customer ID on every message the senders publish

    The message ID is used for duplicate detection; with duplicate detection on, later messages for the same customer would be dropped.

  • e
    Switch every worker's receiver to ServiceBusReceiveMode.RECEIVE_AND_DELETE

    Receive mode affects settlement, not ordering; competing workers would still process one customer's messages in parallel.

The concept

Service Bus sessions give ordered, exclusive processing per session ID, and they must be enabled when the queue or subscription is created.

Why that’s the answer

Ordering per customer with parallelism across customers is the session pattern: senders put the customer ID in session_id, each worker accepts a session and holds an exclusive lock on that customer's messages, receiving them in order. Sessions are a creation-time setting, so the team needs a new session-enabled queue. Message ID is for de-duplication, and receive mode changes nothing about ordering.

How to reason it out
  1. Ordered per key + parallel across keys = sessions.
  2. Sessions cannot be turned on for an existing queue.
  3. The session key travels in session_id, not message_id.

Exam tip: Per-key FIFO in Service Bus = session_id on messages + a queue created with sessions enabled.

AI-200 Service Bus and Event Grid: Messaging and Event-Driven AI Solutions — the lesson that teaches this.

Question 18Connect to and consume Azure services

A Python order service on a flaky network sometimes resends a message after a send timeout, even though the first send reached Service Bus. Downstream, a model-billing worker charges twice. The team is creating a new queue in a Standard namespace and wants the broker to discard resends within ten minutes without changing the worker. Which two actions should the team take? (Select TWO.)

Choose TWO.

  • a
    Set correlation_id on each ServiceBusMessage to the order ID before sending it

    Duplicate detection ignores the correlation ID; only the message ID is compared.

  • b
    Create the queue with sessions enabled and set session_id to the order ID

    Sessions order and lock related messages; they do not drop a repeated message.

  • c
    Create the queue with duplicate detection enabled and a 10-minute history window Correct

    Duplicate detection makes the queue drop any message whose ID was already seen within the window; it must be set when the queue is created.

  • d
    Create the queue with a 10-minute message time-to-live and a dead-letter rule

    Time-to-live expires unprocessed messages; it does not stop a duplicate from being processed.

  • e
    Set message_id on each ServiceBusMessage to the order ID before sending it Correct

    Duplicate detection compares only the message ID, so it must be an application value that is the same on every resend.

The concept

Service Bus duplicate detection drops messages whose application-set MessageId was already seen within a configurable history window.

Why that’s the answer

With duplicate detection on, the queue records each MessageId for the history window (10 minutes by default, from 20 seconds up to 7 days) and silently drops any later message with the same ID; the send still reports success. It only works if the sender sets a deterministic MessageId such as the order ID, and it can only be enabled when the queue is created (Standard or Premium tier). Correlation and session IDs are not compared, and TTL does not de-duplicate.

How to reason it out
  1. The duplicates come from sender retries, so de-duplicate at the broker on enqueue.
  2. Duplicate detection is a creation-time setting.
  3. It compares only MessageId, so make it business-derived.

Exam tip: Broker-side de-duplication = duplicate detection enabled at creation + a deterministic message_id.

AI-200 Service Bus and Event Grid: Messaging and Event-Driven AI Solutions — the lesson that teaches this.

Question 19Connect to and consume Azure services

After a user starts a fine-tuning request, a Python service must place a 'check status' message on a Service Bus queue so that no worker can receive it until 30 minutes from now. Which approach should the developer use?

Choose one.

  • a
    Send the message now with its time_to_live property set to 30 minutes

    Time-to-live makes the message expire after 30 minutes; it is available immediately and would vanish before anyone needs it.

  • b
    Send the message now and have the first worker that receives it defer it

    A worker would receive it immediately, and deferral has no timer; the message must later be fetched by sequence number.

  • c
    Send the message now to a queue whose lock duration is set to 30 minutes

    The lock duration applies after a receiver takes the message (and cannot exceed 5 minutes); it does not delay availability.

  • d
    Call schedule_messages on the sender with a UTC enqueue time 30 minutes ahead Correct

    A scheduled message is held by the broker and only becomes available to receivers at its scheduled enqueue time.

The concept

Scheduled messages are enqueued but stay invisible to receivers until their scheduled enqueue time.

Why that’s the answer

ServiceBusSender.schedule_messages (or setting scheduled_enqueue_time_utc before send_messages) hands the message to the broker, which makes it available at the chosen UTC time and returns a sequence number that can cancel the schedule. Time-to-live controls expiry, deferral needs a receive first, and lock duration only applies once a message is received.

How to reason it out
  1. Requirement: the message must not be receivable until a known time.
  2. Delayed availability at a known time is scheduling.
  3. TTL, lock duration and deferral do not delay first delivery.

Exam tip: Deliver later at a known time: schedule_messages / scheduled_enqueue_time_utc.

AI-200 Service Bus and Event Grid: Messaging and Event-Driven AI Solutions — the lesson that teaches this.

Domain 4: Secure, monitor, and troubleshoot Azure solutions

24% of the AI-200 exam, so 6 of the 25 questions on this page.

Question 20Secure, monitor, and troubleshoot Azure solutions

A legacy reporting database accepts only a single SQL login, and its password is stored in Key Vault with an expiration date. The team wants the password rotated automatically before it expires, with the database updated to match and no person involved. Which design should the developer implement?

Choose one.

  • a
    A rotation policy on the secret so Key Vault itself generates and stores a new password value before expiry

    Rotation policies exist for keys, not secrets; Key Vault doesn't generate secret values or update a database.

  • b
    A certificate issuance policy with a lifetime action that renews the stored database password before expiry

    Lifetime actions renew certificates; they can't rotate a password or change a SQL login.

  • c
    An Event Grid subscription for SecretNearExpiry that triggers a function to set a new version and update the database Correct

    Key Vault raises SecretNearExpiry before the expiry date; the function generates a password, stores a new version and changes the login.

  • d
    An Event Grid subscription for SecretNewVersionCreated that triggers a function to set a new version and update the database

    That event fires only after someone adds a version, so nothing would ever start the rotation.

The concept

Secret rotation in Key Vault is event-driven: SecretNearExpiry via Event Grid triggers your own rotation function.

Why that’s the answer

Key Vault has no built-in generator for secret values. The documented pattern publishes SecretNearExpiry to Event Grid ahead of the expiration date; a subscribed function creates a new password, writes it as a new secret version and updates the database. Rotation policies are for keys, lifetime actions for certificates, and SecretNewVersionCreated reacts to a rotation rather than starting one.

How to reason it out
  1. Note the asset: a secret, not a key or certificate.
  2. Secrets rotate through Event Grid plus custom code.
  3. Choose the event that fires ahead of expiry.

Exam tip: Secrets: SecretNearExpiry -> Event Grid -> function that sets a new version and updates the target.

AI-200 Azure Key Vault and App Configuration: Secret Retrieval, Rotation and Dynamic Settings — the lesson that teaches this.

Question 21Secure, monitor, and troubleshoot Azure solutions

A developer deployed a rotation function and an Event Grid subscription for the SecretNearExpiry event on a vault. The secret api-db-password was created three months ago with tags that describe the database, and the function has never run. The function app logs show no errors, and the Event Grid subscription validated successfully. What is the most likely cause?

Choose one.

  • a
    The function's identity lacks Key Vault Secrets Officer, so Event Grid can't deliver the event

    Event delivery doesn't depend on the function's vault role; a missing role would fail inside the function, which logged nothing.

  • b
    SecretNearExpiry is published only for certificates, so secrets must use SecretExpired instead

    Key Vault publishes SecretNearExpiry for secrets; certificates have their own CertificateNearExpiry event.

  • c
    Key Vault publishes events only after diagnostic settings send its logs to a Log Analytics workspace

    Event Grid events don't depend on diagnostic settings, which control resource logs, not events.

  • d
    The secret's current version has no expiration date, so the near-expiry event is never published Correct

    SecretNearExpiry is raised relative to a version's expiration date; without one, there's nothing to be near.

The concept

The near-expiry event needs an expiration date on the secret version; rotation functions also set the next one.

Why that’s the answer

Key Vault publishes SecretNearExpiry ahead of a secret version's expiration date. A secret created without an expiration date never qualifies, so the event never fires and the function never runs, with nothing in the logs. Rotation samples create the secret with an expiry and have the function set a new expiry on each version it writes.

How to reason it out
  1. The function never ran, so the event was never delivered.
  2. Ask what SecretNearExpiry is relative to: the version's expiration date.
  3. Check whether the secret has one; without it no event fires.

Exam tip: No expiration date, no SecretNearExpiry event, no rotation.

AI-200 Azure Key Vault and App Configuration: Secret Retrieval, Rotation and Dynamic Settings — the lesson that teaches this.

Question 22Secure, monitor, and troubleshoot Azure solutions

A developer builds automatic rotation for a partner API key that the partner lets clients regenerate through a REST call. A function will create the new key at the partner and store it in Key Vault before the current secret version expires. The vault uses Azure RBAC. Which two items must the developer configure? (Select TWO.)

Choose TWO.

  • a
    Key Vault Secrets User for the function's managed identity on the vault

    This role only reads secrets, so the function couldn't store the regenerated key.

  • b
    A key rotation policy on the vault that runs the function on a fixed schedule

    Rotation policies apply to Key Vault keys and rotate them internally; they don't run functions or touch secrets.

  • c
    An Event Grid subscription on the vault for the SecretNewVersionCreated event that targets the function

    This fires only after a new version has been stored, so it can't start the rotation that creates that version.

  • d
    An Event Grid subscription on the vault for the SecretNearExpiry event that targets the function Correct

    This event fires ahead of the version's expiry, which is what starts the rotation in time.

  • e
    Key Vault Secrets Officer for the function's managed identity on the vault Correct

    The function must write a new secret version, which needs a role with secret write access.

The concept

Secret rotation needs both a trigger (SecretNearExpiry) and write permission for the rotating identity.

Why that’s the answer

Event-driven rotation has two moving parts. The trigger is an Event Grid subscription for SecretNearExpiry, which Key Vault raises before the expiration date. The function then needs to write a new version, so its identity needs Key Vault Secrets Officer on an RBAC vault. Secrets User can't write, rotation policies are a key feature, and SecretNewVersionCreated fires after a version is stored, so it reports a rotation rather than starting one.

How to reason it out
  1. Identify the trigger that fires before expiry.
  2. Identify the permission needed to write a new version.
  3. Reject key-only features and events that fire only after a new version exists.

Exam tip: Rotation = SecretNearExpiry subscription + an identity that can set secrets.

AI-200 Azure Key Vault and App Configuration: Secret Retrieval, Rotation and Dynamic Settings — the lesson that teaches this.

Question 23Secure, monitor, and troubleshoot Azure solutions

A storage account key used by several apps is stored as a Key Vault secret, and the apps re-read the latest secret version every hour. After each monthly rotation, the apps' storage requests fail for up to an hour and then recover on their own. The apps must keep working through every rotation. How should the rotation function rotate?

Choose one.

  • a
    Regenerate the storage key that the latest secret version holds, then store it as the new version

    This invalidates the key every app is using at that moment, which produces exactly the hour of failures described.

  • b
    Regenerate both storage keys together, then store the pair as one new version of the secret

    Both old keys stop working at once, so every app fails until it re-reads the secret.

  • c
    Regenerate the storage key that the latest secret version doesn't hold, then store it as the new version Correct

    The apps keep using the key in the current version, which stays valid while they move to the new one.

  • d
    Regenerate the key in use, and shorten each app's secret re-read interval to one minute

    A shorter interval only narrows the failure window; requests still fail between regeneration and re-read.

The concept

Two-credential rotation alternates keys: regenerate the one not in use and publish it as the new version.

Why that’s the answer

Resources with two credentials, like storage account keys, allow rotation without downtime. Successive secret versions alternate between key1 and key2: the function regenerates the alternate key (not the one in the latest version) and stores it as the new version. Apps still holding the previous version keep working for a full rotation cycle while they pick up the new key.

How to reason it out
  1. Note that the resource has two valid credentials.
  2. Never regenerate the credential the apps are currently using.
  3. Regenerate the alternate one and publish it as the new version.

Exam tip: With two keys, rotate the one not in use; apps then have a full cycle to switch.

AI-200 Azure Key Vault and App Configuration: Secret Retrieval, Rotation and Dynamic Settings — the lesson that teaches this.

Question 24Secure, monitor, and troubleshoot Azure solutions

An Azure Storage account encrypts its data with a customer-managed key held in Key Vault. Compliance requires a new key version every 90 days, and the team doesn't want to write or maintain any rotation code. What should the developer configure in Key Vault?

Choose one.

  • a
    An Event Grid subscription on KeyNearExpiry that runs a function to create a new key version

    This works, but it's custom code to build and maintain, which the team wants to avoid.

  • b
    An expiration date on the key 90 days out so that Key Vault replaces the key when it expires

    An expiration date doesn't create a replacement; it only marks when the key shouldn't be used.

  • c
    A rotation policy on the key with a lifetime action that rotates it 90 days after creation Correct

    Key rotation policies make Key Vault generate new key versions on a schedule with no code.

  • d
    A certificate policy with an auto-renew lifetime action that runs 90 days after creation

    Certificate lifetime actions renew certificates, not standalone keys used for encryption.

The concept

Keys support native autorotation through a rotation policy; secrets don't.

Why that’s the answer

Key Vault keys can have a rotation policy whose lifetime action rotates the key at a set time after creation (the interval must be at least seven days). Key Vault creates the new version itself, and services using a versionless key URI pick it up. An event-driven function is the pattern for secrets and adds code, expiry alone replaces nothing, and lifetime actions in certificate policies apply to certificates.

How to reason it out
  1. Note the asset type: a key, used as a CMK.
  2. Keys have built-in rotation policies; no code is needed.
  3. Reject the code-based and certificate options.

Exam tip: Keys rotate natively with a rotation policy; secrets need Event Grid plus a function.

AI-200 Azure Key Vault and App Configuration: Secret Retrieval, Rotation and Dynamic Settings — the lesson that teaches this.

Question 25Secure, monitor, and troubleshoot Azure solutions

A vault holds two items: an RSA key that wraps document encryption keys, and the password for a vendor's SFTP server, which only the vendor's API can change. Both must rotate automatically every 90 days, with as little custom code to maintain as possible. Which approach should the developer use?

Choose one.

  • a
    Give both items rotation policies, and let Key Vault create the new key and password values

    Rotation policies exist only for keys; Key Vault can't generate a password or call the vendor's API.

  • b
    Give the RSA key a rotation policy, and use SecretNearExpiry with a function for the SFTP password Correct

    The key rotates natively with no code, and the password needs a function because only the vendor's API can change it.

  • c
    Use SecretNearExpiry with a function for the RSA key, and a rotation policy for the SFTP password

    This swaps the mechanisms: keys raise key events, and secrets can't have rotation policies.

  • d
    Use near-expiry events with functions for both the RSA key and the SFTP password

    This would work, but it adds a second function for the key when a policy rotates it without code.

The concept

Pick the rotation mechanism per object type: rotation policy for keys, event plus function for secrets.

Why that’s the answer

Two facts decide this. Keys support a rotation policy, so the RSA key rotates with zero code. Secrets have no native generator; the password lives in the vendor's system, so a function triggered by SecretNearExpiry must change it there and store the new version. Writing functions for both works but adds code the team wanted to avoid, and the other options rely on policies that don't exist for secrets.

How to reason it out
  1. Classify each item: a key and a secret.
  2. Use the native rotation policy wherever it exists (keys).
  3. Use event-driven code only where it's unavoidable (secrets in external systems).

Exam tip: Least code: rotation policy for keys, SecretNearExpiry + function only for secrets.

AI-200 Azure Key Vault and App Configuration: Secret Retrieval, Rotation and Dynamic Settings — the lesson that teaches this.

Keep going with AI-200

AI-200 practice by domain

AI-200 sample questions: your questions

No. Real exam questions are confidential. These are original questions written to the skills in the official AI-200 exam guide, so they test the same knowledge in the same style without being copies of the exam.

Source

The domains and weights on this page come from the official AI-200 exam guide.