# Free AZ-400 practice questions

> 10 free AZ-400 practice questions with the correct answer and an explanation.

Page: https://devopscodelab.com/exams/microsoft-az-400/free-practice-questions/
Practice exams: https://devopscodelab.com/exams/microsoft-az-400/

### Question 1 of 10

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?

- A. Create a service hook in Azure DevOps that posts work item updates to a GitHub webhook endpoint on every push to the repository
- B. Add the repository as an Azure Repos import, then use the Development section of each work item to link the imported branches
- C. Install the Azure Boards app for GitHub, connect the repo to the project, and mention items as Fixes AB#ID
- D. Enable GitHub Issues sync in the Boards process template and mention the work item number with #ID in each commit message

**Answer:** C

**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

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?

- A. A required template check on main that validates the azure-pipelines.yml file
- B. Branch locks on main, combined with a Git hook that rejects unreviewed commits
- C. Branch policies on main for minimum reviewers, build validation, and comment resolution
- D. Repository permissions that deny Contribute on the main branch to the Contributors group

**Answer:** C

**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

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?

- A. Deploy in Complete mode and apply a CanNotDelete resource lock on the resource group
- B. A deployment stack with action-on-unmanage deleteResources and deny settings mode denyDelete
- C. Publish the Bicep file as a template spec and assign Azure Policy with a deny effect on deletes
- D. Deploy in Incremental mode and assign application teams the Reader role on the resource group

**Answer:** B

**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

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?

- A. Publish a DACPAC with BlockOnPossibleDataLoss=false in the same stage as the API deployment
- B. Deploy schema and API in one stage and restore a point-in-time backup if the release fails
- C. Run an additive (expand) migration, deploy the API, and drop old columns in a later (contract) release
- D. Deploy the API first, with a startup routine that applies any pending EF Core migrations to the database

**Answer:** C

**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

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?

- A. A variable group that holds the region and is edited before each run is queued
- B. An environment per region selected through a manual validation task at runtime
- C. A pipeline variable settable at queue time, used in a $[ ] runtime expression
- D. A string runtime parameter with a values list, used in a ${{ }} expression

**Answer:** D

**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

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?

- A. Azure DevTest Labs with formulas, artifacts, and custom images that developers can claim
- B. Azure Deployment Environments with a dev center catalog and project environment types
- C. Azure Managed Applications published in a service catalog for each subscription
- D. Template specs shared to developers with Template Spec Reader permissions only

**Answer:** B

**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 (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.)

- A. An AzureWebApp task in a deployment job that uses an Azure Resource Manager service connection
- B. A WinRM-based deployment from Microsoft-hosted agents to the servers' public IP addresses
- C. An environment with virtual machine resources registered by running the agent script on each server
- D. A self-hosted agent in an Azure VNet that copies files to each server over an inbound SMB share
- E. A classic deployment group referenced directly from a YAML deployment job

**Answer:** A, C

**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

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?

- A. Add Approvals and Business Hours checks on the prod environment
- B. Restrict the prod service connection to run only on agent pools in business hours
- C. Add pre-deployment approvals and gates to the prod release stage
- D. Add a manual validation task and a cron schedule to the pipeline

**Answer:** A

**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

A GitHub Actions workflow deploys to Azure. Security policy forbids storing long-lived client secrets in GitHub. What should you configure?

- A. A self-hosted runner on an Azure VM with a system-assigned identity granted Owner on the subscription
- B. A service principal client secret stored as an organization secret that is rotated every 30 days
- C. A fine-grained personal access token scoped to the repository and stored as a production environment secret
- D. A federated credential on a Microsoft Entra app for the repo and environment, used by azure/login with OIDC

**Answer:** D

**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

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?

- A. Application Insights with the classic instrumentation key on each VM
- B. VM Insights with the Azure Monitor Agent and a data collection rule
- C. Boot diagnostics and the serial console on each VM in the fleet
- D. Container Insights for the VMs with the Log Analytics agent extension

**Answer:** B

**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.

Ready for a timed run? Take the free 15-question AZ-400 mini exam: https://devopscodelab.com/app/exams/microsoft-az-400/mini/

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