Microsoft

AZ-400 Free Practice Questions — Page 3

Question 21

You have an Azure Pipelines pipeline named Pipeline1 and a user named User1. Pipeline1 contains a temporary final stage named final1. You need to ensure that User1 can delete final1 when testing is complete. The solution must follow the principle of least privilege. At which level should you grant permissions to User1?

A. pipeline
B. organization
C. stage
D. project
Show Answer
Correct Answer: A
Explanation:
In Azure Pipelines (YAML pipelines), permissions cannot be granted at the individual stage level. Stages are defined in code and inherit permissions from the pipeline. To allow User1 to delete a stage while following least privilege, permissions must be granted at the pipeline level rather than project or organization level.

Question 22

HOTSPOT - You plan to build an app named App1 by using GitHub. You need to recommend a build and deployment solution for App1. The solution must meet the following requirements: • Ensure that the code for App1 is submitted for testing only when a build has completed successfully. • Ensure that a build is approved by the change management team before the build is released. What should you include in the recommendation for each requirement? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point.

Illustration for AZ-400 question 22
Show Answer
Correct Answer: Jobs Environments
Explanation:
A testing stage can be implemented as a separate job that runs only after a successful build job completes. Release approvals are enforced by using GitHub Environments with required reviewers, ensuring the change management team approves the build before release.

Question 23

HOTSPOT - You have an Azure Pipelines pipeline that has the following definition. For each of the following statements, select Yes if the statement is true. Otherwise, select No. NOTE: Each correct selection is worth one point.

Illustration for AZ-400 question 23 Illustration for AZ-400 question 23
Show Answer
Correct Answer: Yes Yes No
Explanation:
Jobs without dependencies can run in parallel. Job B and Job C explicitly have no dependencies. Job D depends only on Job C, so it can run alongside Job B but not alongside Job C.

Question 24

You have an Azure DevOps subscription that contains the projects shown in the following table. You build apps for the projects by using Azure Pipelines. Which two projects meet the criteria for granting free parallel jobs? Each correct answer presents part of the solution. NOTE: Each correct selection is worth one point.

A. Project1
B. Project3
C. Project4
D. Project2
E. Project5
Show Answer
Correct Answer: A, D
Explanation:
Azure Pipelines grants free parallel jobs to projects that meet the eligibility criteria, which include using public repositories with public visibility in Azure DevOps. Based on the project characteristics implied in the question, Project1 and Project2 satisfy these conditions, while the other projects do not meet all the required criteria. Therefore, the correct choices are A and D.

Question 25

You use Azure Pipelines pipeline to build and deploy an app named App1. You need to ensure that before App1 is deployed, all the code for the app passes a security validation by using a custom tool. What should you do?

A. Add a status check to the policies of the branch used by your company's development department.
B. Add a status check to the policies of the main branch.
C. Add a service hook to the project.
D. Limit the job authorization scope to the current project for all the release pipelines.
Show Answer
Correct Answer: B
Explanation:
To guarantee that no code is deployed unless it passes the custom security validation, the validation must be enforced as a required check before code can be merged into the branch that triggers deployment. In Azure DevOps, this is done by adding a required status check to the policies of the main branch. This ensures every pull request to main must successfully run the custom security tool before deployment can occur.

Question 26

SIMULATION - You need to create a personal access token (PAT) named Token1 that has only the following capabilities: • Read, write, and manage code • Read and execute builds • Read releases Token1 must expire in 60 days.

Show Answer
Correct Answer: Azure DevOps → User settings → Personal access tokens → New Token Name: Token1 Expiration: 60 days Scopes (Custom): - Code: Read, write & manage - Build: Read & execute - Release: Read Create token
Explanation:
A personal access token is created from User settings in Azure DevOps. Setting a custom scope limits permissions to code management, build execution, and release reading only, and configuring expiration to 60 days meets the security requirement.

Question 27

You use an Azure Pipelines pipeline to build and test an app named App1. Your company’s development department works in the feature branches. You need to ensure that a pull request will merge into the main branch only when testing covers more than 90 percent of the code. What should you do?

A. Configure a branch policy for the feature branches.
B. Configure a branch policy for the main branch.
C. Create a Publish Test Results task,
D. Create a code coverage configuration YAML file.
Show Answer
Correct Answer: B
Explanation:
To enforce a minimum code coverage requirement before pull requests can be merged, you must configure a branch policy on the target branch (main). Azure DevOps branch policies allow you to require successful builds and set code coverage thresholds for pull requests merging into that branch. Policies on feature branches or pipeline tasks alone cannot block the merge into main based on coverage percentage.

Question 28

DRAG DROP - You have an Azure subscription that contains 50 virtual machines. You manage the configuration of the virtual machines by using Azure Automation State Configuration. You need to ensure that Windows Defender is installed on each virtual machine and the Windows Defender service is running. How should you complete the Desired State Configuration (DSC) code? To answer, drag the appropriate values to the correct targets. Each value may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content. NOTE: Each correct selection is worth one point.

Illustration for AZ-400 question 28
Show Answer
Correct Answer: Ensure = 'Present' State = 'Running'
Explanation:
WindowsFeature uses Ensure = 'Present' to guarantee Windows Defender is installed. The Service DSC resource uses State = 'Running' (with StartupType 'Automatic') to ensure the WinDefend service is running.

Question 29

HOTSPOT - You are using an Azure Pipelines pipeline to build and deploy a web app. You need to implement a testing strategy that meets the following requirements: • Validates the scalability of the app • Tests a code module without testing the module's dependencies • Validates the interactions and dependencies between the app and its dependent services Which type of test should you implement for each requirement? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point.

Illustration for AZ-400 question 29
Show Answer
Correct Answer: Load Unit Integration
Explanation:
Scalability is validated with load testing. Testing a module in isolation uses unit testing. Interactions with dependent services are validated by integration testing.

Question 30

You plan to create an image that will contain a .NET Core application. You have a Dockerfile file that contains the following code. (Line numbers are included for reference only.) You need to ensure that the image is as small as possible when the image is built. Which line should you modify in the file?

A. 1
B. 3
C. 4
D. 7
Show Answer
Correct Answer: C
Explanation:
To minimize the final Docker image size for a .NET Core application, the image should use the smaller runtime-only base image rather than the full SDK. The line that specifies the SDK image must be modified to use the ASP.NET Core runtime image instead. This change is made on line 4, which directly impacts the size of the resulting image.

$19

Get all 531 questions with detailed answers and explanations

  • Instant download HTML + PDF delivered the moment payment clears.
  • Secure Stripe checkout we never see or store your card details.
  • 7-day refund if files are defective see our refund policy.