AZ-400 · Sample questions
AZ-400 sample questions with answers and explanations
10 real questions from the CertifyDeck AZ-400 bank, spread across the domains of the official Microsoft Certified: DevOps Engineer Expert skills outline, with the correct answer and a full explanation of why the other options are wrong. They are original questions written from the public syllabus, not exam dumps, and they are the same style you will find in the practice tests and mock exams.
- Question 1Domain: Develop a security and compliance planMedium
A GitHub Actions job contains permissions: contents: read and a step that uses azure/login with client-id, tenant-id and subscription-id inputs. The job fails because it can't obtain a token from GitHub's OIDC provider. Which permission should you add to the job?
- A.security-events: write
- B.deployments: write
- C.id-token: write
- D.actions: write
Show answer and explanation
Correct answer: C. id-token: write
Explanation
The job or workflow needs id-token: write so that GitHub's OIDC provider can issue a JSON Web Token that azure/login exchanges for an Azure access token. This permission only allows requesting the OIDC token; it doesn't grant write access to repository resources. Permissions such as actions or deployments control what the GITHUB_TOKEN can do in GitHub and don't enable OIDC token requests.
Official references
- Question 2Domain: Develop a security and compliance planEasy
A team lead in your Azure DevOps organization must be able to create new projects. The team lead must not receive the other organization-wide administrative rights of the Project Collection Administrators group. What should you do?
- A.Assign the Basic + Test Plans access level to the team lead.
- B.Allow the collection-level Create new projects permission for the team lead.
- C.Make the team lead a team administrator of an existing project's default team.
- D.Add the team lead to the Project Administrators group of an existing project.
Show answer and explanation
Correct answer: B. Allow the collection-level Create new projects permission for the team lead.
Explanation
Creating a project requires membership in Project Collection Administrators or the collection-level Create new projects permission set to Allow, so allowing that single permission meets the requirement without the rest of the administrative rights. Project Administrators and team administrators work inside an existing project and cannot create projects. Access levels control which web portal features are available, not the right to create projects.
Official references
- Question 3Domain: Implement an instrumentation strategyMedium
Before you approve a release, you must chart the average free memory of the VM named web01 for each hour of the last 7 days from the Perf table, where the counter is named Available MBytes. Which query should you use?
- A.Perf | where TimeGenerated > ago(7d) | where Computer == "web01" and CounterName == "Available MBytes" | summarize avg(CounterValue) by bin(TimeGenerated, 1h)
- B.Perf | where TimeGenerated > ago(7d) | where Computer == "web01" and CounterName == "Available MBytes" | summarize count() by bin(TimeGenerated, 1h)
- C.Perf | where TimeGenerated > ago(7d) | render timechart | summarize avg(CounterValue) by bin(TimeGenerated, 1h)
- D.Perf | where TimeGenerated > ago(7d) | where Computer == "web01" and CounterName == "Available MBytes" | summarize avg(CounterValue) by TimeGenerated
Show answer and explanation
Correct answer: A. Perf | where TimeGenerated > ago(7d) | where Computer == "web01" and CounterName == "Available MBytes" | summarize avg(CounterValue) by bin(TimeGenerated, 1h)
Explanation
Filtering on the computer and the Available MBytes counter and then summarizing with bin(TimeGenerated, 1h) produces one average per hour. Summarizing directly by TimeGenerated creates a group for practically every unique timestamp, so it does not give hourly values. Using count() returns how many records arrived in each hour instead of the average value, and render must be the last operator in the query.
Official references
- Question 4Domain: Implement an instrumentation strategyMedium
The Users tool in Application Insights reports more users than your sign-in records show, because people use the browser app from several devices and browsers. You need users to be counted by a persistent identity after they sign in. Which code should the browser app call after sign-in?
- A.appInsights.setAuthenticatedUserContext(userId)
- B.enableAutoRouteTracking: true in the SDK configuration so that each route change creates a page view
- C.appInsights.trackEvent({name: "signedIn"}) once per sign-in so that each person is recorded as a custom event
- D.A telemetry initializer that sets the cloud role name to the application name on every item
Show answer and explanation
Correct answer: A. appInsights.setAuthenticatedUserContext(userId)
Explanation
The Users tool counts users by anonymous IDs stored in browser cookies, so one person on several browsers or machines counts more than once; calling setAuthenticatedUserContext() after sign-in sets an authenticated user ID that tracks the user across devices and browsers. A custom event records an action but does not change how users are identified. Automatic route tracking creates page views for single-page app navigation, and the cloud role name identifies application components, not users.
Official references
- Question 5Domain: Design and implement a source control strategyMedium
Your company splits a monolithic repository into smaller repositories. The payments repository must include the shared validation library, which lives in its own repository, as a folder pinned to a specific commit of that library. Which command should you run in the payments repository?
- A.git sparse-checkout set libs/validation
- B.git clone --recurse-submodules <library-url> libs/validation
- C.scalar register libs/validation
- D.git submodule add <library-url> libs/validation
Show answer and explanation
Correct answer: D. git submodule add <library-url> libs/validation
Explanation
git submodule add adds another repository as a submodule at the given path, and the superproject records which commit of that repository it expects, which is exactly a pinned, shared component. git clone --recurse-submodules only initializes submodules that a repository already defines while cloning it; it does not add a new one. sparse-checkout limits which directories of the same repository appear in the working tree, and scalar register only enrolls an existing repository for Scalar maintenance.
Official references
- Question 6Domain: Design and implement a source control strategyMedium
Your company uses GitHub Team. Release tags in a private repository follow the pattern v*. Only members of the release-managers team must be able to delete or rename those tags, and developers must still be able to manage other tags. What should you configure?
- A.A push ruleset that restricts the file paths that can be changed in commits
- B.A CODEOWNERS file that assigns the release-managers team to the repository
- C.A branch protection rule with the name pattern v* and push restrictions
- D.A tag ruleset that targets v* and lets the release-managers team bypass it
Show answer and explanation
Correct answer: D. A tag ruleset that targets v* and lets the release-managers team bypass it
Explanation
Branch and tag rulesets control how people interact with selected branches and tags, including who can delete or rename a tag; you target tags with an fnmatch pattern such as v* and grant bypass permissions to specific teams. A branch protection rule applies to branches, not tags. CODEOWNERS only defines reviewers for pull requests, and push rulesets block pushes based on file paths, extensions or sizes rather than tag names.
Official references
- Question 7Domain: Design and implement build and release pipelinesEasy
You are defining a shift-left test strategy for a team whose test suite takes hours and often fails for reasons unrelated to code changes. You need most quality signals before a change merges into main. What should you recommend?
- A.Move most of the suite to a stage that runs against production
- B.Favor UI tests that exercise complete end-to-end user journeys before each merge
- C.Add test-only hooks in the product so functional tests can reach its internals
- D.Favor unit tests with few external dependencies and run them in the build
Show answer and explanation
Correct answer: D. Favor unit tests with few external dependencies and run them in the build
Explanation
The shift-left guidance is to write tests at the lowest possible level, favoring unit tests with the fewest external dependencies and running most of them as part of the build so testing completes before changes merge. UI tests are discouraged because they tend to be unreliable, which conflicts with the flakiness problem. Running most tests against production moves them later, and functional tests should use only the public API of the product.
Official references
- Question 8Domain: Design and implement build and release pipelinesEasy
You have an Azure Pipelines YAML pipeline that deploys a DACPAC to an Azure SQL database by using a Microsoft-hosted agent: task: SqlAzureDacpacDeployment@1; inputs: deployType: DacpacTask; DeploymentAction: Publish; IpDetectionMethod: AutoDetect. The server firewall must not keep the agent's address after the task completes. Which input should you configure?
- A.DeleteFirewallRule: true
- B.IpDetectionMethod: IPAddressRange
- C.AdditionalArguments: /p:IgnoreComments=True
- D.DeploymentAction: DeployReport
Show answer and explanation
Correct answer: A. DeleteFirewallRule: true
Explanation
DeleteFirewallRule makes the task remove the IP addresses it added to the server's allowed list once the task ends (its default is true, so setting it explicitly guarantees the behaviour). IPAddressRange only changes how the agent's addresses are specified, not whether the rule is removed. DeployReport changes the action to a report, and AdditionalArguments only passes SqlPackage.exe options.
Official references
- Question 9Domain: Design and implement processes and communicationsMedium
A pipeline step builds a changelog from Git history. It must list the abbreviated hash and subject of every commit reachable from HEAD but not from the v2.3.0 tag, excluding merge commits. Which command should the step run?
- A.git log v2.3.0 --no-merges --pretty=format:"%h %an"
- B.git log HEAD..v2.3.0 --no-merges --pretty=format:"%h %s"
- C.git log v2.3.0..HEAD --no-merges --pretty=format:"%h %s"
- D.git log v2.3.0..HEAD --merges --pretty=format:"%h %s"
Show answer and explanation
Correct answer: C. git log v2.3.0..HEAD --no-merges --pretty=format:"%h %s"
Explanation
The range v2.3.0..HEAD selects commits reachable from HEAD but not from the tag, --no-merges drops commits with more than one parent, and %h and %s print the abbreviated hash and the subject. Reversing the range to HEAD..v2.3.0 selects commits reachable from the tag but not from HEAD, which is the opposite set. --merges prints only merge commits, and a single revision v2.3.0 lists the whole history up to the tag with author names instead of subjects.
Official references
- Question 10Domain: Design and implement processes and communicationsEasy
Your team documents a service in a Markdown file stored in a GitHub repository. When the file is viewed on GitHub, it must render a sequence diagram that shows the calls between three components. What should you add to the file?
- A.A fenced code block that uses the mermaid language identifier
- B.A fenced code block that uses the stl language identifier
- C.A fenced code block that uses the topojson language identifier
- D.A fenced code block that uses the geojson language identifier
Show answer and explanation
Correct answer: A. A fenced code block that uses the mermaid language identifier
Explanation
GitHub renders Mermaid syntax placed in a fenced code block with the mermaid identifier, and Mermaid supports flow charts, sequence diagrams and other diagram types. GeoJSON and TopoJSON blocks render interactive maps, not sequence diagrams, and STL blocks render 3D models.
Official references
How to use these AZ-400 sample questions
Answer each question before opening the explanation, and write down why you discarded the other options. On AZ-400, most mistakes come from choosing an option that is technically possible but does not meet every requirement in the scenario.
These 10 questions are a taste of the format, not a diagnostic. To know which domains you fail, practice by domain for free and take a timed mock exam that mirrors the official weights and duration.
Practice AZ-400 with hundreds more questions
Start for free, no sign-up or card. Every question includes an explanation like the ones above, and the mock exam reproduces the official AZ-400 format.