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
LookupDatabasein the Go SDK.
public static class GetDatabase {
public static Task<GetDatabaseResult> InvokeAsync(GetDatabaseArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
GetDatabase Result
The following output properties are available:
- Collation string
The collation of the database.
- Elastic
Pool stringId The id of the elastic pool containing this database.
- Id string
The provider-assigned unique ID for this managed resource.
- License
Type string The license type to apply for this database.
- Max
Size intGb The max size of the database in gigabytes.
- Name string
- Read
Replica intCount 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 string - Sku
Name string The name of the sku of the database.
- Dictionary<string, string>
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.
- Collation string
The collation of the database.
- Elastic
Pool stringId The id of the elastic pool containing this database.
- Id string
The provider-assigned unique ID for this managed resource.
- License
Type string The license type to apply for this database.
- Max
Size intGb The max size of the database in gigabytes.
- Name string
- Read
Replica intCount 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 string - Sku
Name string The name of the sku of the database.
- map[string]string
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.
- collation string
The collation of the database.
- elastic
Pool stringId The id of the elastic pool containing this database.
- id string
The provider-assigned unique ID for this managed resource.
- license
Type string The license type to apply for this database.
- max
Size numberGb The max size of the database in gigabytes.
- name string
- read
Replica numberCount The number of readonly secondary replicas associated with the database to which readonly application intent connections may be routed.
- read
Scale boolean If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica.
- server
Id string - sku
Name string The name of the sku of the database.
- {[key: string]: string}
A mapping of tags to assign to the resource.
- zone
Redundant 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_ strid 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_ floatgb The max size of the database in gigabytes.
- name str
- read_
replica_ floatcount 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.
- 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
azurermTerraform Provider.