0
0
Azurecloud~20 mins

Bicep syntax and modules in Azure - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Bicep Module Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Bicep Module Outputs

You have a Bicep module that deploys a storage account and outputs its resource ID. What will be the value of storageAccountId after deployment?

module storageModule './storage.bicep' = {
  name: 'storageDeploy'
  params: {
    storageName: 'mystorage123'
  }
}

var storageAccountId = storageModule.outputs.storageAccountId
A/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/mystorage123
Bmystorage123
Coutputs.storageAccountId
DUndefined variable error
Attempts:
2 left
💡 Hint

Module outputs are accessed using moduleName.outputs.outputName and usually contain full resource IDs if defined that way.

Configuration
intermediate
2:00remaining
Correct Bicep Module Declaration Syntax

Which of the following Bicep module declarations is syntactically correct to deploy a module named network.bicep with a parameter vnetName set to myVnet?

A
module networkModule './network.bicep' {
  name: 'netDeploy'
  params: {
    vnetName: 'myVnet'
  }
}
B
module networkModule './network.bicep' = {
  vnetName: 'myVnet'
}
C
module networkModule = './network.bicep' {
  name: 'netDeploy'
  params: {
    vnetName: 'myVnet'
  }
}
D
module networkModule './network.bicep' = {
  name: 'netDeploy'
  params: {
    vnetName: 'myVnet'
  }
}
Attempts:
2 left
💡 Hint

Remember the module declaration syntax requires the module keyword, a symbolic name, the path in quotes, an equals sign, and a block with name and params.

Architecture
advanced
2:00remaining
Best Practice for Reusing Bicep Modules Across Environments

You want to deploy the same Bicep module for multiple environments (dev, test, prod) with different parameters. Which approach ensures clean, maintainable code?

AManually edit the module file parameters before each deployment to match the environment.
BCreate separate copies of the module file for each environment with hardcoded parameters.
CUse a single module file and pass environment-specific parameters from a main Bicep file for each deployment.
DDeploy the module only once and manually change resource properties in Azure portal for each environment.
Attempts:
2 left
💡 Hint

Think about how to avoid duplication and manual changes while keeping deployments consistent.

security
advanced
2:00remaining
Handling Secrets in Bicep Modules Securely

You need to pass a database password to a Bicep module. Which method is the most secure to handle this secret?

AUse Azure Key Vault references in the Bicep module to retrieve the password at deployment time.
BPass the password as a plain text parameter from the main Bicep file.
CHardcode the password directly in the Bicep module parameters.
DStore the password in a public GitHub repository and reference it in the module.
Attempts:
2 left
💡 Hint

Consider how to avoid exposing secrets in code or parameters.

service_behavior
expert
2:00remaining
Effect of Module Scope on Resource Deployment

Consider a Bicep module declared with scope set to a subscription level. What is the effect on resources declared inside this module?

AResources inside the module deploy to a random resource group in the subscription.
BResources inside the module are deployed at the subscription scope, not limited to the resource group of the main deployment.
CThe module deployment fails because scope can only be set at the main Bicep file level.
DResources inside the module ignore the scope and deploy to the resource group of the main Bicep file.
Attempts:
2 left
💡 Hint

Think about how scope changes the deployment target of resources inside modules.