1. Packages
  2. Azure Classic
  3. API Docs
  4. sql
  5. getServer

We recommend using Azure Native.

Azure Classic v5.72.0 published on Monday, Apr 15, 2024 by Pulumi

azure.sql.getServer

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.72.0 published on Monday, Apr 15, 2024 by Pulumi

    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)
    
    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
    	})
    }
    
    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 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}
    

    Using getServer

    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 getServer(args: GetServerArgs, opts?: InvokeOptions): Promise<GetServerResult>
    function getServerOutput(args: GetServerOutputArgs, opts?: InvokeOptions): Output<GetServerResult>
    def get_server(name: Optional[str] = None,
                   resource_group_name: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetServerResult
    def get_server_output(name: Optional[pulumi.Input[str]] = None,
                   resource_group_name: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetServerResult]
    func GetServer(ctx *Context, args *GetServerArgs, opts ...InvokeOption) (*GetServerResult, error)
    func GetServerOutput(ctx *Context, args *GetServerOutputArgs, opts ...InvokeOption) GetServerResultOutput

    > Note: This function is named GetServer in the Go SDK.

    public static class GetServer 
    {
        public static Task<GetServerResult> InvokeAsync(GetServerArgs args, InvokeOptions? opts = null)
        public static Output<GetServerResult> Invoke(GetServerInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetServerResult> getServer(GetServerArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: azure:sql/getServer:getServer
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    The name of the SQL Server.
    ResourceGroupName string
    Specifies the name of the Resource Group where the SQL Server exists.
    Name string
    The name of the SQL Server.
    ResourceGroupName string
    Specifies the name of the Resource Group where the SQL Server exists.
    name String
    The name of the SQL Server.
    resourceGroupName String
    Specifies the name of the Resource Group where the SQL Server exists.
    name string
    The name of the SQL Server.
    resourceGroupName string
    Specifies the name of the Resource Group where the SQL Server exists.
    name str
    The name of the SQL Server.
    resource_group_name str
    Specifies the name of the Resource Group where the SQL Server exists.
    name String
    The name of the SQL Server.
    resourceGroupName String
    Specifies the name of the Resource Group where the SQL Server exists.

    getServer Result

    The following output properties are available:

    AdministratorLogin string
    The administrator username of the SQL Server.
    Fqdn string
    The fully qualified domain name of the SQL Server.
    Id string
    The provider-assigned unique ID for this managed resource.
    Identities List<GetServerIdentity>
    An identity block as defined below.
    Location string
    The location of the Resource Group in which the SQL Server exists.
    Name string
    ResourceGroupName string
    Tags Dictionary<string, string>
    A mapping of tags assigned to the resource.
    Version string
    The version of the SQL Server.
    AdministratorLogin string
    The administrator username of the SQL Server.
    Fqdn string
    The fully qualified domain name of the SQL Server.
    Id string
    The provider-assigned unique ID for this managed resource.
    Identities []GetServerIdentity
    An identity block as defined below.
    Location string
    The location of the Resource Group in which the SQL Server exists.
    Name string
    ResourceGroupName string
    Tags map[string]string
    A mapping of tags assigned to the resource.
    Version string
    The version of the SQL Server.
    administratorLogin String
    The administrator username of the SQL Server.
    fqdn String
    The fully qualified domain name of the SQL Server.
    id String
    The provider-assigned unique ID for this managed resource.
    identities List<GetServerIdentity>
    An identity block as defined below.
    location String
    The location of the Resource Group in which the SQL Server exists.
    name String
    resourceGroupName String
    tags Map<String,String>
    A mapping of tags assigned to the resource.
    version String
    The version of the SQL Server.
    administratorLogin string
    The administrator username of the SQL Server.
    fqdn string
    The fully qualified domain name of the SQL Server.
    id string
    The provider-assigned unique ID for this managed resource.
    identities GetServerIdentity[]
    An identity block as defined below.
    location string
    The location of the Resource Group in which the SQL Server exists.
    name string
    resourceGroupName string
    tags {[key: string]: string}
    A mapping of tags assigned to the resource.
    version string
    The version of the SQL Server.
    administrator_login str
    The administrator username of the SQL Server.
    fqdn str
    The fully qualified domain name of the SQL Server.
    id str
    The provider-assigned unique ID for this managed resource.
    identities Sequence[GetServerIdentity]
    An identity block as defined below.
    location str
    The location of the Resource Group in which the SQL Server exists.
    name str
    resource_group_name str
    tags Mapping[str, str]
    A mapping of tags assigned to the resource.
    version str
    The version of the SQL Server.
    administratorLogin String
    The administrator username of the SQL Server.
    fqdn String
    The fully qualified domain name of the SQL Server.
    id String
    The provider-assigned unique ID for this managed resource.
    identities List<Property Map>
    An identity block as defined below.
    location String
    The location of the Resource Group in which the SQL Server exists.
    name String
    resourceGroupName String
    tags Map<String>
    A mapping of tags assigned to the resource.
    version String
    The version of the SQL Server.

    Supporting Types

    GetServerIdentity

    PrincipalId string
    The Principal ID associated with this Managed Service Identity.
    TenantId string
    The Tenant ID associated with this Managed Service Identity.
    Type string
    The identity type of this Managed Service Identity.
    PrincipalId string
    The Principal ID associated with this Managed Service Identity.
    TenantId string
    The Tenant ID associated with this Managed Service Identity.
    Type string
    The identity type of this Managed Service Identity.
    principalId String
    The Principal ID associated with this Managed Service Identity.
    tenantId String
    The Tenant ID associated with this Managed Service Identity.
    type String
    The identity type of this Managed Service Identity.
    principalId string
    The Principal ID associated with this Managed Service Identity.
    tenantId string
    The Tenant ID associated with this Managed Service Identity.
    type string
    The identity type of this Managed Service Identity.
    principal_id str
    The Principal ID associated with this Managed Service Identity.
    tenant_id str
    The Tenant ID associated with this Managed Service Identity.
    type str
    The identity type of this Managed Service Identity.
    principalId String
    The Principal ID associated with this Managed Service Identity.
    tenantId String
    The Tenant ID associated with this Managed Service Identity.
    type String
    The identity type of this Managed Service Identity.

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.72.0 published on Monday, Apr 15, 2024 by Pulumi