Launch price: every exam for $29.99 a year, for the first 300 buyers. See the price

CertStreak
Menu

Design and implement desired state configuration for environments, including Azure Automation State Configuration, Azure Resource Manager, Bicep, and Azure Machine Configuration

A worked example

Single answer

You are writing a reusable ARM template that deploys a virtual machine to several environments. The template must meet the following requirements:

  • The engineer who runs the deployment can choose the VM size at deployment time.
  • Only Standard_B2s, Standard_D2s_v3 or Standard_D4s_v3 is accepted as the VM size.
  • If the engineer does not specify a size, Standard_B2s is used.
  • The administrator password is masked in deployment logs.

How should you define vmSize and adminPassword in the template?

Choose one answer
Why

Making vmSize a parameter lets the engineer choose the size at deployment time. allowedValues limits the input to the approved sizes, and defaultValue supplies Standard_B2s when no size is given. Defining adminPassword as securestring masks the value in logs, which a plain string parameter does not.

  • Not correct: vmSize: variable set to Standard_B2s; adminPassword: securestring parameter. Variables are values set inside the template. Only parameters can be customised during deployment.
  • Not correct: vmSize: string parameter with defaultValue and allowedValues; adminPassword: string parameter. The string type is for ordinary text. Only securestring (or secureObject) is masked in logs.
  • Correct: vmSize: string parameter with defaultValue and allowedValues; adminPassword: securestring parameter. A parameter can be chosen at deployment, allowedValues restricts it to the three sizes, defaultValue provides Standard_B2s, and securestring masks the password in logs.
  • Not correct: vmSize: string parameter with allowedValues and no defaultValue; adminPassword: securestring parameter. Without a defaultValue, the parameter does not fall back to Standard_B2s when no size is supplied.
  • Not correct: vmSize: string parameter with defaultValue and no allowedValues; adminPassword: securestring parameter. Without allowedValues, the choice is not restricted to the three approved sizes.

Practise this topic until it's automatic.

Ten questions a day, every answer explained, and misses that come back until you beat them.

Start free