We recommend using Azure Native.
Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
published on Monday, Mar 9, 2026 by Pulumi
We recommend using Azure Native.
Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
published on Monday, Mar 9, 2026 by Pulumi
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var example = Output.Create(Azure.Sql.GetDatabase.InvokeAsync(new Azure.Sql.GetDatabaseArgs
{
Name = "example_db",
ServerName = "example_db_server",
ResourceGroupName = "example-resources",
}));
this.SqlDatabaseId = example.Apply(example => example.Id);
}
[Output("sqlDatabaseId")]
public Output<string> SqlDatabaseId { get; set; }
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/sql"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := sql.LookupDatabase(ctx, &sql.LookupDatabaseArgs{
Name: "example_db",
ServerName: "example_db_server",
ResourceGroupName: "example-resources",
}, nil)
if err != nil {
return err
}
ctx.Export("sqlDatabaseId", example.Id)
return nil
})
}
Example coming soon!
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.sql.getDatabase({
name: "example_db",
serverName: "example_db_server",
resourceGroupName: "example-resources",
});
export const sqlDatabaseId = example.then(example => example.id);
import pulumi
import pulumi_azure as azure
example = azure.sql.get_database(name="example_db",
server_name="example_db_server",
resource_group_name="example-resources")
pulumi.export("sqlDatabaseId", example.id)
Example coming soon!
Using getDatabase
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getDatabase(args: GetDatabaseArgs, opts?: InvokeOptions): Promise<GetDatabaseResult>
function getDatabaseOutput(args: GetDatabaseOutputArgs, opts?: InvokeOptions): Output<GetDatabaseResult>def get_database(name: Optional[str] = None,
resource_group_name: Optional[str] = None,
server_name: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
opts: Optional[InvokeOptions] = None) -> GetDatabaseResult
def get_database_output(name: Optional[pulumi.Input[str]] = None,
resource_group_name: Optional[pulumi.Input[str]] = None,
server_name: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetDatabaseResult]func LookupDatabase(ctx *Context, args *LookupDatabaseArgs, opts ...InvokeOption) (*LookupDatabaseResult, error)
func LookupDatabaseOutput(ctx *Context, args *LookupDatabaseOutputArgs, opts ...InvokeOption) LookupDatabaseResultOutput> Note: This function is named LookupDatabase in the Go SDK.
public static class GetDatabase
{
public static Task<GetDatabaseResult> InvokeAsync(GetDatabaseArgs args, InvokeOptions? opts = null)
public static Output<GetDatabaseResult> Invoke(GetDatabaseInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetDatabaseResult> getDatabase(GetDatabaseArgs args, InvokeOptions options)
public static Output<GetDatabaseResult> getDatabase(GetDatabaseArgs args, InvokeOptions options)
fn::invoke:
function: azure:sql/getDatabase:getDatabase
arguments:
# arguments dictionaryThe following arguments are supported:
- Name string
- The name of the SQL Database.
- Resource
Group stringName - Specifies the name of the Resource Group where the Azure SQL Database exists.
- Server
Name string - The name of the SQL Server.
- Dictionary<string, string>
- A mapping of tags assigned to the resource.
- Name string
- The name of the SQL Database.
- Resource
Group stringName - Specifies the name of the Resource Group where the Azure SQL Database exists.
- Server
Name string - The name of the SQL Server.
- map[string]string
- A mapping of tags assigned to the resource.
- name String
- The name of the SQL Database.
- resource
Group StringName - Specifies the name of the Resource Group where the Azure SQL Database exists.
- server
Name String - The name of the SQL Server.
- Map<String,String>
- A mapping of tags assigned to the resource.
- name string
- The name of the SQL Database.
- resource
Group stringName - Specifies the name of the Resource Group where the Azure SQL Database exists.
- server
Name string - The name of the SQL Server.
- {[key: string]: string}
- A mapping of tags assigned to the resource.
- name str
- The name of the SQL Database.
- resource_
group_ strname - Specifies the name of the Resource Group where the Azure SQL Database exists.
- server_
name str - The name of the SQL Server.
- Mapping[str, str]
- A mapping of tags assigned to the resource.
- name String
- The name of the SQL Database.
- resource
Group StringName - Specifies the name of the Resource Group where the Azure SQL Database exists.
- server
Name String - The name of the SQL Server.
- Map<String>
- A mapping of tags assigned to the resource.
getDatabase Result
The following output properties are available:
- Collation string
- The name of the collation.
- Default
Secondary stringLocation - The default secondary location of the SQL Database.
- Edition string
- The edition of the database.
- Elastic
Pool stringName - The name of the elastic database pool the database belongs to.
- Failover
Group stringId - The ID of the failover group the database belongs to.
- Id string
- The provider-assigned unique ID for this managed resource.
- Location string
- The location of the Resource Group in which the SQL Server exists.
- Name string
- The name of the database.
- Read
Scale bool - Indicate if read-only connections will be redirected to a high-available replica.
- Resource
Group stringName - The name of the resource group in which the database resides. This will always be the same resource group as the Database Server.
- Server
Name string - The name of the SQL Server on which to create the database.
- Dictionary<string, string>
- A mapping of tags assigned to the resource.
- Collation string
- The name of the collation.
- Default
Secondary stringLocation - The default secondary location of the SQL Database.
- Edition string
- The edition of the database.
- Elastic
Pool stringName - The name of the elastic database pool the database belongs to.
- Failover
Group stringId - The ID of the failover group the database belongs to.
- Id string
- The provider-assigned unique ID for this managed resource.
- Location string
- The location of the Resource Group in which the SQL Server exists.
- Name string
- The name of the database.
- Read
Scale bool - Indicate if read-only connections will be redirected to a high-available replica.
- Resource
Group stringName - The name of the resource group in which the database resides. This will always be the same resource group as the Database Server.
- Server
Name string - The name of the SQL Server on which to create the database.
- map[string]string
- A mapping of tags assigned to the resource.
- collation String
- The name of the collation.
- default
Secondary StringLocation - The default secondary location of the SQL Database.
- edition String
- The edition of the database.
- elastic
Pool StringName - The name of the elastic database pool the database belongs to.
- failover
Group StringId - The ID of the failover group the database belongs to.
- id String
- The provider-assigned unique ID for this managed resource.
- location String
- The location of the Resource Group in which the SQL Server exists.
- name String
- The name of the database.
- read
Scale Boolean - Indicate if read-only connections will be redirected to a high-available replica.
- resource
Group StringName - The name of the resource group in which the database resides. This will always be the same resource group as the Database Server.
- server
Name String - The name of the SQL Server on which to create the database.
- Map<String,String>
- A mapping of tags assigned to the resource.
- collation string
- The name of the collation.
- default
Secondary stringLocation - The default secondary location of the SQL Database.
- edition string
- The edition of the database.
- elastic
Pool stringName - The name of the elastic database pool the database belongs to.
- failover
Group stringId - The ID of the failover group the database belongs to.
- id string
- The provider-assigned unique ID for this managed resource.
- location string
- The location of the Resource Group in which the SQL Server exists.
- name string
- The name of the database.
- read
Scale boolean - Indicate if read-only connections will be redirected to a high-available replica.
- resource
Group stringName - The name of the resource group in which the database resides. This will always be the same resource group as the Database Server.
- server
Name string - The name of the SQL Server on which to create the database.
- {[key: string]: string}
- A mapping of tags assigned to the resource.
- collation str
- The name of the collation.
- default_
secondary_ strlocation - The default secondary location of the SQL Database.
- edition str
- The edition of the database.
- elastic_
pool_ strname - The name of the elastic database pool the database belongs to.
- failover_
group_ strid - The ID of the failover group the database belongs to.
- id str
- The provider-assigned unique ID for this managed resource.
- location str
- The location of the Resource Group in which the SQL Server exists.
- name str
- The name of the database.
- read_
scale bool - Indicate if read-only connections will be redirected to a high-available replica.
- resource_
group_ strname - The name of the resource group in which the database resides. This will always be the same resource group as the Database Server.
- server_
name str - The name of the SQL Server on which to create the database.
- Mapping[str, str]
- A mapping of tags assigned to the resource.
- collation String
- The name of the collation.
- default
Secondary StringLocation - The default secondary location of the SQL Database.
- edition String
- The edition of the database.
- elastic
Pool StringName - The name of the elastic database pool the database belongs to.
- failover
Group StringId - The ID of the failover group the database belongs to.
- id String
- The provider-assigned unique ID for this managed resource.
- location String
- The location of the Resource Group in which the SQL Server exists.
- name String
- The name of the database.
- read
Scale Boolean - Indicate if read-only connections will be redirected to a high-available replica.
- resource
Group StringName - The name of the resource group in which the database resides. This will always be the same resource group as the Database Server.
- server
Name String - The name of the SQL Server on which to create the database.
- Map<String>
- A mapping of tags assigned to the resource.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.
We recommend using Azure Native.
Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
published on Monday, Mar 9, 2026 by Pulumi
