Skip to content

Data Source: azurermSqlDatabase

Use this data source to access information about an existing SQL Azure Database.

-> Note: The azurermSqlDatabase data source is deprecated in version 3.0 of the AzureRM provider and will be removed in version 4.0. Please use the azurermMssqlDatabase data source instead.

Example Usage

import * as cdktf from "cdktf";
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const dataAzurermSqlDatabaseExample =
  new azurerm.dataAzurermSqlDatabase.DataAzurermSqlDatabase(this, "example", {
    name: "example_db",
    resource_group_name: "example-resources",
    server_name: "example_db_server",
  });
new cdktf.TerraformOutput(this, "sql_database_id", {
  value: dataAzurermSqlDatabaseExample.id,
});

Argument Reference

  • name - The name of the SQL Database.

  • serverName - The name of the SQL Server.

  • resourceGroupName - Specifies the name of the Resource Group where the Azure SQL Database exists.

Attributes Reference

  • id - The SQL Database ID.

  • collation - The name of the collation.

  • creationDate - The creation date of the SQL Database.

  • defaultSecondaryLocation - The default secondary location of the SQL Database.

  • edition - The edition of the database.

  • elasticPoolName - The name of the elastic database pool the database belongs to.

  • failoverGroupId - The ID of the failover group the database belongs to.

  • location - The location of the Resource Group in which the SQL Server exists.

  • name - The name of the database.

  • readScale - Indicate if read-only connections will be redirected to a high-available replica.

  • requestedServiceObjectiveId - The ID pertaining to the performance level of the database.

  • requestedServiceObjectiveName - The name pertaining to the performance level of the database.

  • resourceGroupName - The name of the resource group in which the database resides. This will always be the same resource group as the Database Server.

  • serverName - The name of the SQL Server on which to create the database.

  • tags - A mapping of tags assigned to the resource.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • read - (Defaults to 5 minutes) Used when retrieving the SQL Azure Database.