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

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
azure logo

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

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

    Example Usage

    using Pulumi;
    using Azure = Pulumi.Azure;
    
    class MyStack : Stack
    {
        public MyStack()
        {
            var example = Output.Create(Azure.MSSql.GetServer.InvokeAsync(new Azure.MSSql.GetServerArgs
            {
                Name = "existingMsSqlServer",
                ResourceGroupName = "existingResGroup",
            }));
            this.Id = example.Apply(example => example.Id);
        }
    
        [Output("id")]
        public Output<string> Id { get; set; }
    }
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/mssql"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := mssql.LookupServer(ctx, &mssql.LookupServerArgs{
    			Name:              "existingMsSqlServer",
    			ResourceGroupName: "existingResGroup",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("id", example.Id)
    		return nil
    	})
    }
    

    Example coming soon!

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = azure.mssql.getServer({
        name: "existingMsSqlServer",
        resourceGroupName: "existingResGroup",
    });
    export const id = example.then(example => example.id);
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.mssql.get_server(name="existingMsSqlServer",
        resource_group_name="existingResGroup")
    pulumi.export("id", example.id)
    

    Example coming soon!

    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 LookupServer(ctx *Context, args *LookupServerArgs, opts ...InvokeOption) (*LookupServerResult, error)
    func LookupServerOutput(ctx *Context, args *LookupServerOutputArgs, opts ...InvokeOption) LookupServerResultOutput

    > Note: This function is named LookupServer 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)
    public static Output<GetServerResult> getServer(GetServerArgs args, InvokeOptions options)
    
    fn::invoke:
      function: azure:mssql/getServer:getServer
      arguments:
        # arguments dictionary

    The following arguments are supported:

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

    getServer Result

    The following output properties are available:

    AdministratorLogin string
    The server's administrator login name.
    FullyQualifiedDomainName string
    The fully qualified domain name of the Azure SQL Server.
    Id string
    The provider-assigned unique ID for this managed resource.
    Identities List<GetServerIdentity>
    A identity block as defined below.
    Location string
    The Azure Region where the Microsoft SQL Server exists.
    Name string
    ResourceGroupName string
    RestorableDroppedDatabaseIds List<string>
    A list of dropped restorable database IDs on the server.
    Tags Dictionary<string, string>
    A mapping of tags assigned to this Microsoft SQL Server.
    Version string
    This servers MS SQL version.
    AdministratorLogin string
    The server's administrator login name.
    FullyQualifiedDomainName string
    The fully qualified domain name of the Azure SQL Server.
    Id string
    The provider-assigned unique ID for this managed resource.
    Identities []GetServerIdentity
    A identity block as defined below.
    Location string
    The Azure Region where the Microsoft SQL Server exists.
    Name string
    ResourceGroupName string
    RestorableDroppedDatabaseIds []string
    A list of dropped restorable database IDs on the server.
    Tags map[string]string
    A mapping of tags assigned to this Microsoft SQL Server.
    Version string
    This servers MS SQL version.
    administratorLogin String
    The server's administrator login name.
    fullyQualifiedDomainName String
    The fully qualified domain name of the Azure SQL Server.
    id String
    The provider-assigned unique ID for this managed resource.
    identities List<GetServerIdentity>
    A identity block as defined below.
    location String
    The Azure Region where the Microsoft SQL Server exists.
    name String
    resourceGroupName String
    restorableDroppedDatabaseIds List<String>
    A list of dropped restorable database IDs on the server.
    tags Map<String,String>
    A mapping of tags assigned to this Microsoft SQL Server.
    version String
    This servers MS SQL version.
    administratorLogin string
    The server's administrator login name.
    fullyQualifiedDomainName string
    The fully qualified domain name of the Azure SQL Server.
    id string
    The provider-assigned unique ID for this managed resource.
    identities GetServerIdentity[]
    A identity block as defined below.
    location string
    The Azure Region where the Microsoft SQL Server exists.
    name string
    resourceGroupName string
    restorableDroppedDatabaseIds string[]
    A list of dropped restorable database IDs on the server.
    tags {[key: string]: string}
    A mapping of tags assigned to this Microsoft SQL Server.
    version string
    This servers MS SQL version.
    administrator_login str
    The server's administrator login name.
    fully_qualified_domain_name str
    The fully qualified domain name of the Azure SQL Server.
    id str
    The provider-assigned unique ID for this managed resource.
    identities Sequence[GetServerIdentity]
    A identity block as defined below.
    location str
    The Azure Region where the Microsoft SQL Server exists.
    name str
    resource_group_name str
    restorable_dropped_database_ids Sequence[str]
    A list of dropped restorable database IDs on the server.
    tags Mapping[str, str]
    A mapping of tags assigned to this Microsoft SQL Server.
    version str
    This servers MS SQL version.
    administratorLogin String
    The server's administrator login name.
    fullyQualifiedDomainName String
    The fully qualified domain name of the Azure SQL Server.
    id String
    The provider-assigned unique ID for this managed resource.
    identities List<Property Map>
    A identity block as defined below.
    location String
    The Azure Region where the Microsoft SQL Server exists.
    name String
    resourceGroupName String
    restorableDroppedDatabaseIds List<String>
    A list of dropped restorable database IDs on the server.
    tags Map<String>
    A mapping of tags assigned to this Microsoft SQL Server.
    version String
    This servers MS SQL version.

    Supporting Types

    GetServerIdentity

    PrincipalId string
    The Principal ID for the Service Principal associated with the Identity of this SQL Server.
    TenantId string
    The Tenant ID for the Service Principal associated with the Identity of this SQL Server.
    Type string
    The identity type of the Microsoft SQL Server.
    UserAssignedIdentityIds List<string>
    A list of the User Assigned Identities of this SQL Server.
    PrincipalId string
    The Principal ID for the Service Principal associated with the Identity of this SQL Server.
    TenantId string
    The Tenant ID for the Service Principal associated with the Identity of this SQL Server.
    Type string
    The identity type of the Microsoft SQL Server.
    UserAssignedIdentityIds []string
    A list of the User Assigned Identities of this SQL Server.
    principalId String
    The Principal ID for the Service Principal associated with the Identity of this SQL Server.
    tenantId String
    The Tenant ID for the Service Principal associated with the Identity of this SQL Server.
    type String
    The identity type of the Microsoft SQL Server.
    userAssignedIdentityIds List<String>
    A list of the User Assigned Identities of this SQL Server.
    principalId string
    The Principal ID for the Service Principal associated with the Identity of this SQL Server.
    tenantId string
    The Tenant ID for the Service Principal associated with the Identity of this SQL Server.
    type string
    The identity type of the Microsoft SQL Server.
    userAssignedIdentityIds string[]
    A list of the User Assigned Identities of this SQL Server.
    principal_id str
    The Principal ID for the Service Principal associated with the Identity of this SQL Server.
    tenant_id str
    The Tenant ID for the Service Principal associated with the Identity of this SQL Server.
    type str
    The identity type of the Microsoft SQL Server.
    user_assigned_identity_ids Sequence[str]
    A list of the User Assigned Identities of this SQL Server.
    principalId String
    The Principal ID for the Service Principal associated with the Identity of this SQL Server.
    tenantId String
    The Tenant ID for the Service Principal associated with the Identity of this SQL Server.
    type String
    The identity type of the Microsoft SQL Server.
    userAssignedIdentityIds List<String>
    A list of the User Assigned Identities of this SQL Server.

    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.

    Viewing docs for Azure v4.42.0 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.