Courseiva
Design and implement build and release pipelinesmediumMultiple ChoiceObjective-mapped

AZ-400 Practice Question: Design and implement build and release pipelines

Network Topology
resource-group rg-contosoname app-contososettings DEPLOYMENT_SLOT=productionRefer to the exhibit.```yaml# Azure CLI scriptecho "Setting environment variables"pipeline:- job: Deploypool:vmImage: 'ubuntu-latest'steps:```

Refer to the exhibit. The pipeline YAML includes an Azure CLI script that sets an app setting on a Web App. The pipeline fails with an authentication error. What is the most likely cause?

⚠ Common exam trap

The trap here is that candidates may focus on the script content or resource details (like the slot name or resource group) instead of recognizing that the fundamental authentication mechanism for Azure CLI in a pipeline is the service connection, not the script itself.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

The pipeline does not have an Azure service connection configured for authentication.

The Azure CLI script in the pipeline attempts to run `az webapp config appsettings set`, which requires authentication to Azure. Without an Azure service connection configured in the pipeline, there is no authenticated session or service principal to authorize the command, resulting in an authentication error. The service connection provides the necessary credentials (e.g., via Azure AD) for the pipeline to interact with Azure resources.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • The resource group name is incorrect.

    Why it's wrong here

    The resource group name is not the cause of the failure; it is correctly spelled and matches the resource group referenced elsewhere in the pipeline. An incorrect resource group would generate a different error during deployment, not an authentication failure.

  • The pipeline does not have an Azure service connection configured for authentication.

    Why this is correct

    The Azure CLI task (AzureCLI@2) requires an Azure service connection to authenticate to Azure. Without a service connection defined in the pipeline's inputs (e.g., azureSubscription), the task cannot obtain credentials, causing an authentication error before any script executes.

  • The DEPLOYMENT_SLOT setting name is invalid.

    Why it's wrong here

    DEPLOYMENT_SLOT is a valid variable name and aligns with standard Azure App Service deployment slot naming conventions. The pipeline fails due to missing authentication, not due to an invalid setting name, as the setting would be evaluated later in the execution.

  • The script syntax is invalid.

    Why it's wrong here

    The script syntax is invalid. This is not the cause of the failure because the AzureCLI@2 task authenticates to Azure before executing any script content. If the service connection is missing or misconfigured, the task fails during the authentication phase, so the script is never parsed or run. Even if the script had a syntax error, it would produce a different, script-specific error message (e.g., from the shell or Azure CLI), not an authentication-related failure. Therefore, the syntax cannot be responsible for the pipeline error shown in the exhibit.

About these practice questions

Courseiva writes every AZ-400 question from scratch — 823 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AZ-400 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-400 exam.