Lesson 2 of 6 Infrastructure as Code

Recommending a Configuration Management Technology

This lesson separates provisioning from configuration, and compares the main tools.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish provisioning from configuration management.
  • Describe the main guest configuration tools.
  • Choose an application configuration store.
  • Recommend a technology from requirements.

Two separate problems

Exam scenarios often test whether a candidate can separate two layers. Provisioning creates Azure resources, such as a virtual machine or database, and it is the job of Bicep and Terraform. Configuration management controls what is inside a resource, such as installed packages, files, services, registry keys and security settings, and it continues after creation to keep that state correct.

A third category sits alongside these: application configuration, which holds the settings that an application reads, such as a feature flag or a service URL. These different layers need different tools.

Sort into groups

Which layer is it?

Exam skills 3.5.1

Separate provisioning, guest configuration and application configuration.

Log in to try this activity Interactive activities are free with an account.

Tools for guest configuration

Azure Machine Configuration

Azure Machine Configuration is a capability of Azure Policy that audits or configures operating system settings on Azure and Arc-enabled machines, using PowerShell Desired State Configuration content. It needs no pull server, and compliance appears with other Azure Policy results. It suits organizations that want machine compliance managed through Azure.

Ansible

Ansible uses YAML playbooks, and it connects to machines over SSH or WinRM, with no agent on the target. It is commonly chosen for Linux estates, and is simple to start with. A pipeline can run a playbook, as it is a push model.

Chef and Puppet

Chef and Puppet use agents on managed machines, which pull configuration from a server and correct drift regularly. They suit organizations with established investments in those products.

Custom Script and VM extensions

The Custom Script Extension and cloud-init run commands at first boot or on request. They are suited to simple start-up tasks, but they do not detect or correct drift afterwards.

Match the pairs

Guest configuration tools

Exam skills 3.5.1

Match each configuration tool with its defining trait.

Log in to try this activity Interactive activities are free with an account.

Tools for application configuration

Azure App Configuration centrally stores application settings and feature flags, and Azure Key Vault stores secrets, keys and certificates. App Service application settings suit values that belong to one app. Kubernetes uses ConfigMaps and Secrets, and the Azure App Configuration provider for Kubernetes can populate them from a store.

Making a recommendation

The following table links requirements to technology.

RequirementRecommended technology
Create Azure resources declarativelyBicep or Terraform
Audit and correct OS settings on Azure and Arc machinesAzure Machine Configuration
Configure Linux machines with no agent, using existing playbooksAnsible
Run a script once at first bootcloud-init or Custom Script Extension
Share application settings and feature flagsAzure App Configuration
Store secretsAzure Key Vault
Keep clusters in line with GitGitOps with Flux

Team skills count too. An organization with years of Ansible playbooks should not discard them without a reason, and Ansible modules exist for Azure. Equally, a small team managing only Azure VMs can avoid operating a separate configuration server by using Machine Configuration.

The following diagram shows how an SSH setting is enforced inside 600 Linux servers, both in Azure and on-premises, and the compliance view.

Enforcing an SSH setting inside 600 Linux servers. Azure Machine Configuration applies the setting through a policy assignment that corrects drift; on-premises servers are onboarded with Azure Arc; and results appear in one Azure Policy compliance view.
The scenario is illustrative.
Scenario questions

Recommending the technology

Exam skills 3.5.1

Choose the technology for each requirement.

Log in to try this activity Interactive activities are free with an account.
Worked example

Choosing the layer

Compliance requires that the SSH service on 500 Azure virtual machines and 100 on-premises Linux servers disallows root login. Non-compliant machines must be corrected automatically, and results must appear in one compliance view. What should you recommend?

Use Azure Machine Configuration, with the on-premises servers onboarded to Azure Arc. A policy assignment in a mode that corrects drift applies the setting and reports compliance with Azure Policy. Bicep provisions resources, and does not manage settings inside a guest. A Custom Script Extension could change the file once, but it would not detect later drift, and it does not work on on-premises servers without Arc.

Check yourself

A script must run once when a Linux VM first boots, with no drift control. What fits?

Show answer

cloud-init or the Custom Script Extension. Neither corrects later drift, which the scenario does not need.

Exam Tips

Remember for the exam

  • Provisioning creates resources; configuration management works inside them.
  • Machine Configuration covers Azure and Arc-enabled machines through Azure Policy.
  • Ansible is agentless and uses YAML playbooks.
  • Custom Script Extension and cloud-init do not correct later drift.
  • App Configuration holds settings; Key Vault holds secrets.