LevelUpWith

Explore / Microsoft Azure DevOps Engineer Expert (AZ-400) Exam Prep / Practice questions

Microsoft Azure DevOps Engineer Expert (AZ-400) practice questions

10 questions from the bank behind this course's timed mock. Free to read and to answer, no account needed, and each has its answer and an explanation. They belong to Microsoft Azure DevOps Engineer Expert (AZ-400) Exam Prep.

Answer them one at a time →Read lesson 1 free

  1. Question 1

    Marco is a DevOps engineer at a consultancy that pays for his AZ-400 exam. He expects to change employers within the next year and wants to keep his exam and certification history afterwards. Which Microsoft account should he use to book the exam?

    1. His personal Microsoft account, because records tied to a work or school account are lost if he leaves that organization
    2. His work account now, then sign in with a personal account when he renews the certification
    3. A new account created in the consultancy's Microsoft Entra ID tenant just for certifications
    4. His work account, because the employer is paying and the voucher is tied to the organization
    Show the answer

    Answer: A. His personal Microsoft account, because records tied to a work or school account are lost if he leaves that organization

    Microsoft warns that exam records tied to a work or school account are lost if you leave that organization, so a personal account keeps Marco's history. Switching to a personal account at renewal time doesn't help, because the original records are already tied to the work account.

  2. Question 2

    Your team has used system flaky test detection in Azure Pipelines for six months, and the VSTest reruns have built up a flakiness history. A platform engineer now wants to switch to custom detection, so that an in-house tool marks tests as flaky through the Result Meta Data REST API. Before you approve the change, what is the most important consequence to tell the team?

    1. All flakiness history stored in Azure DevOps is erased when you switch between system and custom detection.
    2. Existing flaky marks stay in place, but tests can no longer be left out of the pass percentage.
    3. The VSTest task must be removed from every pipeline before custom detection can be turned on.
    4. System and custom detection both run side by side, so each test gets two flaky flags until the old data expires after 14 days.
    Show the answer

    Answer: A. All flakiness history stored in Azure DevOps is erased when you switch between system and custom detection.

    Switching between system and custom detection erases all flakiness history stored in Azure DevOps, so you should choose one approach and keep it. The option about leaving flaky tests out of the pass percentage is wrong because that is a separate flaky test option, and it still works with either detection method.

  3. Question 3

    You are a DevOps engineer for a design agency that uses Azure Repos. Its main repository already has hundreds of committed .psd files in its history. Branch policies on main block force pushes, and the release manager won't allow history to be rewritten this quarter. You want the current .psd files to be stored through Git LFS from now on. What should you do?

    1. Run git lfs migrate import --everything --include="*.psd", then run git push --force --all
    2. Run git lfs migrate import --no-rewrite with the .psd paths, which converts the current files to LFS pointers in a new commit and leaves the old blobs in history
    3. Run git lfs migrate info --everything, because it moves the largest file types into LFS storage
    4. Run git lfs track "*.psd" and commit .gitattributes, because this converts the .psd blobs already in history to pointers
    Show the answer

    Answer: B. Run git lfs migrate import --no-rewrite with the .psd paths, which converts the current files to LFS pointers in a new commit and leaves the old blobs in history

    --no-rewrite converts the current files in a new commit without changing existing commit SHAs, so it meets the no-force-push constraint. The cost is that the old blobs stay in history. migrate import --everything would fix the history too, but it rewrites history and needs the force push that is ruled out here.

  4. Question 4

    You maintain an internal NuGet library, Contoso.Payments, currently at version 3.5.2. In the next release you add a new method, ProcessAsync, and mark the existing Process method with [Obsolete]. Process still compiles and works as before for all callers. Under SemVer 2.0.0, what should the next stable version be?

    1. 3.5.3
    2. 4.0.0
    3. 3.6.0-obsolete.1
    4. 3.6.0
    Show the answer

    Answer: D. 3.6.0

    Adding a method and deprecating another without breaking any caller is a backward-compatible feature change, so MINOR goes up and PATCH resets to 0, giving 3.6.0. 4.0.0 would be right only once Process is actually removed or changed in a way that breaks callers. Marking it obsolete breaks nothing yet.

  5. Question 5

    You manage a multistage YAML pipeline in Azure Pipelines with Build, Test, Staging and Production stages. The Test stage runs unit tests with coverlet and publishes the Cobertura output with PublishCodeCoverageResults@2. Release managers want to look at the Code Coverage tab before the Production stage starts, but the tab stays empty until the whole run has finished. What should you do?

    1. Switch to PublishCodeCoverageResults@1 and set reportDirectory, so the HTML report is generated while the stage runs
    2. Set failIfCoverageEmpty: true so the coverage report is published as soon as the Test stage completes
    3. Move the build and test work into its own pipeline, so its coverage results are available before a separate deployment pipeline reaches Production
    4. Move the PublishCodeCoverageResults@2 task into a classic release pipeline that runs before Production
    Show the answer

    Answer: C. Move the build and test work into its own pipeline, so its coverage results are available before a separate deployment pipeline reaches Production

    In a multistage YAML pipeline, coverage results appear only after the whole pipeline finishes, so putting the build in its own pipeline lets people review coverage before Production runs. A classic release pipeline won't work because the task runs only in build pipelines, and v1 doesn't change when results appear. v1 is also due to be deprecated.

  6. Question 6

    Fabrikam deploys from a YAML pipeline to an on-premises network appliance in its data centre. The appliance accepts configuration over its management API but cannot install or run an Azure Pipelines agent. Security policy forbids inbound connections from the internet into the data centre. What should the DevOps engineer do?

    1. Add the appliance to a Classic deployment group and call it from the YAML pipeline
    2. Install a self-hosted agent in an agent pool on a jump box inside the data centre that can reach the appliance, and target it with pool: name in the deployment job
    3. Run the deployment job on a Microsoft-hosted agent and add a firewall rule allowing the Azure DevOps IP ranges to reach the appliance
    4. Register the appliance as a Virtual machine resource in an environment and target it with resourceType: virtualMachine
    Show the answer

    Answer: B. Install a self-hosted agent in an agent pool on a jump box inside the data centre that can reach the appliance, and target it with pool: name in the deployment job

    The agent on the jump box only connects outbound to Azure DevOps and can reach the appliance from inside the network, so no inbound ports are needed. Environment VM resources and deployment groups both install an agent on the target itself, which this appliance can't run, and deployment groups don't work with YAML pipelines anyway.

  7. Question 7

    You are a release engineer for an e-commerce site that runs on Azure App Service (Premium v3). An hour after a staging-to-production slot swap, monitoring shows a sharp rise in checkout errors. The previous build is still in the staging slot. Management wants the last known good version back in production as fast as possible, with no downtime. What should you do?

    1. Swap the staging and production slots again
    2. Queue the previous release in Azure Pipelines and redeploy its artifact directly to the production slot
    3. Run kubectl rollout undo against the web app's deployment
    4. Restore the production slot from the most recent App Service backup
    Show the answer

    Answer: A. Swap the staging and production slots again

    After a swap, the old production build sits warmed up in the staging slot, so swapping the same two slots again brings it back fastest and without downtime. Redeploying the old artifact straight to production does work, but it is slower and restarts the live slot, so users would see errors while it starts.

  8. Question 8

    A DevOps engineer adds a scheduled Azure Pipelines job that runs `ansible-playbook -i inventory ansible/web.yml --check --diff` every night against the web servers. One week later, an audit finds that the TLS config on web02 was changed by hand days ago. The pipeline log shows `web02 : ok=3 changed=1 unreachable=0 failed=0`, but every nightly run finished green. What should the engineer do so that drift makes the run fail?

    1. Parse the playbook output and fail the step explicitly when the recap shows changed=1 or more, because --check exits 0 even when it finds drift
    2. Replace --diff with --check-only so Ansible returns an error code whenever a task would report changed
    3. Set always: true on the schedule so the pipeline evaluates the result even when nothing was committed
    4. Remove --check so the playbook applies changes; Ansible then returns a non-zero exit code whenever it changes something
    Show the answer

    Answer: A. Parse the playbook output and fail the step explicitly when the recap shows changed=1 or more, because --check exits 0 even when it finds drift

    A --check dry run exits 0 even when tasks would report changed, so the pipeline has to look for changed=[1-9] itself and fail the step, for example with a ##vso logissue error and exit 1. always: true only makes the scheduled run happen when there are no new commits. It does nothing to the exit code, and removing --check would make Ansible change servers outside a reviewed fix.

  9. Question 9

    Your company runs its release pipelines on a build server in its own on-premises datacenter. The pipelines deploy to an Azure resource group. The security team wants to stop using a client secret, and the identity must have only the access it needs. Which identity should the pipelines use?

    1. The managed identity of an Azure VM in the same subscription, used by the on-premises server through a service connection
    2. A user-assigned managed identity created in Azure and assigned to the on-premises build server
    3. A system-assigned managed identity enabled on the on-premises build server
    4. A service principal that authenticates with a certificate and has a narrowly scoped role assignment
    Show the answer

    Answer: D. A service principal that authenticates with a certificate and has a narrowly scoped role assignment

    Managed identities only work for code running on Azure compute, so code on an on-premises server has to use a service principal, and a certificate is stronger than a secret. A user-assigned identity is a separate resource, but it can still only be assigned to Azure resources, never to an on-premises machine.

  10. Question 10

    A platform engineer at Contoso turns on Secret Protection, including push protection, for an existing repository. During an audit, the team learns that a storage account key was committed 18 months ago and is still in the Git history. The security lead wants the exposure fully dealt with. Which TWO actions should the engineer take? (Select TWO.)

    More than one answer is right.

    1. Rotate the exposed storage account key: revoke it and issue a new one
    2. Rewrite the Git history to remove the key and close the incident, because the secret is then gone
    3. Use repository secret scanning alerts to find secrets that are already in the commit history
    4. Add the dependency review action to pull requests so that it flags the committed key
    5. Do nothing, because push protection will scan the existing history on the next push
    Show the answer

    Answers: A. Rotate the exposed storage account key: revoke it and issue a new one; C. Use repository secret scanning alerts to find secrets that are already in the commit history

    Push protection only checks pushes made after it is enabled, so repository secret scanning is what finds old secrets, and any leaked secret has to be rotated. Rewriting history alone isn't enough, because the key may already have been copied or cloned and still works until it is revoked.

The full timed mock

50 questions in 100 minutes, with a pass mark of 70%. Each paper is drawn from a bank of questions written for the mock alone, and these 10 are left out of it. Full access opens it, with every level of the course.

See the course →See the plans

LevelUpWith is independent of the organisation that sets this exam. These questions were written for this course; they are not taken from the exam.