GetDatabase

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

Example Usage

using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
    public MyStack()
    {
        var example = Output.Create(Azure.MSSql.GetDatabase.InvokeAsync(new Azure.MSSql.GetDatabaseArgs
        {
            Name = "example-mssql-db",
            ServerId = "example-mssql-server-id",
        }));
        this.DatabaseId = example.Apply(example => example.Id);
    }

    [Output("databaseId")]
    public Output<string> DatabaseId { get; set; }
}
package main

import (
    "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/mssql"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        example, err := mssql.LookupDatabase(ctx, &mssql.LookupDatabaseArgs{
            Name:     "example-mssql-db",
            ServerId: "example-mssql-server-id",
        }, nil)
        if err != nil {
            return err
        }
        ctx.Export("databaseId", example.Id)
        return nil
    })
}
import pulumi
import pulumi_azure as azure

example = azure.mssql.get_database(name="example-mssql-db",
    server_id="example-mssql-server-id")
pulumi.export("databaseId", example.id)
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = azure.mssql.getDatabase({
    name: "example-mssql-db",
    serverId: "example-mssql-server-id",
});
export const databaseId = example.then(example => example.id);

Using GetDatabase

function getDatabase(args: GetDatabaseArgs, opts?: InvokeOptions): Promise<GetDatabaseResult>
function  get_database(name=None, server_id=None, opts=None)
func LookupDatabase(ctx *Context, args *LookupDatabaseArgs, opts ...InvokeOption) (*LookupDatabaseResult, error)

Note: This function is named LookupDatabase in the Go SDK.

public static class GetDatabase {
    public static Task<GetDatabaseResult> InvokeAsync(GetDatabaseArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Name string

The name of the Ms SQL Database.

ServerId string

The id of the Ms SQL Server on which to create the database.

Name string

The name of the Ms SQL Database.

ServerId string

The id of the Ms SQL Server on which to create the database.

name string

The name of the Ms SQL Database.

serverId string

The id of the Ms SQL Server on which to create the database.

name str

The name of the Ms SQL Database.

server_id str

The id of the Ms SQL Server on which to create the database.

GetDatabase Result

The following output properties are available:

Collation string

The collation of the database.

ElasticPoolId string

The id of the elastic pool containing this database.

Id string

The provider-assigned unique ID for this managed resource.

LicenseType string

The license type to apply for this database.

MaxSizeGb int

The max size of the database in gigabytes.

Name string
ReadReplicaCount int

The number of readonly secondary replicas associated with the database to which readonly application intent connections may be routed.

ReadScale bool

If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica.

ServerId string
SkuName string

The name of the sku of the database.

Tags Dictionary<string, string>

A mapping of tags to assign to the resource.

ZoneRedundant bool

Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones.

Collation string

The collation of the database.

ElasticPoolId string

The id of the elastic pool containing this database.

Id string

The provider-assigned unique ID for this managed resource.

LicenseType string

The license type to apply for this database.

MaxSizeGb int

The max size of the database in gigabytes.

Name string
ReadReplicaCount int

The number of readonly secondary replicas associated with the database to which readonly application intent connections may be routed.

ReadScale bool

If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica.

ServerId string
SkuName string

The name of the sku of the database.

Tags map[string]string

A mapping of tags to assign to the resource.

ZoneRedundant bool

Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones.

collation string

The collation of the database.

elasticPoolId string

The id of the elastic pool containing this database.

id string

The provider-assigned unique ID for this managed resource.

licenseType string

The license type to apply for this database.

maxSizeGb number

The max size of the database in gigabytes.

name string
readReplicaCount number

The number of readonly secondary replicas associated with the database to which readonly application intent connections may be routed.

readScale boolean

If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica.

serverId string
skuName string

The name of the sku of the database.

tags {[key: string]: string}

A mapping of tags to assign to the resource.

zoneRedundant boolean

Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones.

collation str

The collation of the database.

elastic_pool_id str

The id of the elastic pool containing this database.

id str

The provider-assigned unique ID for this managed resource.

license_type str

The license type to apply for this database.

max_size_gb float

The max size of the database in gigabytes.

name str
read_replica_count float

The number of readonly secondary replicas associated with the database to which readonly application intent connections may be routed.

read_scale bool

If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica.

server_id str
sku_name str

The name of the sku of the database.

tags Dict[str, str]

A mapping of tags to assign to the resource.

zone_redundant bool

Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones.

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.