AZ-400
Free AZ-400 practice questions
10 questions from our AZ-400 practice tests, each with the correct answer and a written explanation. Read them with the answers shown, or switch to quiz mode and answer first.
Question 1 of 10, Design and implement processes and communications
Your team hosts code in GitHub and plans work in Azure Boards. Developers want a commit or pull request to appear on the related work item automatically, and merging the pull request should move the work item to Done. What should you configure?
- ACreate a service hook in Azure DevOps that posts work item updates to a GitHub webhook endpoint on every push to the repository
- BAdd the repository as an Azure Repos import, then use the Development section of each work item to link the imported branches
- CInstall the Azure Boards app for GitHub, connect the repo to the project, and mention items as Fixes AB#ID Correct answer
- DEnable GitHub Issues sync in the Boards process template and mention the work item number with #ID in each commit message
Answer and explanation: The Azure Boards app for GitHub connects a GitHub repository to an Azure Boards project; AB#ID mentions create links, and a keyword such as Fixes or Closes transitions the item when the pull request merges into the default branch. A service hook sends Azure DevOps events outward and does not parse GitHub commits. Importing into Azure Repos duplicates the code rather than integrating GitHub. There is no Issues sync setting in the process template, and #ID refers to GitHub issues, not Boards work items.
Question 2 of 10, Design and implement a source control strategy
A team practising trunk-based development wants every change to main to come through a pull request that has at least two approvals, a successful CI build, and resolved comments. Pushing directly to main must be blocked for everyone except administrators who explicitly bypass policies. What should you configure in Azure Repos?
- AA required template check on main that validates the azure-pipelines.yml file
- BBranch locks on main, combined with a Git hook that rejects unreviewed commits
- CBranch policies on main for minimum reviewers, build validation, and comment resolution Correct answer
- DRepository permissions that deny Contribute on the main branch to the Contributors group
Answer and explanation: Once any required branch policy is set on main, direct pushes are rejected and changes must flow through pull requests that satisfy minimum reviewers, build validation and comment resolution; only users with Bypass permissions can override. Denying Contribute stops people from completing pull requests too. Required template checks protect environments and resources, not branches. Branch locks make a branch read-only, and Azure Repos does not run server-side custom Git hooks.
Question 3 of 10, Design and implement build and release pipelines
Your platform team manages a resource group with Bicep. Application teams sometimes delete resources manually in the portal, and you need Azure to block deletes of the managed resources while also removing resources that drop out of the template. Which approach meets both requirements?
- ADeploy in Complete mode and apply a CanNotDelete resource lock on the resource group
- BA deployment stack with action-on-unmanage deleteResources and deny settings mode denyDelete Correct answer
- CPublish the Bicep file as a template spec and assign Azure Policy with a deny effect on deletes
- DDeploy in Incremental mode and assign application teams the Reader role on the resource group
Answer and explanation: Deployment stacks track the resources they manage, can delete resources that leave the template, and apply deny settings that block deletes by anyone not excluded. Complete mode deletes unmanaged resources but a CanNotDelete lock would also stop Complete mode from removing them. Azure Policy deny cannot block delete operations in general, and template specs only store templates. Incremental mode never removes resources, and Reader would stop teams doing legitimate work.
Question 4 of 10, Design and implement build and release pipelines
A release must deploy a database schema change and a new API version that relies on the new columns. Older API instances keep running during the rollout, and the team wants every step to be reversible. Which approach is best?
- APublish a DACPAC with BlockOnPossibleDataLoss=false in the same stage as the API deployment
- BDeploy schema and API in one stage and restore a point-in-time backup if the release fails
- CRun an additive (expand) migration, deploy the API, and drop old columns in a later (contract) release Correct answer
- DDeploy the API first, with a startup routine that applies any pending EF Core migrations to the database
Answer and explanation: The expand and contract pattern adds backward-compatible schema changes first so that old and new API versions both work, and removes old structures only after nothing depends on them, which keeps each step reversible. Migrations at application startup race across instances and break older instances. Allowing data loss can destroy columns that running code still uses. A point-in-time restore discards data written after the backup and is slow.
Question 5 of 10, Design and implement build and release pipelines
A pipeline should let a person choose the target region from a fixed list (westeurope, eastus, or southeastasia) when they queue a run manually, and the choice must control which template the pipeline includes. What should you use?
- AA variable group that holds the region and is edited before each run is queued
- BAn environment per region selected through a manual validation task at runtime
- CA pipeline variable settable at queue time, used in a $[ ] runtime expression
- DA string runtime parameter with a values list, used in a ${{ }} expression Correct answer
Answer and explanation: Runtime parameters can restrict input to a list of values and are available at compile time, so ${{ }} expressions can select which template to include. Queue-time variables are strings without a picklist and are not available when templates are expanded. Editing a variable group before each run is error prone and affects every pipeline. A manual validation task pauses a run but cannot change which templates were compiled.
Question 6 of 10, Design and implement build and release pipelines
Developers want to spin up a full copy of an application stack in Azure on demand for feature testing, using templates curated by the platform team, without being granted Contributor on any subscription. Which service should you implement?
- AAzure DevTest Labs with formulas, artifacts, and custom images that developers can claim
- BAzure Deployment Environments with a dev center catalog and project environment types Correct answer
- CAzure Managed Applications published in a service catalog for each subscription
- DTemplate specs shared to developers with Template Spec Reader permissions only
Answer and explanation: Azure Deployment Environments lets platform engineers publish IaC templates in a catalog and map environment types to subscriptions and identities, so developers self-serve without direct subscription rights. DevTest Labs targets individual VMs and lab environments rather than curated application stacks. Managed Applications package solutions for consumers with a different lifecycle. Template Spec Reader only lets users read templates; deploying still needs rights on the target scope.
Question 7 of 10, Design and implement build and release pipelines. Choose 2.
A hybrid deployment must update an on-premises Windows server farm and Azure App Service from one YAML pipeline. The servers cannot accept inbound connections from the internet. Which two components should you use? (Choose two.)
- AAn AzureWebApp task in a deployment job that uses an Azure Resource Manager service connection Correct answer
- BA WinRM-based deployment from Microsoft-hosted agents to the servers' public IP addresses
- CAn environment with virtual machine resources registered by running the agent script on each server Correct answer
- DA self-hosted agent in an Azure VNet that copies files to each server over an inbound SMB share
- EA classic deployment group referenced directly from a YAML deployment job
Answer and explanation: VM resources in an environment run an agent on each server that connects outbound to Azure DevOps, so no inbound access is needed, and deployment jobs can target them. App Service is updated with the AzureWebApp task through an ARM service connection. WinRM from hosted agents needs inbound connectivity. Copying from Azure over an inbound SMB share also requires inbound access to the servers. Classic deployment groups cannot be used directly in YAML.
Question 8 of 10, Design and implement build and release pipelines
A deployment job targets a YAML environment named prod. The release manager must approve every deployment, and deployments must not start outside 08:00 to 18:00 on weekdays. Where should you configure these controls?
- AAdd Approvals and Business Hours checks on the prod environment Correct answer
- BRestrict the prod service connection to run only on agent pools in business hours
- CAdd pre-deployment approvals and gates to the prod release stage
- DAdd a manual validation task and a cron schedule to the pipeline
Answer and explanation: Checks on a YAML environment, including Approvals and Business Hours, are evaluated before any deployment job that targets the environment starts, and pipeline authors cannot bypass them by editing YAML. A manual validation task and a schedule live in the pipeline file and can be changed by authors. Pre-deployment approvals and gates belong to classic release pipelines. Service connections and agent pools have no business-hours setting.
Question 9 of 10, Develop a security and compliance plan
A GitHub Actions workflow deploys to Azure. Security policy forbids storing long-lived client secrets in GitHub. What should you configure?
- AA self-hosted runner on an Azure VM with a system-assigned identity granted Owner on the subscription
- BA service principal client secret stored as an organization secret that is rotated every 30 days
- CA fine-grained personal access token scoped to the repository and stored as a production environment secret
- DA federated credential on a Microsoft Entra app for the repo and environment, used by azure/login with OIDC Correct answer
Answer and explanation: Workload identity federation lets the workflow exchange its GitHub OIDC token for a Microsoft Entra token, so no secret is stored. A rotated client secret is still a long-lived secret in GitHub. A GitHub personal access token cannot authenticate to Azure Resource Manager. A self-hosted runner with a managed identity avoids secrets, but granting Owner breaks least privilege and adds runner management that the requirement does not call for.
Question 10 of 10, Implement an instrumentation strategy
Operations wants CPU, memory, disk, and network performance counters plus a dependency map of processes for a fleet of Azure VMs, with minimal setup. What should you enable?
- AApplication Insights with the classic instrumentation key on each VM
- BVM Insights with the Azure Monitor Agent and a data collection rule Correct answer
- CBoot diagnostics and the serial console on each VM in the fleet
- DContainer Insights for the VMs with the Log Analytics agent extension
Answer and explanation: VM Insights uses the Azure Monitor Agent and a data collection rule to collect guest performance counters and, optionally, the process dependency map. Application Insights instruments applications, not guest OS counters or process maps. Container Insights targets Kubernetes and containers, and the Log Analytics agent is retired. Boot diagnostics capture screenshots and serial logs for troubleshooting, not performance data.