Hands-On LabIntermediate

Deploy Azure SQL Database with Terraform

Define and deploy an Azure SQL Server and database using Terraform with firewall rules, variables, and output values in this hands-on lab.

60 minEstimated time
5Guided steps
AutoVerification
IsolatedSandbox
Deploy Azure SQL Database with Terraform

Lab overview

Azure SQL Database is Microsoft's fully managed relational database service, offering built-in high availability, automated backups, and elastic scaling without the overhead of managing virtual machines or operating system patches. When combined with Terraform, database infrastructure becomes version-controlled, repeatable, and auditable: critical properties for teams managing databases across development, staging, and production environments.

In this lab, you will write Terraform configuration files to provision an Azure SQL Server and database, configure server-level firewall rules for network access control, manage administrator credentials securely using Terraform sensitive variables, and output connection information for downstream application use. You will execute the full Terraform workflow from initialization through apply and verify the deployed resources in the Azure Portal.

Objectives

By completing this intermediate lab, you will be able to:

  • Define an Azure SQL Server and database using Terraform azurerm_mssql_server and azurerm_mssql_database resources
  • Use Terraform variables to manage administrator credentials securely with sensitive input values
  • Configure server-level firewall rules using azurerm_mssql_firewall_rule to control network access
  • Output the SQL Server fully qualified domain name (FQDN) and connection string from Terraform
  • Execute the full Terraform workflow (init, plan, apply) to deploy database infrastructure
  • Verify the deployed SQL Server, database, and firewall rules in the Azure Portal

Who is this lab for?

This lab is designed for:

  • Cloud Engineers who need to provision and manage Azure SQL Databases using Infrastructure as Code
  • DevOps Practitioners looking to automate database deployments as part of their Terraform-managed infrastructure
  • Developers who want to understand how to define Azure database resources declaratively with Terraform

Verified against your live environment

An automated validation engine inspects your actual resources and configurations as you work. Completion means the task was performed — not multiple choice, real-world proficiency.

[CHECK] validation_activelive
Inspecting deployed resources...
Verifying configuration state...
✓ Step requirements satisfied

More labs like this

Related reading

PremiumIncluded in Premium
Duration
60 min
Steps
5

Environment

Browser Code IDELive Cloud Environment

Every lab includes

  • Real environment, pre-credentialed
  • Automated checks on every step
  • Isolated sandbox, auto cleanup
  • AI-recommended next steps

Lab curriculum

  1. 01

    Logging into Azure CLI

  2. 02

    Defining SQL Server and Database with Terraform

    1 automated check

  3. 03

    Configuring Firewall Rules and Terraform Outputs

    1 automated check

  4. 04

    Deploying SQL Database Infrastructure with Terraform

    1 automated check

  5. 05

    Verifying SQL Resources in the Azure Portal

    1 automated check

Skills validated

TerraformAzure SQL ServerAzure SQL Database

Not the lab you were looking for?

Browse 150+ hands-on labs across AWS, Azure, Kubernetes, Docker, and cloud security.

Explore the catalog