dev-resources.site
for different kinds of informations.
ARM Template: Azure SQL Server
Published at
6/28/2024
Categories
arm
azure
sqlserver
iac
Author
srinivasuluparanduru
Author
20 person written this
srinivasuluparanduru
open
Two Resources to be created for Azure SQL Server
- Azure SQL Database Server for hosting the database
- SQL Database
ARM Template for Azure SQL Server
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"SQLLogin":{
"type": "string",
"metadata":{
"description":"The administrator user name"
}
},
"SQLPassword":{
"type": "secureString",
"metadata":{
"description":"The administrator user name"
}
},
},
"functions": [],
"variables": {},
"resources": [
{
"type": "Microsoft.Sql/servers",
"apiVersion": "2023-05-01-preview",
"name": "sqlserver24062024",
"location": "[resourceGroup().location]",
"properties":{
"administratorLogin": "[parameters('SQLLogin')]",
"administratorLoginPassword": "[parameters('SQLPassword')]"
}
},
{
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2023-05-01-preview",
"name": "[format('{0}/{1}','sqlserver24062024','appdb')]",
"location": "[resourceGroup().location]",
"sku":{
"name":"Basic",
"tier":"Basic"
},
"properties":{},
"dependsOn": [
"[resourceId('Microsoft.Sql/servers','sqlserver24062024')]"
]
}
],
"outputs": {}
}
Explanation for the above template
Step1:
"parameters": {
"SQLLogin":{
"type": "string",
"metadata":{
"description":"The administrator user name"
}
},
"SQLPassword":{
"type": "secureString",
"metadata":{
"description":"The administrator user name"
}
},
}
- Two variable parameters SQL Login and SQL Password has been created in ARM Template and to pass dynamic values
Step2:
{
"type": "Microsoft.Sql/servers",
"apiVersion": "2023-05-01-preview",
"name": "sqlserver24062024",
"location": "[resourceGroup().location]",
"properties":{
"administratorLogin": "[parameters('SQLLogin')]",
"administratorLoginPassword": "[parameters('SQLPassword')]"
}
},
- Above code is used for creating SQL Server for hosting the database and using two input parameters passed
Step3:
{
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2023-05-01-preview",
"name": "[format('{0}/{1}','sqlserver24062024','appdb')]",
"location": "[resourceGroup().location]",
"sku":{
"name":"Basic",
"tier":"Basic"
},
"properties":{},
"dependsOn": [
"[resourceId('Microsoft.Sql/servers','sqlserver24062024')]"
]
}
- Creating sql database only after the sql server is created by mentioning the dependency in dependsOn resourceId
Step4:Go to portal.azure.com and create a new resource group as arm-sql
Step5:Search with template deployment in azure portal and select the option highlighted in the picture
Step6: Select the custom template and paste the arm template code,select resource group and pass the parameters
then review and create
Conclusion : Code used for SQL Server and database using ARM Template
💬 If you enjoyed reading this blog post and found it informative, please take a moment to share your thoughts by leaving a review and liking it 😀 and follow me in dev.to , linkedin
iac Article's
30 articles in total
Customize VPCs with CloudFormation Conditions
read article
Provision EKS Cluster with Terraform, Terragrunt & GitHub Actions
read article
Terraform - Mastering Idempotency Violations - Handling Resource Conflicts and Failures in Azure
read article
OpenTofu - Infrastructure configuration management
read article
Goliat Shield: Your first line of defense
read article
Using CloudFormation to deploy a web app with HA
read article
KCL + Crossplane: A Declarative Language for Deploying Complex Infrastructure on AWS with Kubernetes.
read article
Terraform Remote Backend: How to Manage Terraform State File for Easier Collaboration across Teams
read article
Let's Talk Infrastructure as Code (IaC) 🚀
read article
Conditional deployment in Azure Bicep
read article
Learning Ansible, Proxmox and LXC, Part 1
read article
Create your K3S lab on Google Cloud
read article
Mastering Multi-Cloud Infrastructure with Terraform: A Game-Changer for Modern IT
read article
The KISS Principle: Why Simplicity is Key in Dev and DevOps (and How to Implement It)
read article
user-defined type in Azure Bicep, an introduction
read article
You Are Not Saved By IaC
read article
Terraform Tactics: A Guide to Mastering Terraform Commands for DevOps
read article
Infrastructure as Code with Terraform
read article
What is Infrastructure as Code (IaC) and Why It's Transforming DevOps
read article
Managing Infrastructure as Code at Amazon: Tools, Strategies, and Practices
read article
Automating AWS Cost and Usage Report with CloudFormation
read article
Crossplane + AWS Overview for Managing Infrastructure as Code (IaC) with Kubernetes
read article
How IaC can streamline the Infrastructure & Configuration
read article
Secure Terraform Solution for Government Agencies
read article
IAC - Azure WebApp creation
read article
Terraform pipeline (IaC for AWS)
read article
Terraform
read article
ARM Template: Azure SQL Server
currently reading
9 Ways to Spin Up an EKS Cluster - Way 3 - eksctl
read article
What is Infrastructure as Code (IaC)?
read article
Featured ones: