# Free AI-200 practice questions

> 10 free AI-200 practice questions with the correct answer and an explanation.

Page: https://devopscodelab.com/exams/microsoft-ai-200/free-practice-questions/
Practice exams: https://devopscodelab.com/exams/microsoft-ai-200/

### Question 1 of 10

A Container App uses a KEDA azure-servicebus scale rule. Company policy forbids connection strings anywhere in the app configuration. How should the scale rule authenticate to Service Bus?

- A. Reference a managed identity assigned to the app in the scale rule's identity property and give it data-plane access to the namespace
- B. Store the Service Bus connection string as a Container Apps secret and reference it from the auth section of the scale rule
- C. Enable the Dapr sidecar and let a Dapr pub/sub component report the queue length to KEDA through its metadata
- D. Generate a SAS token during deployment and pass it to the scale rule through an environment variable on the container

**Answer:** A

**Explanation:** Container Apps scale rules can authenticate to Azure resources with a managed identity assigned to the app, so KEDA reads queue metrics with an Entra token and no connection string is stored. A connection string kept as a secret, or a SAS token injected through an environment variable, both place a shared-key credential in the app configuration and break the policy. Dapr components do not feed metrics to KEDA scale rules, and a Dapr pub/sub component would itself need credentials.

### Question 2 of 10

In Azure Container Apps you rotate the value of a secret that one container references as an environment variable. The app runs in single revision mode. Users report that the container still uses the old value. What should you do?

- A. Change the secret to a Key Vault reference so the platform pushes new values to running replicas
- B. Switch the app to multiple revision mode so secret changes automatically produce a new revision
- C. Create a new revision or restart the existing revision so the replicas pick up the new secret value
- D. Set the minimum replica count to zero so the revision scales in and loads the secret on the next request

**Answer:** C

**Explanation:** Secrets are application-scope settings; changing them does not create a new revision, and running replicas keep the values they started with until the revision is restarted or a new revision is deployed. Key Vault referenced secrets are also only read when replicas start, so they are not pushed to running containers. Relying on scale to zero is indirect and may never happen under steady traffic. Revision mode does not change how secret updates are applied.

### Question 3 of 10

A Container App processes document-embedding jobs from an Azure Service Bus queue. It must scale out based on queue length and scale to zero when the queue is empty. Which configuration meets these requirements?

- A. A custom scale rule of type azure-servicebus that sets the queue name and message count, with minimum replicas set to 0
- B. An HTTP scale rule with a concurrent requests threshold and a minimum replica count of 1
- C. A CPU-based scale rule at 70 percent utilization with the maximum replica count set to 30
- D. A TCP scale rule that counts open connections to the Service Bus namespace with minimum replicas set to 0

**Answer:** A

**Explanation:** Container Apps supports KEDA scalers as custom scale rules; the azure-servicebus scaler reads queue length and, with minimum replicas 0, the app scales to zero when no messages wait. HTTP rules react to inbound requests, which a queue consumer does not receive, and a minimum of 1 prevents scaling to zero. CPU rules cannot scale to zero and lag behind the backlog. Connection count to Service Bus does not reflect pending work.

### Question 4 of 10

A container stores product documents with a 1536-dimension embedding at /embedding. Inserts consume far more RUs than expected, and the indexing policy uses the default automatic range indexing on /* along with a diskANN vector index. What change reduces write cost without breaking vector search?

- A. Remove the diskANN vector index and rely on a full scan with VectorDistance
- B. Add /embedding/* to excludedPaths in the indexing policy
- C. Add a composite index on /embedding and /category to the policy
- D. Switch the indexing mode to none so that no index is maintained during writes

**Answer:** B

**Explanation:** Each number in the embedding array is otherwise range-indexed by the default policy, which inflates write RUs; excluding the vector path from regular indexing is recommended while the vector index still serves similarity queries. Indexing mode none disables querying through indexes entirely. Dropping the vector index makes every vector query a brute-force scan with high RU and latency. A composite index adds yet more index maintenance for no benefit.

### Question 5 of 10

A change feed processor in latest version mode keeps a search index synchronized with a Cosmos DB container. Deleted products remain in the search index. Which approach fixes this while keeping latest version mode?

- A. Configure the processor to start from the beginning of the container so that it replays the deletes on the next restart
- B. Enable multi-region writes so that conflict feed entries capture deletions for the processor
- C. Set a soft-delete flag on the item, let the processor remove it from the index, and use TTL to purge it later
- D. Increase the lease container throughput so delete events are no longer throttled by the service

**Answer:** C

**Explanation:** Latest version mode does not emit deletes, so the common pattern is to mark items deleted as an update, which the processor sees, and let time to live remove the item afterward. Replaying from the beginning still emits no delete records. Lease throughput affects checkpointing, not which operations appear. The conflict feed relates to multi-region write conflicts, not ordinary deletes.

### Question 6 of 10

An API using Entra authentication to PostgreSQL keeps a connection pool open for days. After about an hour, new connections created by the pool start failing authentication while existing ones keep working. What is the cause and fix?

- A. PgBouncer rejects Entra logins after an hour; switch the pool to connect on port 5432 directly
- B. The managed identity was rotated by Azure; restart the container to load the new identity
- C. The server parameter idle_session_timeout closed the pool; set it to zero on the flexible server
- D. The token used as password expired; get a new token each time the pool opens a connection

**Answer:** D

**Explanation:** Entra access tokens are short-lived; existing sessions stay authenticated, but new connections using the cached expired token fail, so the pool must request a new token for each new connection, for example through a connection factory or password callback. An idle timeout would close sessions, not fail new logins. Managed identities do not rotate in a way that requires restarts. PgBouncer supports Entra authentication; the port is not the issue.

### Question 7 of 10

A Service Bus-triggered function must connect to the namespace without a connection string. The trigger uses connection="SB". Which app setting enables an identity-based connection with the function app's managed identity?

- A. SB__fullyQualifiedNamespace set to contoso.servicebus.windows.net
- B. SB__accountName set to contoso so that the runtime builds the endpoint
- C. SB set to Endpoint=sb://contoso.servicebus.windows.net/;Authentication=Managed Identity
- D. SB__clientSecret set to the managed identity's object ID

**Answer:** A

**Explanation:** Identity-based connections use a prefix with double-underscore properties; for Service Bus, <prefix>__fullyQualifiedNamespace tells the extension to authenticate with the managed identity, which also needs a data role such as Azure Service Bus Data Receiver. A connection string with an authentication keyword applies to other clients, not to this extension setting. A managed identity has no client secret. accountName is used for storage accounts, not Service Bus.

### Question 8 of 10

A Python worker receives messages from a Service Bus queue in peek-lock mode. Some messages contain malformed JSON and fail every time. After several attempts they disappear from the queue. Where do they go, and what governs when?

- A. They are moved to a poison queue named after the original queue with a -poison suffix
- B. They are deferred automatically and can be retrieved later by their sequence number
- C. They expire and are discarded once the queue's default message time to live elapses
- D. They are dead-lettered when the delivery count exceeds MaxDeliveryCount

**Answer:** D

**Explanation:** Each failed peek-lock delivery increments the delivery count; when it exceeds MaxDeliveryCount (10 by default) Service Bus moves the message to the queue's dead-letter subqueue. Expired messages are only dead-lettered if dead-lettering on expiration is enabled, and that is not what repeated failures trigger. Deferral is an explicit receiver action. The -poison queue convention belongs to Azure Storage queues with Azure Functions.

### Question 9 of 10

What is the minimum change needed to send traces, metrics and logs from a Flask-based RAG API to Application Insights using Microsoft's recommended OpenTelemetry approach?

- A. Install the Log Analytics agent on the App Service plan and enable diagnostic settings for the app
- B. Install the Application Insights JavaScript SDK and add its snippet to every HTML page
- C. Enable the Diagnostics logging setting in App Service and write all telemetry to stdout
- D. Install azure-monitor-opentelemetry and call configure_azure_monitor() with the connection string

**Answer:** D

**Explanation:** The Azure Monitor OpenTelemetry Distro for Python configures exporters and common instrumentations with a single configure_azure_monitor call, reading the connection string from a parameter or APPLICATIONINSIGHTS_CONNECTION_STRING. The JavaScript SDK instruments browsers, not a Python back end. The legacy Log Analytics agent and diagnostic settings do not produce distributed traces. App Service logs capture console output but not structured traces and metrics.

### Question 10 of 10

You must rotate a third-party API key stored in Key Vault 30 days before it expires, with no manual steps. Which design follows Microsoft's recommended rotation pattern?

- A. Enable purge protection on the vault so that Key Vault keeps the previous version of the secret valid for 30 days after it expires
- B. Enable the key rotation policy on the vault so that Key Vault calls the third-party API and generates a new secret version automatically before expiry
- C. Configure a Logic App that runs daily, deletes the secret, and recreates it with a new value that an administrator emails to the operations team
- D. Set an expiry on the secret and let a function subscribed to the SecretNearExpiry event obtain a new key and store a new version

**Answer:** D

**Explanation:** Key Vault publishes a SecretNearExpiry event to Event Grid before expiry; a function handling it can call the third party, obtain a new key and store it as a new secret version. Rotation policies auto-rotate Key Vault keys only, and Key Vault cannot call a third-party API to regenerate a secret. Deleting and recreating secrets with manual email is neither automated nor safe. Purge protection prevents permanent deletion; it does not keep expired secrets valid.

Ready for a timed run? Take the free 15-question AI-200 mini exam: https://devopscodelab.com/app/exams/microsoft-ai-200/mini/

DevOpsCode Lab is not affiliated with Microsoft. AI-200 and related names are trademarks of their owners. We write every question ourselves; these are not real exam questions.
