Courseiva

AZ-204 Practice Question: Connect to and consume Azure services and third-party services

Exhibit

Refer to the exhibit.

```json
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "resources": [
    {
      "type": "Microsoft.Web/sites",
      "apiVersion": "2021-03-01",
      "name": "[parameters('webAppName')]",
      "location": "[resourceGroup().location]",
      "properties": {
        "siteConfig": {
          "appSettings": [
            {
              "name": "CosmosDbConnectionString",
              "value": "[listKeys(resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('cosmosAccountName')), '2021-04-15').primaryMasterKey]"
            }
          ]
        }
      }
    }
  ]
}
```

Refer to the exhibit. A developer deploys this ARM template to create a web app with a connection string to Azure Cosmos DB. The deployment succeeds but the web app cannot connect to Cosmos DB. What is the most likely cause?

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 connection string should use a secret reference to Azure Key Vault

The ARM template exposes the Cosmos DB connection string with the master key in plaintext, which is insecure. The connection string should be stored as a secret in Azure Key Vault and referenced using a secret reference in the ARM template. Option B is incorrect because the listKeys function is used correctly to retrieve the keys. Option C is incorrect because the web app name parameter is present and used. Option D is incorrect because the API version is appropriate for the deployment.

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 connection string should use a secret reference to Azure Key Vault

    Why this is correct

    Best practice is to use Key Vault references, but the immediate issue is that the connection string is incomplete; it needs the full connection string format.

  • The listKeys function is used incorrectly

    Why it's wrong here

    listKeys is used correctly.

  • The web app name parameter is missing

    Why it's wrong here

    Parameter is provided.

  • The listKeys function requires a different API version

    Why it's wrong here

    API version is fine.

About these practice questions

One of 881 original AZ-204 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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-204 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-204 exam.