getServer

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

Note: The azure.sql.SqlServer data source is deprecated in version 3.0 of the AzureRM provider and will be removed in version 4.0. Please use the azure.mssql.Server data source instead.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.sql.getServer({
name: "examplesqlservername",
resourceGroupName: "example-resources",
});
export const sqlServerId = example.then(example => example.id);
import pulumi
import pulumi_azure as azure
example = azure.sql.get_server(name="examplesqlservername",
resource_group_name="example-resources")
pulumi.export("sqlServerId", example.id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = Azure.Sql.GetServer.Invoke(new()
{
Name = "examplesqlservername",
ResourceGroupName = "example-resources",
});
return new Dictionary<string, object?>
{
["sqlServerId"] = example.Apply(getServerResult => getServerResult.Id),
};
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/sql"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := sql.GetServer(ctx, &sql.GetServerArgs{
Name: "examplesqlservername",
ResourceGroupName: "example-resources",
}, nil)
if err != nil {
return err
}
ctx.Export("sqlServerId", example.Id)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.sql.SqlFunctions;
import com.pulumi.azure.sql.inputs.GetServerArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var example = SqlFunctions.getServer(GetServerArgs.builder()
.name("examplesqlservername")
.resourceGroupName("example-resources")
.build());
ctx.export("sqlServerId", example.applyValue(getServerResult -> getServerResult.id()));
}
}
variables:
example:
fn::invoke:
Function: azure:sql:getServer
Arguments:
name: examplesqlservername
resourceGroupName: example-resources
outputs:
sqlServerId: ${example.id}

Return

A collection of values returned by getServer.

Parameters

argument

A collection of arguments for invoking getServer.


suspend fun getServer(name: String, resourceGroupName: String): GetServerResult

Return

A collection of values returned by getServer.

Parameters

name

The name of the SQL Server.

resourceGroupName

Specifies the name of the Resource Group where the SQL Server exists.

See also


suspend fun getServer(argument: suspend GetServerPlainArgsBuilder.() -> Unit): GetServerResult

Return

A collection of values returned by getServer.

Parameters

argument

Builder for com.pulumi.azure.sql.kotlin.inputs.GetServerPlainArgs.

See also