We recommend using Azure Native.
Azure v6.21.0 published on Friday, Mar 7, 2025 by Pulumi
azure.mssql.getServer
Explore with Pulumi AI
Use this data source to access information about an existing Microsoft SQL Server.
Example Usage
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)
package main
import (
	"github.com/pulumi/pulumi-azure/sdk/v6/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
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() => 
{
    var example = Azure.MSSql.GetServer.Invoke(new()
    {
        Name = "existingMsSqlServer",
        ResourceGroupName = "existingResGroup",
    });
    return new Dictionary<string, object?>
    {
        ["id"] = 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.mssql.MssqlFunctions;
import com.pulumi.azure.mssql.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 = MssqlFunctions.getServer(GetServerArgs.builder()
            .name("existingMsSqlServer")
            .resourceGroupName("existingResGroup")
            .build());
        ctx.export("id", example.applyValue(getServerResult -> getServerResult.id()));
    }
}
variables:
  example:
    fn::invoke:
      function: azure:mssql:getServer
      arguments:
        name: existingMsSqlServer
        resourceGroupName: existingResGroup
outputs:
  id: ${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 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 dictionaryThe following arguments are supported:
- Name string
- The name of this Microsoft SQL Server.
- ResourceGroup stringName 
- The name of the Resource Group where the Microsoft SQL Server exists.
- Name string
- The name of this Microsoft SQL Server.
- ResourceGroup stringName 
- The name of the Resource Group where the Microsoft SQL Server exists.
- name String
- The name of this Microsoft SQL Server.
- resourceGroup StringName 
- The name of the Resource Group where the Microsoft SQL Server exists.
- name string
- The name of this Microsoft SQL Server.
- resourceGroup stringName 
- The name of the Resource Group where the Microsoft SQL Server exists.
- name str
- The name of this Microsoft SQL Server.
- resource_group_ strname 
- The name of the Resource Group where the Microsoft SQL Server exists.
- name String
- The name of this Microsoft SQL Server.
- resourceGroup StringName 
- 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.
- FullyQualified stringDomain Name 
- The fully qualified domain name of the Azure SQL Server.
- Id string
- The provider-assigned unique ID for this managed resource.
- Identities
List<GetServer Identity> 
- A identityblock as defined below.
- Location string
- The Azure Region where the Microsoft SQL Server exists.
- Name string
- ResourceGroup stringName 
- RestorableDropped List<string>Database Ids 
- A list of dropped restorable database IDs on the server.
- Dictionary<string, string>
- A mapping of tags assigned to this Microsoft SQL Server.
- TransparentData stringEncryption Key Vault Key Id 
- The Key Vault key URI to be used as the Customer Managed Key(CMK/BYOK) for theTransparent Data Encryption(TDE) layer.
- Version string
- This servers MS SQL version.
- AdministratorLogin string
- The server's administrator login name.
- FullyQualified stringDomain Name 
- The fully qualified domain name of the Azure SQL Server.
- Id string
- The provider-assigned unique ID for this managed resource.
- Identities
[]GetServer Identity 
- A identityblock as defined below.
- Location string
- The Azure Region where the Microsoft SQL Server exists.
- Name string
- ResourceGroup stringName 
- RestorableDropped []stringDatabase Ids 
- A list of dropped restorable database IDs on the server.
- map[string]string
- A mapping of tags assigned to this Microsoft SQL Server.
- TransparentData stringEncryption Key Vault Key Id 
- The Key Vault key URI to be used as the Customer Managed Key(CMK/BYOK) for theTransparent Data Encryption(TDE) layer.
- Version string
- This servers MS SQL version.
- administratorLogin String
- The server's administrator login name.
- fullyQualified StringDomain Name 
- The fully qualified domain name of the Azure SQL Server.
- id String
- The provider-assigned unique ID for this managed resource.
- identities
List<GetServer Identity> 
- A identityblock as defined below.
- location String
- The Azure Region where the Microsoft SQL Server exists.
- name String
- resourceGroup StringName 
- restorableDropped List<String>Database Ids 
- A list of dropped restorable database IDs on the server.
- Map<String,String>
- A mapping of tags assigned to this Microsoft SQL Server.
- transparentData StringEncryption Key Vault Key Id 
- The Key Vault key URI to be used as the Customer Managed Key(CMK/BYOK) for theTransparent Data Encryption(TDE) layer.
- version String
- This servers MS SQL version.
- administratorLogin string
- The server's administrator login name.
- fullyQualified stringDomain Name 
- The fully qualified domain name of the Azure SQL Server.
- id string
- The provider-assigned unique ID for this managed resource.
- identities
GetServer Identity[] 
- A identityblock as defined below.
- location string
- The Azure Region where the Microsoft SQL Server exists.
- name string
- resourceGroup stringName 
- restorableDropped string[]Database Ids 
- A list of dropped restorable database IDs on the server.
- {[key: string]: string}
- A mapping of tags assigned to this Microsoft SQL Server.
- transparentData stringEncryption Key Vault Key Id 
- The Key Vault key URI to be used as the Customer Managed Key(CMK/BYOK) for theTransparent Data Encryption(TDE) layer.
- version string
- This servers MS SQL version.
- administrator_login str
- The server's administrator login name.
- fully_qualified_ strdomain_ name 
- The fully qualified domain name of the Azure SQL Server.
- id str
- The provider-assigned unique ID for this managed resource.
- identities
Sequence[GetServer Identity] 
- A identityblock as defined below.
- location str
- The Azure Region where the Microsoft SQL Server exists.
- name str
- resource_group_ strname 
- restorable_dropped_ Sequence[str]database_ ids 
- A list of dropped restorable database IDs on the server.
- Mapping[str, str]
- A mapping of tags assigned to this Microsoft SQL Server.
- transparent_data_ strencryption_ key_ vault_ key_ id 
- The Key Vault key URI to be used as the Customer Managed Key(CMK/BYOK) for theTransparent Data Encryption(TDE) layer.
- version str
- This servers MS SQL version.
- administratorLogin String
- The server's administrator login name.
- fullyQualified StringDomain Name 
- 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 identityblock as defined below.
- location String
- The Azure Region where the Microsoft SQL Server exists.
- name String
- resourceGroup StringName 
- restorableDropped List<String>Database Ids 
- A list of dropped restorable database IDs on the server.
- Map<String>
- A mapping of tags assigned to this Microsoft SQL Server.
- transparentData StringEncryption Key Vault Key Id 
- The Key Vault key URI to be used as the Customer Managed Key(CMK/BYOK) for theTransparent Data Encryption(TDE) layer.
- version String
- This servers MS SQL version.
Supporting Types
GetServerIdentity  
- IdentityIds List<string>
- The list of User Assigned Managed Identity IDs assigned to this Microsoft SQL Server.
- PrincipalId string
- The Principal ID of the System Assigned Managed Service Identity that is configured on this Microsoft SQL Server.
- TenantId string
- The Tenant ID of the System Assigned Managed Service Identity that is configured on this Microsoft SQL Server.
- Type string
- The type of Managed Service Identity that is configured on this Microsoft SQL Server.
- IdentityIds []string
- The list of User Assigned Managed Identity IDs assigned to this Microsoft SQL Server.
- PrincipalId string
- The Principal ID of the System Assigned Managed Service Identity that is configured on this Microsoft SQL Server.
- TenantId string
- The Tenant ID of the System Assigned Managed Service Identity that is configured on this Microsoft SQL Server.
- Type string
- The type of Managed Service Identity that is configured on this Microsoft SQL Server.
- identityIds List<String>
- The list of User Assigned Managed Identity IDs assigned to this Microsoft SQL Server.
- principalId String
- The Principal ID of the System Assigned Managed Service Identity that is configured on this Microsoft SQL Server.
- tenantId String
- The Tenant ID of the System Assigned Managed Service Identity that is configured on this Microsoft SQL Server.
- type String
- The type of Managed Service Identity that is configured on this Microsoft SQL Server.
- identityIds string[]
- The list of User Assigned Managed Identity IDs assigned to this Microsoft SQL Server.
- principalId string
- The Principal ID of the System Assigned Managed Service Identity that is configured on this Microsoft SQL Server.
- tenantId string
- The Tenant ID of the System Assigned Managed Service Identity that is configured on this Microsoft SQL Server.
- type string
- The type of Managed Service Identity that is configured on this Microsoft SQL Server.
- identity_ids Sequence[str]
- The list of User Assigned Managed Identity IDs assigned to this Microsoft SQL Server.
- principal_id str
- The Principal ID of the System Assigned Managed Service Identity that is configured on this Microsoft SQL Server.
- tenant_id str
- The Tenant ID of the System Assigned Managed Service Identity that is configured on this Microsoft SQL Server.
- type str
- The type of Managed Service Identity that is configured on this Microsoft SQL Server.
- identityIds List<String>
- The list of User Assigned Managed Identity IDs assigned to this Microsoft SQL Server.
- principalId String
- The Principal ID of the System Assigned Managed Service Identity that is configured on this Microsoft SQL Server.
- tenantId String
- The Tenant ID of the System Assigned Managed Service Identity that is configured on this Microsoft SQL Server.
- type String
- The type of Managed Service Identity that is configured on this Microsoft SQL Server.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the azurermTerraform Provider.