title: Using terraform how do I create an azure sql database from a backup
body: <p>Using the default example on the terraform site I can easily create a database but how do I create a new database by restoring a backup?</p>
  <pre><code>provider &quot;azurerm&quot; {
      features {}
  }
  
  resource &quot;azurerm_resource_group&quot; &quot;example&quot; {
      name     = &quot;example-resources&quot;
      location = &quot;West Europe&quot;
  }
  
  resource &quot;azurerm_storage_account&quot; &quot;example&quot; {
      name                     = &quot;examplesa&quot;
      resource_group_name      = azurerm_resource_group.example.name
      location                 = azurerm_resource_group.example.location
      account_tier             = &quot;Standard&quot;
      account_replication_type = &quot;LRS&quot;
  }
  
  resource &quot;azurerm_mssql_server&quot; &quot;example&quot; {
      name                         = &quot;example-sqlserver&quot;
      resource_group_name          = azurerm_resource_group.example.name
      location                     = azurerm_resource_group.example.location
      version                      = &quot;12.0&quot;
      administrator_login          = &quot;4dm1n157r470r&quot;
      administrator_login_password = &quot;4-v3ry-53cr37-p455w0rd&quot;
  }
  
  resource &quot;azurerm_mssql_database&quot; &quot;test&quot; {
      name           = &quot;acctest-db-d&quot;
      server_id      = azurerm_mssql_server.example.id
      collation      = &quot;SQL_Latin1_General_CP1_CI_AS&quot;
      license_type   = &quot;LicenseIncluded&quot;
      max_size_gb    = 4
      read_scale     = true
      sku_name       = &quot;BC_Gen5_2&quot;
      zone_redundant = true
  
      create_mode = &quot;RestoreExternalBackup&quot; &lt;-- WHAT ELSE DO I DO?
  
      extended_auditing_policy {
          storage_endpoint                        = azurerm_storage_account.example.primary_blob_endpoint
          storage_account_access_key              = azurerm_storage_account.example.primary_access_key
          storage_account_access_key_is_secondary = true
          retention_in_days                       = 6
      }
  
  
      tags = {
          foo = &quot;bar&quot;
      }
  
  }
  </code></pre>
  <p>In the documentation they mention a <code>create_mode</code> &quot;RestoreExternalBackup&quot; option but provide no example on how to reference the backup - mine is stored in an azure storage container.</p>
  <p>Edit: The mention of &quot;RestoreExternalBackup&quot; was more about my lack of understanding. What I meant to ask was how do I restore/create a database from a bacpac file stored in a Storage Account</p>