Automate deployment of database resources
Unlock the complete study guide + 25 practice exams totaling 1,500 questions.
Bundled into the existing Administering Microsoft Azure SQL Solutions premium course — no separate purchase.
14-day refund guarantee on one-time purchases and your first subscription charge.
Included in this chapter:
- Templates and scripts: two routes to Resource Manager
- Who may deploy: Azure RBAC, not database roles
- Declaring a logical server and database in Bicep
- Dependencies decide deployment order
- Parameters and secure values
- Modules: reuse one SQL definition
- Loops: a collection of databases
- Deployment modes: what a redeploy changes
- Previewing with what-if
- Azure PowerShell: build the SQL resource hierarchy
- Azure PowerShell: change an existing resource
- Azure CLI: build the SQL resource hierarchy
- Azure CLI: change an existing resource
- Azure CLI scripts: --no-wait and read-back
- Azure CLI scripts: --query and output formats
- Three failure stages: validation, preflight, deployment
- Reading past DeploymentFailed
- Policy and locks: limits that permissions can't lift
- Registration, SKU, quota, and retryable errors
- After a failure: what stays deployed
- Exam-pattern recognition
Template versus script: the same Azure SQL resources from each route
| Aspect | Template (Bicep or ARM JSON) | Azure PowerShell script | Azure CLI script |
|---|---|---|---|
| Model | Declarative: one file states the final state; Resource Manager orders and parallelizes | Imperative: cmdlets run in the order written | Imperative: commands run in the order written |
| Logical server | Resource Microsoft.Sql/servers | New-AzSqlServer | az sql server create |
| Database | Resource Microsoft.Sql/servers/databases with parent set to the server | New-AzSqlDatabase | az sql db create --server |
| Change an existing database | Redeploy the file with every intended non-default property | Set-AzSqlDatabase | az sql db update |
| Submit a template (template route, from either tool) | Submitted by either tool's deployment command | New-AzResourceGroupDeployment -TemplateFile | az deployment group create --template-file |
| Preview a template's changes (from either tool) | What-if operation | New-AzResourceGroupDeployment -WhatIf | az deployment group what-if |
| Authorization | Azure RBAC write access plus Microsoft.Resources/deployments operations | Azure RBAC role that covers each resource written, such as SQL DB Contributor for databases | Azure RBAC role that covers each resource written, such as SQL DB Contributor for databases |
Decision tree
Cheat sheet
Unlock with Premium — includes all practice exams and the complete study guide.
Also tested in
References
- https://learn.microsoft.com/en-us/azure/azure-sql/database/logical-servers
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/overview
- https://learn.microsoft.com/en-us/azure/azure-sql/database/scripts/create-and-configure-database-powershell
- https://learn.microsoft.com/en-us/azure/azure-sql/database/scripts/create-and-configure-database-cli
- https://learn.microsoft.com/en-us/azure/azure-sql/database/single-database-create-bicep-quickstart
- https://learn.microsoft.com/en-us/azure/azure-monitor/fundamentals/activity-log
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/control-plane-and-data-plane
- https://learn.microsoft.com/en-us/credentials/certifications/resources/study-guides/dp-300
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/deploy-what-if
- https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles/databases
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/common-deployment-errors
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-providers-and-types
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/deploy-powershell
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/resource-dependencies
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/error-not-found
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/parameters
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/find-error-code
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/deploy-cli
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/modules
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/loops
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/deployment-modes
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/deployment-stacks
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/deploy-what-if
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions-resource
- https://learn.microsoft.com/en-us/powershell/module/az.sql/new-azsqlelasticpool
- https://learn.microsoft.com/en-us/powershell/module/az.sql/new-azsqldatabase
- https://learn.microsoft.com/en-us/powershell/module/az.sql/new-azsqlinstance
- https://learn.microsoft.com/en-us/powershell/module/az.sql/set-azsqldatabase
- https://learn.microsoft.com/en-us/powershell/module/az.sql/set-azsqlelasticpool
- https://learn.microsoft.com/en-us/azure/azure-sql/database/purchasing-models
- https://learn.microsoft.com/en-us/powershell/module/az.sql/set-azsqlinstance
- https://learn.microsoft.com/en-us/azure/azure-sql/database/serverless-tier-create-configure
- https://learn.microsoft.com/en-us/cli/azure/account
- https://learn.microsoft.com/en-us/cli/azure/sql/server
- https://learn.microsoft.com/en-us/cli/azure/sql/db
- https://learn.microsoft.com/en-us/cli/azure/sql/elastic-pool
- https://learn.microsoft.com/en-us/cli/azure/sql/mi
- https://learn.microsoft.com/en-us/cli/azure/deployment/group
- https://learn.microsoft.com/en-us/cli/azure/format-output-azure-cli
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/quickstart-troubleshoot-bicep-deployment
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/error-sku-not-available
- https://learn.microsoft.com/en-us/cli/azure/monitor/activity-log
- https://learn.microsoft.com/en-us/azure/azure-monitor/platform/activity-log-schema
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/error-policy-requestdisallowedbypolicy
- https://learn.microsoft.com/en-us/azure/governance/policy/concepts/exemption-structure
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/lock-resources
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/error-register-resource-provider
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/error-resource-quota
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/request-limits-and-throttling
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/quickstart-troubleshoot-arm-deployment
- https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/rollback-on-error