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

We recommend using Azure Native.

Azure v6.25.0 published on Wednesday, Aug 13, 2025 by Pulumi

azure.mssql.getFailoverGroup

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure v6.25.0 published on Wednesday, Aug 13, 2025 by Pulumi

    Use this data source to access information about an existing Microsoft Azure SQL Failover Group.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = azure.mssql.getFailoverGroup({
        name: "example",
        serverId: "example-sql-server",
    });
    export const mssqlFailoverGroupId = example.then(example => example.id);
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.mssql.get_failover_group(name="example",
        server_id="example-sql-server")
    pulumi.export("mssqlFailoverGroupId", 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.LookupFailoverGroup(ctx, &mssql.LookupFailoverGroupArgs{
    			Name:     "example",
    			ServerId: "example-sql-server",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("mssqlFailoverGroupId", 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.GetFailoverGroup.Invoke(new()
        {
            Name = "example",
            ServerId = "example-sql-server",
        });
    
        return new Dictionary<string, object?>
        {
            ["mssqlFailoverGroupId"] = example.Apply(getFailoverGroupResult => getFailoverGroupResult.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.GetFailoverGroupArgs;
    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.getFailoverGroup(GetFailoverGroupArgs.builder()
                .name("example")
                .serverId("example-sql-server")
                .build());
    
            ctx.export("mssqlFailoverGroupId", example.id());
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: azure:mssql:getFailoverGroup
          arguments:
            name: example
            serverId: example-sql-server
    outputs:
      mssqlFailoverGroupId: ${example.id}
    

    API Providers

    This data source uses the following Azure API Providers:

    • Microsoft.Sql - 2023-08-01-preview

    Using getFailoverGroup

    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 getFailoverGroup(args: GetFailoverGroupArgs, opts?: InvokeOptions): Promise<GetFailoverGroupResult>
    function getFailoverGroupOutput(args: GetFailoverGroupOutputArgs, opts?: InvokeOptions): Output<GetFailoverGroupResult>
    def get_failover_group(name: Optional[str] = None,
                           server_id: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetFailoverGroupResult
    def get_failover_group_output(name: Optional[pulumi.Input[str]] = None,
                           server_id: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetFailoverGroupResult]
    func LookupFailoverGroup(ctx *Context, args *LookupFailoverGroupArgs, opts ...InvokeOption) (*LookupFailoverGroupResult, error)
    func LookupFailoverGroupOutput(ctx *Context, args *LookupFailoverGroupOutputArgs, opts ...InvokeOption) LookupFailoverGroupResultOutput

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

    public static class GetFailoverGroup 
    {
        public static Task<GetFailoverGroupResult> InvokeAsync(GetFailoverGroupArgs args, InvokeOptions? opts = null)
        public static Output<GetFailoverGroupResult> Invoke(GetFailoverGroupInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetFailoverGroupResult> getFailoverGroup(GetFailoverGroupArgs args, InvokeOptions options)
    public static Output<GetFailoverGroupResult> getFailoverGroup(GetFailoverGroupArgs args, InvokeOptions options)
    
    fn::invoke:
      function: azure:mssql/getFailoverGroup:getFailoverGroup
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    The name of the Failover Group.
    ServerId string
    The ID of the primary SQL Server where the Failover Group exists.
    Name string
    The name of the Failover Group.
    ServerId string
    The ID of the primary SQL Server where the Failover Group exists.
    name String
    The name of the Failover Group.
    serverId String
    The ID of the primary SQL Server where the Failover Group exists.
    name string
    The name of the Failover Group.
    serverId string
    The ID of the primary SQL Server where the Failover Group exists.
    name str
    The name of the Failover Group.
    server_id str
    The ID of the primary SQL Server where the Failover Group exists.
    name String
    The name of the Failover Group.
    serverId String
    The ID of the primary SQL Server where the Failover Group exists.

    getFailoverGroup Result

    The following output properties are available:

    Databases List<string>
    A set of database names in the Failover Group.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    PartnerServers List<GetFailoverGroupPartnerServer>
    A partner_server block as defined below.
    ReadWriteEndpointFailoverPolicies List<GetFailoverGroupReadWriteEndpointFailoverPolicy>
    A read_write_endpoint_failover_policy block as defined below.
    ReadonlyEndpointFailoverPolicyEnabled bool
    Whether failover is enabled for the readonly endpoint.
    ServerId string
    Tags Dictionary<string, string>
    A mapping of tags which are assigned to the resource.
    Databases []string
    A set of database names in the Failover Group.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    PartnerServers []GetFailoverGroupPartnerServer
    A partner_server block as defined below.
    ReadWriteEndpointFailoverPolicies []GetFailoverGroupReadWriteEndpointFailoverPolicy
    A read_write_endpoint_failover_policy block as defined below.
    ReadonlyEndpointFailoverPolicyEnabled bool
    Whether failover is enabled for the readonly endpoint.
    ServerId string
    Tags map[string]string
    A mapping of tags which are assigned to the resource.
    databases List<String>
    A set of database names in the Failover Group.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    partnerServers List<GetFailoverGroupPartnerServer>
    A partner_server block as defined below.
    readWriteEndpointFailoverPolicies List<GetFailoverGroupReadWriteEndpointFailoverPolicy>
    A read_write_endpoint_failover_policy block as defined below.
    readonlyEndpointFailoverPolicyEnabled Boolean
    Whether failover is enabled for the readonly endpoint.
    serverId String
    tags Map<String,String>
    A mapping of tags which are assigned to the resource.
    databases string[]
    A set of database names in the Failover Group.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    partnerServers GetFailoverGroupPartnerServer[]
    A partner_server block as defined below.
    readWriteEndpointFailoverPolicies GetFailoverGroupReadWriteEndpointFailoverPolicy[]
    A read_write_endpoint_failover_policy block as defined below.
    readonlyEndpointFailoverPolicyEnabled boolean
    Whether failover is enabled for the readonly endpoint.
    serverId string
    tags {[key: string]: string}
    A mapping of tags which are assigned to the resource.
    databases Sequence[str]
    A set of database names in the Failover Group.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    partner_servers Sequence[GetFailoverGroupPartnerServer]
    A partner_server block as defined below.
    read_write_endpoint_failover_policies Sequence[GetFailoverGroupReadWriteEndpointFailoverPolicy]
    A read_write_endpoint_failover_policy block as defined below.
    readonly_endpoint_failover_policy_enabled bool
    Whether failover is enabled for the readonly endpoint.
    server_id str
    tags Mapping[str, str]
    A mapping of tags which are assigned to the resource.
    databases List<String>
    A set of database names in the Failover Group.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    partnerServers List<Property Map>
    A partner_server block as defined below.
    readWriteEndpointFailoverPolicies List<Property Map>
    A read_write_endpoint_failover_policy block as defined below.
    readonlyEndpointFailoverPolicyEnabled Boolean
    Whether failover is enabled for the readonly endpoint.
    serverId String
    tags Map<String>
    A mapping of tags which are assigned to the resource.

    Supporting Types

    GetFailoverGroupPartnerServer

    Id string
    The ID of the partner SQL server.
    Location string
    The location of the partner server.
    Role string
    The replication role of the partner server.
    Id string
    The ID of the partner SQL server.
    Location string
    The location of the partner server.
    Role string
    The replication role of the partner server.
    id String
    The ID of the partner SQL server.
    location String
    The location of the partner server.
    role String
    The replication role of the partner server.
    id string
    The ID of the partner SQL server.
    location string
    The location of the partner server.
    role string
    The replication role of the partner server.
    id str
    The ID of the partner SQL server.
    location str
    The location of the partner server.
    role str
    The replication role of the partner server.
    id String
    The ID of the partner SQL server.
    location String
    The location of the partner server.
    role String
    The replication role of the partner server.

    GetFailoverGroupReadWriteEndpointFailoverPolicy

    GraceMinutes int
    The grace period in minutes, before failover with data loss is attempted for the read-write endpoint.
    Mode string
    The failover policy of the read-write endpoint for the Failover Group.
    GraceMinutes int
    The grace period in minutes, before failover with data loss is attempted for the read-write endpoint.
    Mode string
    The failover policy of the read-write endpoint for the Failover Group.
    graceMinutes Integer
    The grace period in minutes, before failover with data loss is attempted for the read-write endpoint.
    mode String
    The failover policy of the read-write endpoint for the Failover Group.
    graceMinutes number
    The grace period in minutes, before failover with data loss is attempted for the read-write endpoint.
    mode string
    The failover policy of the read-write endpoint for the Failover Group.
    grace_minutes int
    The grace period in minutes, before failover with data loss is attempted for the read-write endpoint.
    mode str
    The failover policy of the read-write endpoint for the Failover Group.
    graceMinutes Number
    The grace period in minutes, before failover with data loss is attempted for the read-write endpoint.
    mode String
    The failover policy of the read-write endpoint for the Failover Group.

    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 v6.25.0 published on Wednesday, Aug 13, 2025 by Pulumi