SQL DB - AZURE - Day20
create an Azure SQL Database with a failover group using Terraform

SQL DB - AZURE - Day20

  • Setup our development area in Azure cloud shell
  • Understand how Terraform works
  • Run our code and deploy Azure SQL Database with Auto-Failover group
  • Connect and test both Primary and Secondary logical SQL Server
  • Failover and test functionality

Pre-requisites

  1. An Azure Subscription.
  2. A basic understanding of Azure SQL Database.
  3. Basic Azure infrastructure understanding.
  4. Basic coding knowledge.

HashiCorp Terraform is installed by default in the?Azure Cloud Shell. The Cloud shell can be run?standalone, or as an integrated command-line terminal from the Azure?portal.?

To create an Azure SQL Database with a failover group using Terraform, you will need to use the azurerm_sql_database resource and set the failover_group attribute. Here is an example of how you can do this:


resource "azurerm_resource_group" "example" {
? name? ? ?= "example-group"
? location = "West US"
}


resource "azurerm_sql_server" "example" {
? name? ? ? ? ? ? ? ? ? ? ? ? ?= "example-server"
? resource_group_name? ? ? ? ? = azurerm_resource_group.example.name
? location? ? ? ? ? ? ? ? ? ? ?= azurerm_resource_group.example.location
? version? ? ? ? ? ? ? ? ? ? ? = "12.0"
? administrator_login? ? ? ? ? = "sqladmin"
? administrator_login_password = "password"
}


resource "azurerm_sql_database" "example" {
? name? ? ? ? ? ? ? ? = "example-database"
? resource_group_name = azurerm_resource_group.example.name
? server_name? ? ? ? ?= azurerm_sql_server.example.name
? location? ? ? ? ? ? = azurerm_resource_group.example.location
? edition? ? ? ? ? ? ?= "Standard"
? collation? ? ? ? ? ?= "SQL_Latin1_General_CP1_CI_AS"
? max_size_bytes? ? ? = "1073741824"
? failover_group {
? ? name = "example-failover-group"
? }
}        

This will create an Azure SQL Database with a failover group called example-failover-group. You can then add additional Azure SQL Databases to the failover group by setting the failover_group_id attribute on those databases to the ID of the azurerm_sql_database resource that defines the failover group.

I hope this helps! Let me know if you have any questions or need further assistance.

We post regularly on social media about the free live hands-on learning opportunities, Opensource Proof Of Concepts, Solutions Architecture Reviews, Automation live hands-on, Live career Q&A Sessions, and promotions. Do follow and support us via the following links. ??

LinkedIn?|?Twitter?|??LinkedIn Group??|?YouTube

Want to Join Every week Free Terraform Cloud Automation Handson Training?

No alt text provided for this image

Feel free to add me in your LinkedIn connection and send me message for more steps.

"Aiming to create 1000 leaders every year with more confidence"

Are you looking for some life confidence. Feel free to reach me out?Vijayabalan Balakrishnan?not just learning.

Sathishkumar Santhanam

Principal Infra Developer | AZ Dev Ops |SRE | 5XMicrosoft | 2×AWS|ITIL | AZ CI-CD | AWS| Infra Architect| Infra Modernization

2 年

#connections #cfbr

回复

要查看或添加评论,请登录

Vijayabalan Balakrishnan的更多文章

  • Cancer Free Champs Foundation

    Cancer Free Champs Foundation

    ????I'm bursting with happiness and a sense of accomplishment. From a very early age, I had big dreams of making a…

    63 条评论
  • I am Desktop Engineer. How to Switch Cloud Engineer ?

    I am Desktop Engineer. How to Switch Cloud Engineer ?

    To make a switch from one job to another, you need to have the skill requisites needed for that new job. Since you are…

    6 条评论
  • Is focus the key to success ?

    Is focus the key to success ?

    Being successful at anything takes more intentional efforts than just luck; which is why you must intentionally create…

    12 条评论
  • IT Employee's Confusions

    IT Employee's Confusions

    Based on my experience and interaction with my colleagues, I would like to mention my views: People in any field fear…

    11 条评论
  • Stay humble when you are successful

    Stay humble when you are successful

    With time every human evolve, every person grow, every individual aspire and achieve something. It doesn't matter how…

    8 条评论
  • How important is it to have a Mentor?

    How important is it to have a Mentor?

    I know a few people who are not willing to work hard. Hard work in itself is not the problem.

    38 条评论
  • Is DevOps going to disappear because of AI ?

    Is DevOps going to disappear because of AI ?

    DevOps is a set of practices that help organizations develop, deploy, and manage software more efficiently. This…

    4 条评论
  • How to overcome the fear of coding?

    How to overcome the fear of coding?

    Overcoming the fear of coding can take time and effort, but there are some strategies that can help. Here are a few…

    6 条评论
  • Degree in Distance Education - Day 3

    Degree in Distance Education - Day 3

    1st point The problem a candidate makes is not highlighting his skills in resume and most of the initial screening for…

    5 条评论
  • How can we face defeat with courage?

    How can we face defeat with courage?

    You need to be self-motivated all the time. Nobody understands your dreams better than you.

    10 条评论

社区洞察

其他会员也浏览了