Home / AZ-204: Developing Solutions for Microsoft Azure / Mock exam
AZ-204: Developing Solutions for Microsoft Azure Exam-style mock test

Microsoft Azure Developer (AZ-204) Practice Exams|Practice test

Full explanations Exam format Pass line 70%
33 USD One-time · lifetime access
Enroll →

Sample questions

Example1 · Develop Azure Compute Solutions
Meridian Capital, a global financial services firm, stores a hardened .NET base image and an application image for its trade-settlement API in the same Azure Container Registry. Compliance requires that whenever the platform team pushes a patched base image, the application image is rebuilt automatically using only built-in registry capabilities, with no external pipeline. What should you do?
・Configure a registry webhook on base image pushes that calls an external Azure DevOps pipeline to rebuild the image.
Incorrect. A webhook can notify on pushes, but it requires an external Azure DevOps pipeline to do the rebuild, which violates the requirement to use only built-in registry capabilities.
・Queue a quick task with az acr build whenever the security team announces a patched base image.
Incorrect. az acr build queues a one-off quick task; it has no trigger, so each rebuild would be a manual action rather than an automatic response to the base image push.
✓Create an ACR task with a base image update trigger that rebuilds the application image.
Correct. ACR Tasks track base image dependencies; a task created with az acr task create rebuilds the dependent application image automatically when the base image in the registry is updated.
・Enable a registry retention policy so outdated application image manifests are replaced automatically.
Incorrect. A retention policy only purges untagged manifests to reclaim space; it never builds or updates images.
Explanation
ACR Tasks natively detect dependencies on base images stored in ACR, Microsoft Container Registry, or Docker Hub. A task defined with a base image update trigger automatically rebuilds dependent images on patch, which is exactly the built-in automation compliance demands. Quick tasks, webhooks with external pipelines, and retention policies all fail the no-external-orchestration or automation requirement.
Example2 · Develop for Azure Storage
A global financial services firm runs a portfolio dashboard on Azure Cosmos DB for NoSQL with its write region in East US and read regions in West Europe and Southeast Asia. Advisers must always see their own just-saved annotations when the dashboard refreshes, but the firm wants the lowest read latency and RU charge that still meets this guarantee. Which consistency approach should you implement?
・Set the account default to strong consistency so that every read in every region always returns the latest committed annotation
Incorrect. Strong consistency does guarantee reading the latest write, but reads cost roughly twice the RUs of session reads and incur higher cross-region latency, exceeding the stated requirement.
・Select bounded staleness with a one-hundred-operation lag window applied across all of the read regions
Incorrect. Bounded staleness also charges about double the read RUs and bounds global lag rather than specifically guaranteeing that an adviser reads back their own write.
✓Keep session consistency and propagate the session token across the services that handle an adviser's requests
Correct. Session consistency provides read-your-own-writes within a session at the same read RU cost as eventual consistency; because multiple services handle the adviser, the session token must be propagated between them.
・Choose consistent prefix so replicas never return the adviser's annotation updates out of order
Incorrect. Consistent prefix only guarantees that updates are observed in order; an adviser's refresh may still return a replica state that does not yet include their own latest annotation.
Explanation
Session consistency is the sweet spot here: it guarantees read-your-own-writes for the session holder while reads are billed at the same RU rate as eventual consistency. Strong and bounded staleness both satisfy the functional need but double read RU charges, and consistent prefix cannot guarantee an adviser sees their own just-saved change. When several services participate, the session token must flow with the request.
Example3 · Implement Azure Security
A global investment bank runs an unattended .NET settlement reconciliation job every night that must call a protected internal REST API registered in Microsoft Entra ID. No user is present when the job runs. Which MSAL token acquisition method should the job use?
・AcquireTokenInteractive, prompting an on-call operations engineer to sign in at launch.
Incorrect. AcquireTokenInteractive requires a user to complete a browser-based sign-in; an unattended nightly job has no user present, so the call would block or fail.
・AcquireTokenByDeviceCode, writing the verification code into the job log for entry.
Incorrect. The device code flow still depends on a human visiting the verification URL and entering the code; logging the code does not remove the user interaction requirement.
✓AcquireTokenForClient, authenticating with the app registration's own certificate credential
Correct. AcquireTokenForClient implements the client credentials flow, where a confidential client authenticates as itself with a certificate or secret - the designed pattern for daemon and batch workloads with no user.
・AcquireTokenSilent, reading a cached trader account from storage.
Incorrect. AcquireTokenSilent can only return tokens for an account that previously signed in interactively; a daemon job has no user account in the cache to refresh.
Explanation
Unattended workloads use the OAuth 2.0 client credentials flow, exposed in MSAL as AcquireTokenForClient, where the application proves its own identity with a certificate or client secret. Interactive, device code, and silent acquisition all presume a user account, which a nightly batch job does not have.
Example4 · Monitor, Troubleshoot, and Optimize Azure Solutions
You develop a patient portal for a hospital network. Practitioner directory data in Azure SQL Database changes a few times per day but is read thousands of times per hour. You add Azure Cache for Redis and must implement the cache-aside pattern for directory reads. What should the read path do?
・Query Azure SQL Database first on every read, then overwrite the matching Redis key so the cache always holds the newest copy of the row.
Incorrect. Querying the database on every read removes the latency and load benefit of caching; the cache is never consulted first, so it adds cost without serving reads.
✓Attempt to get the key from Redis; on a miss, query Azure SQL Database, store it in Redis with an expiration, then return it.
Correct. Cache-aside checks the cache first, loads from the database only on a miss, and then populates the cache with an expiration so subsequent reads are served from Redis.
・Push each row into Redis whenever it is written to Azure SQL Database so reads are always served from the cache and never touch the database.
Incorrect. Populating Redis only on database writes is a write-through approach; after an eviction or cache restart there is no miss-handling path, so reads find nothing.
・Enable Redis keyspace notifications so the database is queried automatically whenever a key expires, keeping directory entries warm.
Incorrect. Keyspace notifications only publish expiration events to subscribers; Redis never queries Azure SQL Database itself, so no component reloads the expired data.
Explanation
In cache-aside, the application owns both sides of the cache: it reads Redis first, and on a miss it fetches from the data store and writes the result back with a suitable expiration. This keeps hot directory entries in the cache while tolerating evictions and restarts gracefully.
Example5 · Connect to and Consume Azure Services and Third-Party Services
MedLink Health exposes a FHIR observation API through Azure API Management. All hospital partners share a single subscription key issued to one integration vendor, but each hospital is identified by a tenant claim inside the JWT it sends. The operations team must cap each hospital at 300 calls per minute, counted independently per hospital. Which policy configuration should you apply in the inbound section?
✓Apply a rate-limit-by-key policy that uses the tenant claim extracted from the incoming JWT as its counter-key expression
Correct. rate-limit-by-key lets you define the throttling counter with an arbitrary expression; keying it on the JWT tenant claim gives every hospital its own independent 300-calls-per-minute counter.
・Apply a rate-limit policy with calls set to 300 and the renewal-period set to 60 seconds
Incorrect. The rate-limit policy counts calls per subscription, and all hospitals share one subscription key, so they would consume a single shared counter instead of 300 calls each.
・Apply a quota-by-key policy keyed on the caller IP address with a 60-second renewal period
Incorrect. quota-by-key is designed for long-term call volume or bandwidth allowances, and keying on caller IP would merge or split hospitals arbitrarily since IP does not map to the tenant claim.
・Apply an ip-filter policy allowing only the address ranges registered for each hospital
Incorrect. ip-filter only allows or denies traffic by address range; it performs no call counting, so it cannot enforce a per-minute throttle for each hospital.
Explanation
When multiple logical callers share one subscription, per-subscription throttling cannot separate them. The rate-limit-by-key policy accepts a counter-key expression, so extracting the tenant claim from the incoming JWT creates an independent sliding counter per hospital. Quota policies target long-term allowances, and IP filtering performs no throttling at all.
Example6 · Develop Azure Compute Solutions
MediLab Genomics stores the container image for its variant-analysis API in Azure Container Registry, built from a Dockerfile in a Git repository. The compliance team requires that whenever the .NET base image in the same registry receives a security patch, the dependent API image is rebuilt with no manual intervention. What should you do?
・Run az acr build against the repository whenever the security team announces a base image patch.
Incorrect. az acr build runs a one-off quick task; it has no trigger mechanism, so a human must notice the patch and start the build, which violates the no-manual-intervention requirement.
・Configure a nightly scheduled ACR task that rebuilds the API image from the repository.
Incorrect. A timer-triggered task rebuilds on a fixed schedule, so a patched base image could sit unaddressed for up to a day and builds also run needlessly when nothing changed; it is not event-driven on the base image update.
✓Create an ACR task with a base image update trigger so dependent images rebuild automatically.
Correct. ACR tasks created with az acr task create track base image dependencies and automatically queue a rebuild of the dependent image when the base image in the registry is updated.
・Configure an Azure DevOps pipeline that polls the registry every hour and queues a rebuild when the base digest changes.
Incorrect. Hourly polling from an external pipeline introduces delay and custom plumbing that ACR tasks already provide natively through the built-in base image update trigger.
Explanation
ACR tasks support a base image update trigger: when a tracked base image in the registry (or a supported public registry) is updated, the task automatically rebuilds dependent images. Quick tasks, timer schedules, and external polling pipelines all require manual action, add delay, or duplicate functionality ACR provides natively.
Example7 · Develop Azure Compute Solutions
HelioForge Industrial, a maker of CNC machine controllers, keeps a hardened .NET base image and an application image in Azure Container Registry. When the platform team patches the base image, the application image must be rebuilt and pushed automatically without anyone starting a manual build. What should you do?
・Create an ACR webhook on the application repository that calls az acr build whenever a new tag is pushed.
Incorrect. A webhook on the application repository fires after the application image itself is pushed; it never observes updates to the separate base image repository, so no rebuild is triggered by the patch.
・Create an ACR task with only a timer trigger that rebuilds the application image on a nightly schedule.
Incorrect. A timer trigger rebuilds on a fixed schedule regardless of changes, so patched base layers can sit unused for hours and nights without a patch waste a build; it is not event-driven on the base update.
・Run az acr import after every base image patch so the patched base layers are copied into the application repository.
Incorrect. az acr import copies an existing image between registries or repositories; it cannot rebuild the application layers on top of the patched base, so the running app would still use stale layers.
✓Create an ACR task with az acr task create so an automated build fires whenever the tracked base image is updated in the registry.
Correct. An ACR task created with az acr task create tracks base image dependencies declared in the Dockerfile, so whenever the tracked base image is updated in the registry the task automatically rebuilds and pushes the dependent application image.
Explanation
ACR Tasks support a base image update trigger: when a Dockerfile's FROM image is tracked and that base image changes in the registry, the task rebuilds and pushes the dependent image automatically. Webhooks, timer triggers, and az acr import either react to the wrong event or never rebuild at all.
Example8 · Develop Azure Compute Solutions
TransPolar Freight runs a nightly manifest-reconciliation job as a container group in Azure Container Instances. The process completes its work and exits with code 0, yet the portal shows the container repeatedly returning to the Running state. The job must execute exactly once per deployment. What should you do?
・Add a liveness probe to the container so the platform detects that the reconciliation process has already finished.
Incorrect. Liveness probes cause a container to be restarted when the probe fails; they do not override the container group's restart policy, which is what keeps relaunching the exited process.
・Change the process to exit with a nonzero code so the platform records the run as a completed job.
Incorrect. A nonzero exit code marks the run as failed; the relaunch behavior is governed by the restart policy, and with Always the group restarts regardless of the exit code returned.
・Lower the container group CPU and memory requests so the scheduler stops recycling the instance between the nightly runs.
Incorrect. Resource requests control CPU and memory allocation for scheduling; they have no effect on whether an exited container is restarted, which is decided solely by the restart policy.
✓Redeploy the container group with its restart policy set to Never for run-to-completion behavior.
Correct. ACI container groups default to the Always restart policy. Setting the restart policy to Never gives run-to-completion semantics: after the process exits, the group moves to Terminated and stays there.
Explanation
Azure Container Instances applies a restart policy of Always by default, so a batch container is relaunched even after a clean exit. Deploying the container group with restart policy Never (or OnFailure for retry-on-error jobs) makes it run to completion and remain in the Terminated state.
Example9 · Develop Azure Compute Solutions
A parcel-tracking API runs on Azure Container Apps in single revision mode. The team wants to route 10 percent of production traffic to a new build for canary validation and be able to roll back instantly, without creating any additional Azure resources. What should you do?
✓Switch the app to multiple revision mode and set traffic weights of 90 and 10 on the two revisions.
Correct. In multiple revision mode, Container Apps keeps both revisions active and the ingress honors traffic weights, so 90/10 splitting and instant rollback (shift weight back to 100/0) work with no new resources.
・Deploy a second container app behind Azure Front Door and use a routing rule to send 10 percent of client sessions to it.
Incorrect. This can split traffic, but it requires provisioning Azure Front Door and a second container app, which violates the requirement to avoid creating additional Azure resources.
・Stay in single revision mode and apply revision labels so ingress splits incoming requests between the builds.
Incorrect. In single revision mode only one revision is active at a time, so labels cannot be used to split live traffic; weighted splitting requires switching the app to multiple revision mode.
・Enable session affinity on the ingress so a share of connected clients stays pinned to the newest replica.
Incorrect. Session affinity pins each client to the same replica within the active revision; it provides no percentage-based division of traffic between an old and a new revision.
Explanation
Canary releases in Azure Container Apps are done by switching the app to multiple revision mode and assigning traffic weights across active revisions through ingress traffic splitting. Rollback is immediate because weights can be rebalanced to the stable revision without redeploying or adding infrastructure.
Example10 · Develop Azure Compute Solutions
A B2B SaaS vendor builds its billing API image on a .NET base image hosted in Microsoft Artifact Registry. The team must have its image in Azure Container Registry rebuilt automatically whenever the upstream base image is patched, without operating any build infrastructure of its own. What should the developer configure?
・Run az acr build from the pipeline each time a developer pushes code to the main branch.
Incorrect. az acr build runs a one-off quick task triggered by your command; it has no trigger tied to upstream base image updates, so a patched base image would not cause a rebuild.
・Add an ACR webhook that calls a deployment endpoint whenever a new image tag is pushed.
Incorrect. ACR webhooks fire on push or delete events in your own registry; they cannot detect that a base image changed in Microsoft Artifact Registry, and they notify an endpoint rather than run a build.
✓Create an ACR task whose base image update trigger rebuilds the image.
Correct. ACR tasks created with az acr task create support a base image update trigger: when the referenced base image changes in the upstream registry, ACR automatically queues a rebuild of the dependent image with no build infrastructure to manage.
・Schedule a job on a self-hosted build agent that runs docker build and docker push to the registry every night.
Incorrect. A self-hosted agent is exactly the build infrastructure the team wants to avoid, and a nightly schedule rebuilds on a timer rather than reacting when the base image is actually patched.
Explanation
ACR Tasks can track the base image referenced in a Dockerfile and automatically rebuild the application image when that base image is updated, which is the standard way to keep images patched without self-managed build agents. Quick tasks (az acr build), webhooks, and scheduled external builds all lack the base image update trigger.
Example11 · Develop Azure Compute Solutions
An online gaming studio runs a nightly leaderboard aggregation job as an Azure Container Instances container group. The job completes with exit code 0, but the container keeps getting restarted and the aggregation runs over and over. What should the developer change in the deployment?
✓Set the container group restart policy to OnFailure when creating the instance so it stops after a clean exit.
Correct. ACI defaults to a restart policy of Always, which restarts containers even after a clean exit. For run-to-completion batch work, OnFailure (or Never) stops the group once the process exits with code 0.
・Increase the CPU and memory requests allocated to the container so it is not evicted from the host after it finishes.
Incorrect. The container is not being evicted for resource pressure; it is being restarted by the Always restart policy after a successful exit, so resizing CPU and memory changes nothing.
・Move the job logic into a sidecar container so the main container keeps running.
Incorrect. Adding a sidecar does not stop the restart behavior; the group's restart policy still applies, and keeping an idle container running wastes billing for a batch job.
・Configure a liveness probe so the platform waits for the process to finish before restarting.
Incorrect. Liveness probes decide whether a running container is healthy; they do not govern what happens after a process exits, which is controlled by the restart policy.
Explanation
Azure Container Instances uses restart policy Always by default, so a batch container that exits successfully is restarted in a loop. Setting --restart-policy OnFailure (or Never) makes the container group terminate after a clean exit, which is the intended pattern for run-once jobs.
Example12 · Develop Azure Compute Solutions
Vattenkraft Nord, a hydroelectric utility, builds a telemetry API image in Azure Container Registry from a Dockerfile that starts with FROM mcr.microsoft.com/dotnet/aspnet:8.0. The security team requires that the image is rebuilt automatically whenever Microsoft publishes a patched version of that base image, with no manual steps and no rebuilds when nothing has changed. What should you configure?
・Configure a registry webhook on the repository that notifies your release pipeline whenever any new image tag is pushed into the registry.
Incorrect. Registry webhooks fire on pushes to your own registry's repositories; they cannot observe new tags of mcr.microsoft.com base images, so a patched base image would never trigger the rebuild.
・Create an ACR task with a timer trigger that rebuilds the image from the Dockerfile on a nightly schedule.
Incorrect. A timer trigger rebuilds on a schedule regardless of whether the base image changed, so it wastes builds on unchanged days and can lag a patch by up to a day.
・Run az acr build from the release pipeline each time a developer merges changes into the application repository.
Incorrect. az acr build runs on demand when application code merges; it has no awareness of upstream base image patches, so a base-only security fix would never cause a rebuild.
✓Create an ACR task with a base image update trigger that rebuilds the image when the base image changes.
Correct. ACR Tasks track base image dependencies declared in the Dockerfile, and a base image update trigger automatically rebuilds the dependent image when the referenced base image is updated, exactly matching the requirement.
Explanation
ACR Tasks can declare a base image update trigger, which monitors the base image referenced in the Dockerfile's FROM line and automatically queues a rebuild of the dependent image when that base is patched. Timer triggers, webhooks on your own registry, and source-code-driven builds all fail to react specifically to upstream base image updates.
Example13 · Develop Azure Compute Solutions
The national Ministry of Education runs a nightly student-enrollment export as a container group in Azure Container Instances. The container exits with code 0 when the export succeeds, yet ACI keeps starting it again, producing duplicate export files. The job must still be retried automatically whenever it exits with a non-zero code. Which change meets the requirement?
・Keep the default restart policy but make the finished export process sleep forever.
Incorrect. Keeping the process alive after completion means the container group never terminates, so compute is billed continuously all night and a genuine failure exit would still be restarted blindly under the Always policy.
✓Deploy the container group with its restart policy set to OnFailure instead of the default policy.
Correct. The default ACI restart policy is Always, which restarts the container even after a successful exit; OnFailure restarts the container only when it terminates with a non-zero exit code, giving automatic retries without duplicate successful runs.
・Deploy the container group with a restart policy of Never so the container is left in a terminated state.
Incorrect. With Never, the container is not restarted for any exit code, so a failed export ending with a non-zero code would not be retried, violating the retry requirement.
・Add a liveness probe to the container so Azure restarts it only when the probe reports an unhealthy state.
Incorrect. Liveness probes address hung or unhealthy long-running containers; they do not change the restart policy decision that is applied after the process exits, so successful exits would still be restarted.
Explanation
ACI container groups default to the Always restart policy, which relaunches a container even after a clean exit code 0. Setting the restart policy to OnFailure restarts the container only on non-zero exit codes, which is the standard pattern for run-once batch jobs that need automatic retry on failure.
Example14 · Develop Azure Compute Solutions
Meridian Assurance, an insurance carrier, stores its claims-intake application image in Azure Container Registry. The image is built FROM a company base image kept in the same registry. The platform team regularly pushes patched versions of that base image, and the developers must ensure the application image is rebuilt automatically whenever the patched base image lands, without anyone running a manual build. What should they implement?
・Run az acr build each time developers merge code so the latest base layers are pulled during the build.
Incorrect. az acr build is a quick task that runs only when invoked; it fires on code merges, not when the base image is patched, so a base update with no code change triggers nothing.
・Configure an ACR webhook that calls a deployment endpoint whenever any image is pushed and then redeploy the existing application image.
Incorrect. A webhook can notify an endpoint on push, but redeploying the existing application image does not rebuild it, so the stale base layers remain inside the running image.
✓Create an ACR task with a base image update trigger that rebuilds the application image automatically.
Correct. ACR tasks created with az acr task create track base image dependencies and, with the base image update trigger enabled, automatically rebuild the dependent application image when the base image in the registry is updated.
・Schedule a nightly az acr import to copy the patched base image elsewhere.
Incorrect. az acr import only copies an image between registries or repositories; it never rebuilds the application image on top of the patched base layers.
Explanation
ACR Tasks can track the base image declared in a Dockerfile and rebuild dependent images when that base image is updated in the same registry (or in Docker Hub/MCR). Quick tasks, webhooks, and image imports all lack this dependency-tracking rebuild behavior, leaving the patched layers out of the application image.
Example15 · Develop Azure Compute Solutions
Wanderlane Travel runs a nightly fare-aggregation job as a single container in Azure Container Instances. The process finishes its work, writes results to storage, and exits with status code 0, yet the container group keeps relaunching the container and the job reprocesses the same data all night. What should the developer change so the container runs exactly once per deployment?
✓Set the container group's restart policy to Never so the batch instance runs once and then stops after the process exits.
Correct. ACI container groups default to the Always restart policy; deploying with --restart-policy Never (or OnFailure) lets a batch container run to completion and move to Terminated instead of being relaunched.
・Modify the application to exit with a nonzero status code so Azure stops scheduling container restarts.
Incorrect. Under the default Always policy the container is restarted regardless of exit code, and a nonzero code combined with OnFailure would also cause restarts; the exit status is not the lever here.
・Reduce the container group CPU and memory requests so the platform deallocates the group after the run.
Incorrect. CPU and memory requests control resource allocation and pricing; they have no effect on whether ACI relaunches a container after its process exits.
・Redeploy the container group with a liveness probe that marks the container unhealthy once the job finishes.
Incorrect. A liveness probe that reports an unhealthy container causes ACI to restart that container, which is the opposite of letting the finished job stay stopped.
Explanation
Azure Container Instances applies the Always restart policy by default, so even a clean exit code 0 leads to a relaunch. Batch-style, run-once workloads should be deployed with the restart policy set to Never (or OnFailure when retries on errors are desired) so the group reports Terminated after completion.
▶ Try 10 free questions (graded)
Measure your readiness with a full mock exam
All questions · full explanations · lifetime access
Enroll(33 USD)