Study guide

11.3 Automating Deployment with ARM and Bicep Templates

DP-300: Administering Microsoft Azure SQL Solutions Exam

Track your progress as you read

Finished sections get a check mark.

1 Introduction & Exam Overview

1.1 Current DP-300 Exam Facts 1.2 Skills Outline and Domain Weights 1.3 Study Strategy and Official Resources

2 Planning and Deploying Azure SQL Solutions

2.1 Choosing and Deploying Azure SQL Database Offerings 2.2 Automated Deployment, Azure Arc, and SQL Database in Microsoft Fabric 2.3 Table Partitioning and Sharding Strategy 2.4 Hybrid SQL Server and IaaS Patching

3 Configuring Resources for Scale and Performance

3.1 Configuring Azure SQL Database for Scale and Performance 3.2 Configuring Azure SQL Managed Instance for Scale and Performance 3.3 Configuring SQL Server on Azure VMs for Scale and Performance 3.4 Configuring Table Partitioning and Data Compression

4 Planning and Implementing a Migration Strategy

4.1 Evaluating Migration Requirements and Strategies 4.2 Implementing Online, Offline, and Azure Migrations 4.3 Migrating Between Azure SQL Services and Troubleshooting

5 Configuring Database Authentication and Authorization

5.1 Microsoft Entra ID Authentication for Azure SQL 5.2 Authentication for SQL on Azure VMs and Managed Instance; Troubleshooting 5.3 Security Principals and Entra-Backed Users 5.4 Permissions, Least Privilege, and T-SQL Management

6 Implementing Security for Data at Rest and in Transit

6.1 Transparent Data Encryption and Object-Level Encryption 6.2 Always Encrypted and VBS Enclaves 6.3 Firewall Rules, Private Links, and Service Endpoints

7 Implementing Compliance Controls for Sensitive Data

7.1 Data Classification and Server/Database Auditing 7.2 Change Data Tracking and Dynamic Data Masking 7.3 Row-Level Security and Ledger in Azure SQL

8 Monitoring Resource Activity and Performance

8.1 Operational Baselines and Performance Metric Sources 8.2 Interpreting Metrics and Configuring Activity Monitoring 8.3 Monitoring with Database Watcher (Preview) 8.4 Monitoring with Extended Events

9 Monitoring and Optimizing Query Performance

9.1 Configuring and Monitoring with Query Store 9.2 Session Blocking and Dynamic Management Views 9.3 Index Changes and Execution Plan Review 9.4 Query Construct Modifications and Intelligent Insights

10 Configuring Database Solutions for Optimal Performance

10.1 Index, Statistics, and Integrity Maintenance 10.2 Automatic Tuning and Database-Scoped Configuration 10.3 Server Settings and Resource Governor 10.4 Compute/Storage Scaling and Intelligent Query Processing

11 Creating and Managing SQL Server Agent Jobs

11.1 Schedules for Regular Maintenance Jobs 11.2 Job Alerts, Notifications, and Agent Troubleshooting 11.3 Automating Deployment with ARM and Bicep Templates

12 Automating Deployments and Database Tasks in Azure

12.1 Azure PowerShell, Azure CLI, and Deployment Monitoring 12.2 Elastic Jobs for Cross-Database Automation 12.3 Azure Automation Runbooks, Alerts, and Troubleshooting Automated Tasks

13 Planning an HA/DR Strategy and Backup and Restore

13.1 Recommending HA/DR Strategy from RPO and RTO 13.2 Hybrid and Azure-Specific HA/DR Solutions and Testing 13.3 Backup and Restore Strategy with Native Tools 13.4 Point-in-Time Restore and Recovery Operations

14 Configuring HA/DR: Long-Term Retention, Geo-Replication, and Failover Groups

14.1 Long-Term Retention, T-SQL Backup/Restore, and Cloud Storage 14.2 Active Geo-Replication 14.3 Failover Groups

15 Advanced HA/DR: Availability Groups, FCIs, Log Shipping, and Troubleshooting

15.1 Always On Availability Groups on SQL Managed Instance and Azure VMs 15.2 Always On Failover Cluster Instances and Log Shipping 15.3 Monitoring and Troubleshooting HA/DR Solutions

11.3 Automating Deployment with ARM and Bicep Templates

Key Takeaways Explain This Topic AI

An ARM template is a JSON document with schema, contentVersion, parameters, variables, functions, resources, and outputs; Bicep is a transparent DSL that compiles to the same ARM template

Bicep adds modules, parameters, variables, resource loops (copy), conditions (if), and decorators for parameter validation; a parameter file supplies per-environment values

Deployment supports incremental and complete modes: incremental leaves unchanged resources in place, complete deletes resources in the resource group that are not in the template

The what-if operation (az deployment group what-if) previews create/update/delete/no-change actions before you run a deployment, and is idempotent

Bicep can deploy Azure SQL resources including logical servers, databases, managed instances, elastic pools, firewall rules, virtual network rules, and private endpoints, and integrates with Azure DevOps and GitHub Actions CI/CD pipelines

Last updated: August 2026

ARM Template Structure

An Azure Resource Manager (ARM) template is a JSON document describing the resources you want to deploy. The top-level structure: {

  • "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  • "contentVersion": "1.0.0.0",
  • "parameters": {},
  • "variables": {},
  • "functions": [],
  • "resources": [],
  • "outputs": {}
  • }

$schema : pins the template language version.

contentVersion : a version you set for your own tracking (any value).

parameters : inputs supplied at deployment time (resource SKU, admin password, environment name).

variables : computed values used to reduce repetition.

functions : user-defined functions for reusable expressions.

resources : the actual resources to deploy, each with type , name , apiVersion , location , properties , and optional dependsOn .

outputs : values returned after deployment (a connection string, a resource ID).

ARM templates are declarative and idempotent : deploying the same template repeatedly produces the same end state. The engine diffs the desired state against the current state and applies only the changes needed.

Bicep DSL

Bicep is a Domain-Specific Language that compiles transparently to ARM templates. The exam treats Bicep as the recommended authoring format because it is more readable and less verbose than JSON, while producing the same deployments. Bicep key features:

Resource declarations with a symbolic name: resource srv 'Microsoft.Sql/servers@2023-08-01-preview' = { ... } - the symbolic name lets other resources reference it directly, replacing explicit dependsOn strings.

Parameters with decorators for validation: @allowed([...]) , @secure() , @minLength(n) , @maxLength(n) , @description('...') . Secure parameters hide values in deployment output.

Variables for computed values, including string interpolation: var fqdn = '${srv.name}.database.windows.net' .

Modules : a .bicep file that deploys a related set of resources, invoked from a parent template with module dbModule 'modules/database.bicep' = { name: 'dbDeploy', params: { ... } } . Modules enable composition and reuse across environments.

Loops : resource pools 'Microsoft.Sql/servers/elasticPools@...' = [for i in range(0, poolCount): { ... }] deploys multiple similar resources.

Conditions : resource monitor 'Microsoft.Insights/components@...' = if (enableMonitoring) { ... } deploys a resource only when a condition is true.

Parameter files : one file per environment ( main.parameters.dev.json , main.parameters.prod.json ) with { "$schema": "...", "parameters": { ... } } to supply environment-specific values.

Deployment Modes and What-If

ARM deployments run in two modes :

Incremental (default): resources in the template are created or updated; resources that exist in the resource group but are not in the template are left unchanged .

Complete : resources in the template are created or updated, and any resources in the resource group that are not in the template are deleted . Use with caution - it is destructive for anything not declared in the template.

The what-if operation previews what a deployment would do without applying it: az deployment group what-if -g rg-prod -f main.bicep -e @main.parameters.prod.json . The output classifies each resource as Create , Update , Delete , Ignore (no change), or NoChange . What-if is idempotent and safe to run before every deployment; it is the recommended pre-flight in CI/CD pipelines.

Idempotency and Bicep Build/Decompile

Idempotency means the same template applied multiple times converges to the same state, and re-running a deployment after a manual change will reconcile the resource back to the template's declared state (for incremental mode, only for properties the template declares). Bicep tooling supports two conversions:

az bicep build compiles a .bicep file to an ARM template JSON.

az bicep decompile converts an existing ARM template JSON back to a Bicep file, useful for migrating legacy templates.

The bicep restore command pulls external modules referenced via a registry path into the local cache.

Deployment Scopes

A deployment can target different scopes:

  • Scope Use
  • Resource group Most Azure SQL deployments (logical server, database, MI, pool)
  • Subscription Resource group creation, role assignments at subscription scope
  • Management group Policy assignments across subscriptions
  • Tenant Tenant-level definitions (rare for SQL)

Choose the scope based on what the template manages: a template that creates a resource group and then resources inside it is a subscription-scope template; a template that creates a SQL MI and its databases is a resource-group template.