0
0
Terraformcloud~20 mins

Azure provider setup in Terraform - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Azure Provider Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Configuration
intermediate
2:00remaining
Identify the correct Azure provider block for Terraform
Which Terraform configuration block correctly sets up the Azure provider with a specified subscription ID and tenant ID?
A
provider "azurerm" {
  features {}
  subscription = "12345678-1234-1234-1234-123456789abc"
  tenant       = "87654321-4321-4321-4321-cba987654321"
}
B
provider "azure" {
  subscription = "12345678-1234-1234-1234-123456789abc"
  tenant       = "87654321-4321-4321-4321-cba987654321"
}
C
provider "azurerm" {
  subscription = "12345678-1234-1234-1234-123456789abc"
  tenant       = "87654321-4321-4321-4321-cba987654321"
}
D
provider "azurerm" {
  features {}
  subscription_id = "12345678-1234-1234-1234-123456789abc"
  tenant_id       = "87654321-4321-4321-4321-cba987654321"
}
Attempts:
2 left
💡 Hint
The official Azure provider for Terraform is named 'azurerm' and requires a 'features' block.
service_behavior
intermediate
2:00remaining
What happens if 'features' block is missing in Azure provider?
In Terraform, what is the result of configuring the Azure provider without including the 'features' block?
ATerraform throws a configuration error and refuses to initialize the provider.
BTerraform initializes the provider successfully but disables all resource features.
CTerraform initializes the provider successfully with default features enabled.
DTerraform ignores the provider configuration and uses environment variables instead.
Attempts:
2 left
💡 Hint
The 'features' block is mandatory even if empty for the Azure provider.
security
advanced
2:30remaining
Securely authenticating Terraform Azure provider with Service Principal
Which Terraform provider configuration securely authenticates to Azure using a Service Principal with client ID, client secret, tenant ID, and subscription ID?
A
provider "azurerm" {
  features {}
  client_id       = var.client_id
  client_password = var.client_secret
  tenant_id       = var.tenant_id
  subscription_id = var.subscription_id
}
B
provider "azurerm" {
  features {}
  client_id       = var.client_id
  client_secret   = var.client_secret
  tenant_id       = var.tenant_id
  subscription_id = var.subscription_id
}
C
provider "azurerm" {
  features {}
  client = var.client_id
  secret = var.client_secret
  tenant = var.tenant_id
  subscription = var.subscription_id
}
D
provider "azurerm" {
  features {}
  client_id       = var.client_id
  client_secret   = var.client_secret
  tenant          = var.tenant_id
  subscription    = var.subscription_id
}
Attempts:
2 left
💡 Hint
Use exact attribute names: client_id, client_secret, tenant_id, subscription_id.
Architecture
advanced
2:30remaining
Choosing the best Terraform backend for Azure state storage
Which Terraform backend configuration correctly sets up remote state storage in Azure Blob Storage with container 'tfstate' and storage account 'mystorageacct'?
A
terraform {
  backend "azureblob" {
    resource_group  = "myResourceGroup"
    storage_account = "mystorageacct"
    container      = "tfstate"
    key            = "terraform.tfstate"
  }
}
B
terraform {
  backend "azurerm" {
    resource_group_name  = "myResourceGroup"
    storage_account_name = "mystorageacct"
    container_name       = "tfstate"
  }
}
C
terraform {
  backend "azurerm" {
    resource_group_name  = "myResourceGroup"
    storage_account_name = "mystorageacct"
    container_name       = "tfstate"
    key                  = "terraform.tfstate"
  }
}
D
terraform {
  backend "azurerm" {
    resource_group_name  = "myResourceGroup"
    storage_account_name = "mystorageacct"
    container_name       = "tfstate"
    key                  = "state.tf"
  }
}
Attempts:
2 left
💡 Hint
The backend type is 'azurerm' and the key must match the state file name.
🧠 Conceptual
expert
3:00remaining
Understanding Azure Provider Authentication Methods in Terraform
Which authentication method will Terraform use for the Azure provider if no explicit credentials are set in the provider block and environment variables are not defined?
ATerraform will authenticate using the Azure CLI logged-in user context.
BTerraform will fail to authenticate and throw an error immediately.
CTerraform will use Managed Identity if running on an Azure VM with one assigned.
DTerraform will fallback to anonymous access with limited permissions.
Attempts:
2 left
💡 Hint
Terraform can use Azure CLI credentials if no other credentials are provided.