Microsoft

AZ-400 Free Practice Questions — Page 5

Question 41

You have an app that is deployed to two environments named Production-A and Production-B by using Azure Pipelines. You need to configure a release pipeline that will mark the app as complete and ready for release into the Production-B environment. The solution must meet the following requirements: • Ensure that there are no active Azure Monitor alerts in the Production-A environment before the app is marked as complete. • Minimize administrative effort. What should you do?

A. To the Production-B environment stage, add a pre-deployment gate that will query Azure Monitor.
B. To the Production-A environment stage, add a post-deployment gate that will query Azure Monitor.
C. To the Production-A environment stage, add a post-deployment approval.
D. To the Production-A environment stage, add a pre-deployment gate that will query Azure Monitor.
Show Answer
Correct Answer: B
Explanation:
The requirement is to ensure there are no active Azure Monitor alerts in Production-A before the app is marked as complete and considered ready for release to Production-B. A post-deployment gate on the Production-A stage runs after deployment to Production-A but before that stage is marked as complete. Using an Azure Monitor query in this gate automatically validates that there are no active alerts, meeting the condition with minimal administrative effort. Pre-deployment gates or approvals either run at the wrong time or require more manual intervention.

Question 42

You use an Azure Pipelines pipeline to build and deploy an app. You have a custom test task that has the following inputs: • testResultsFiles: **/TEST-*.trx • searchFolder: $(System.DefaultWorkingDirectory) • mergeTestResults: true Which format should you use for the input data of testResultsFiles?

A. VSTest
B. NUnit
C. CTest
D. JUnit
Show Answer
Correct Answer: A
Explanation:
The testResultsFiles input points to files with the .trx extension (TEST-*.trx). The .trx format is produced and consumed by the Visual Studio Test Platform (VSTest). NUnit, CTest, and JUnit use different result file formats (such as .xml) and do not correspond to .trx files.

Question 43

DRAG DROP - You have a GitHub organization. You are creating a GitHub Actions workflow. You need to perform authenticated API requests by using a GitHub app name App1. Which four actions should you perform in sequence? To answer, move the appropriate actions from the list of actions to the answer area and arrange them in the correct order.

Illustration for AZ-400 question 43
Show Answer
Correct Answer: Register App1 and store the app ID as a GitHub Actions secret. Generate a private key and store the key as a secret. Install App1 in your organization. Generate an installation access token.
Explanation:
A GitHub App must be registered and its credentials stored securely. The private key is used to authenticate the app, the app must be installed on the organization to grant permissions, and an installation access token is then generated to make authenticated API requests in the workflow.

Question 44

DRAG DROP - You have an Azure subscription. You have the standards shown in the following table. You plan to use Azure Pipelines to build and release web apps. You need to recommend a solution to build the pipelines. The solution must meet the following requirements: • Ensure that all new pipelines meet the security requirements defined in Standard1. • Ensure that the first stage of all new pipelines contains the software prerequisites defined in Standard2. • Minimize administrative effort. What should you use to implement each standard? To answer, drag the appropriate options to the correct standards. Each component 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 44 Illustration for AZ-400 question 44
Show Answer
Correct Answer: Standard1: An extends template Standard2: An includes template
Explanation:
Extends templates enforce organization-wide rules by requiring all pipelines to inherit a secured base definition, ensuring security standards are always applied. Includes templates let you reuse predefined stages or jobs, making it easy to add a standard first stage with required software prerequisites while minimizing administration.

Question 45

You have an Azure Resource Manager (ARM) template that contains the following expression. [if(parameters('isComplete'), '1a', '2a')] You need to migrate the template to Bicep. Which expression should you run?

A. iif(isComplete, '1a', '2a')
B. if(isComplete, '1a', '2a')
C. if('isComplete') '1a' else '2a'
D. isComplete ? '1a' '2a'
Show Answer
Correct Answer: D
Explanation:
When migrating from an ARM template to Bicep, conditional expressions are written using the ternary conditional operator, not the ARM if() function. In Bicep, the correct equivalent is `isComplete ? '1a' : '2a'`. Option D represents this syntax (the colon is implied/missing due to formatting), making it the correct choice.

Question 46

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 46 Illustration for AZ-400 question 46
Show Answer
Correct Answer: Job E can start before job C completes: No Job B can run concurrently with job C: Yes Job D can start before job B completes: No
Explanation:
A has no dependencies. B and C both depend on A, so they can run in parallel. D depends on both B and C, so it starts only after both finish. E depends on B and D, so it cannot start before C (via D) completes.

Question 47

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

Illustration for AZ-400 question 47 Illustration for AZ-400 question 47
Show Answer
Correct Answer: Pipeline1 consists of three stages: No $(BuildPlatform) is a predefined variable: No $(System.DefaultWorkingDirectory) is a predefined variable: Yes
Explanation:
The YAML defines a single implicit stage containing three tasks, not three stages. $(BuildPlatform) is not a built-in variable and must be defined by the user or parameters. $(System.DefaultWorkingDirectory) is a standard predefined Azure Pipelines variable pointing to the agent’s working directory.

Question 48

You manage a project by using Azure Boards. You manage the project code by using GitHub. You have three work items that have IDs of 456, 457, and 458. You need to create a pull request that will be linked to all the work items. The solution must set the state of work item 456 to done. What should you add to the commit message?

A. Done #456, #457, #458
B. Fixes #456, #457, #458
C. Fixes #AB456, #A8457, #A8458
D. #AB456, #AB457, #AB458 Completed #AB456
Show Answer
Correct Answer: C
Explanation:
To link GitHub commits or pull requests to Azure Boards work items and automatically transition a work item to Done, you must use the Azure Boards–specific syntax `AB#<ID>` together with a supported closing keyword such as `Fixes`. Option C is the only choice that uses the required `Fixes` keyword and the `AB` prefix to link the pull request to all three work items and set work item 456 to Done. The other options either lack the `AB` prefix or use unsupported keywords, so they would not update the work item state.

Question 49

HOTSPOT - You have an Azure subscription that contains a user named User1. You have an Azure Resource Manager (ARM) template named Template1. You plan to perform the following actions: • Deploy an Azure key vault named KV1. • Deploy Azure resources by using Template1 to retrieve secrets from KV1. You need to ensure that User1 can deploy Template1. The solution must follow the principle of least privilege. Which permission should you grant to User1, and which parameter should be specified when you create KV1? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point.

Illustration for AZ-400 question 49
Show Answer
Correct Answer: Permission: Microsoft.KeyVault/vaults/deploy/action Parameter: --enabled-for-template-deployment
Explanation:
ARM template deployments that reference Key Vault secrets require the vault to allow template deployment and the deploying user to have the deploy action on the vault. This grants only the minimum access needed for secret retrieval during deployment.

Question 50

You have an Azure subscription. You use Bicep templates to deploy websites and Azure SQL infrastructure. You need to automate the deployments by using Azure Pipelines and a self-hosted agent that runs on two virtual machines. The solution must minimize administrative effort. What should you do first?

A. Create a service principal.
B. Create an Azure Automation account.
C. Create a user-assigned managed identity.
D. On each virtual machine, enable a system-assigned managed identity.
Show Answer
Correct Answer: A
Explanation:
Azure Pipelines needs an identity to authenticate to Azure before it can deploy Bicep templates. The first required step is to create an Azure service principal and use it in an Azure service connection. This works regardless of where the self-hosted agents run and requires less ongoing administration than managing managed identities on multiple VMs. Automation accounts are unrelated to pipeline-based deployments.

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