Get a free AWS Well-Architected Assessment ->

Microsoft Azure

SQL Server

Azure SQL Server is a cloud-based version of the Microsoft SQL Server relational database management system. It is a fully managed platform-as-a-service (PaaS) offering that provides automatic patching, backup and recovery, high availability, and disaster recovery capabilities, and built-in intelligence and advanced analytics features. Azure SQL Server offers multiple deployment options, service tiers, programming languages, and connectivity options, and provides integration with other Azure services.
aws cost
Direct Cost
Indirect Cost
No items found.
Terraform Name
SQL Server

The following arguments are supported:

  • name - (Required) The name of the Microsoft SQL Server. This needs to be globally unique within Azure. Changing this forces a new resource to be created.
  • resource_group_name - (Required) The name of the resource group in which to create the Microsoft SQL Server. Changing this forces a new resource to be created.
  • location - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
  • version - (Required) The version for the new server. Valid values are: 2.0 (for v11 server) and 12.0 (for v12 server). Changing this forces a new resource to be created.
  • administrator_login - (Required) The administrator login name for the new server. Changing this forces a new resource to be created.
  • administrator_login_password - (Required) The password associated with the administrator_login user. Needs to comply with Azure's Password Policy
  • connection_policy - (Optional) The connection policy the server will use. Possible values are Default, Proxy, and Redirect. Defaults to Default.
  • identity - (Optional) An identity block as defined below.
  • threat_detection_policy - (Optional) Threat detection policy configuration. The threat_detection_policy block supports fields documented below.
  • tags - (Optional) A mapping of tags to assign to the resource.

An identity block supports the following:

  • type - (Required) Specifies the type of Managed Service Identity that should be configured on this SQL Server. The only possible value is SystemAssigned.


The assigned principal_id and tenant_id can be retrieved after the identity type has been set to SystemAssigned and the Microsoft SQL Server has been created. More details are available below.

The threat_detection_policy block supports the following:

  • state - (Optional) The State of the Policy. Possible values are Disabled, Enabled and New.
  • disabled_alerts - (Optional) Specifies a list of alerts which should be disabled. Possible values include Access_Anomaly, Data_Exfiltration, Sql_Injection, Sql_Injection_Vulnerability and Unsafe_Action",.
  • email_account_admins - (Optional) Should the account administrators be emailed when this alert is triggered?
  • email_addresses - (Optional) A list of email addresses which alerts should be sent to.
  • retention_days - (Optional) Specifies the number of days to keep in the Threat Detection audit logs.
  • storage_account_access_key - (Optional) Specifies the identifier key of the Threat Detection audit storage account. Required if state is Enabled.
  • storage_endpoint - (Optional) Specifies the blob storage endpoint (e.g. This blob storage will hold all Threat Detection audit logs. Required if state is Enabled.

Associating resources with a
SQL Server
Resources do not "belong" to a
SQL Server
Rather, one or more Security Groups are associated to a resource.
SQL Server
via Terraform:
The following HCL manages a Microsoft SQL Azure Database Server

resource "azurerm_resource_group" "example" {
 name     = "database-rg"
 location = "West Europe"

resource "azurerm_storage_account" "example" {
 name                     = "examplesa"
 resource_group_name      =
 location                 = azurerm_resource_group.example.location
 account_tier             = "Standard"
 account_replication_type = "LRS"

resource "azurerm_sql_server" "example" {
 name                         = "mssqlserver"
 resource_group_name          =
 location                     = azurerm_resource_group.example.location
 version                      = "12.0"
 administrator_login          = "mradministrator"
 administrator_login_password = "thisIsDog11"

 tags = {
   environment = "production"

SQL Server
via CLI:

az sql server create --name
                    [--enable-public-network {false, true}]
                    [--identity-type {None, SystemAssigned, SystemAssigned,UserAssigned, UserAssigned}]
                    [--minimal-tls-version {1.0, 1.1, 1.2}]
                    [--restrict-outbound-network-access {false, true}]


az sql server create -l westus -g mygroup -n myserver -u myadminuser -p myadminpassword

Best Practices for
SQL Server

Categorized by Availability, Security & Compliance and Cost

No items found.
Explore all the rules our platform covers
Related blog posts