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

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.mssql.ManagedInstanceFailoverGroup

Explore with Pulumi AI

Manages an Azure SQL Managed Instance Failover Group.

Example Usage

Note: For a more complete example, see the ./examples/sql-azure/managed_instance_failover_group directory within the GitHub Repository.

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const name = "mymssqlmitest";
const primaryName = `${name}-primary`;
const primaryLocation = "West Europe";
const failoverName = `${name}-failover`;
const failoverLocation = "North Europe";
//# Primary SQL Managed Instance
const primary = new azure.core.ResourceGroup("primary", {
    name: primaryName,
    location: primaryLocation,
});
const exampleZone = new azure.privatedns.Zone("example", {
    name: `${name}.private`,
    resourceGroupName: primary.name,
});
const primaryVirtualNetwork = new azure.network.VirtualNetwork("primary", {
    name: primaryName,
    location: primary.location,
    resourceGroupName: primary.name,
    addressSpaces: ["10.0.0.0/16"],
});
const primaryZoneVirtualNetworkLink = new azure.privatedns.ZoneVirtualNetworkLink("primary", {
    name: "primary-link",
    resourceGroupName: primary.name,
    privateDnsZoneName: exampleZone.name,
    virtualNetworkId: primaryVirtualNetwork.id,
});
const primarySubnet = new azure.network.Subnet("primary", {
    name: primaryName,
    resourceGroupName: primary.name,
    virtualNetworkName: primaryVirtualNetwork.name,
    addressPrefixes: ["10.0.1.0/24"],
    delegations: [{
        name: "delegation",
        serviceDelegation: {
            actions: [
                "Microsoft.Network/virtualNetworks/subnets/join/action",
                "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
                "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action",
            ],
            name: "Microsoft.Sql/managedInstances",
        },
    }],
});
const primaryNetworkSecurityGroup = new azure.network.NetworkSecurityGroup("primary", {
    name: primaryName,
    location: primary.location,
    resourceGroupName: primary.name,
});
const primarySubnetNetworkSecurityGroupAssociation = new azure.network.SubnetNetworkSecurityGroupAssociation("primary", {
    subnetId: primarySubnet.id,
    networkSecurityGroupId: primaryNetworkSecurityGroup.id,
});
const primaryRouteTable = new azure.network.RouteTable("primary", {
    name: primaryName,
    location: primary.location,
    resourceGroupName: primary.name,
});
const primarySubnetRouteTableAssociation = new azure.network.SubnetRouteTableAssociation("primary", {
    subnetId: primarySubnet.id,
    routeTableId: primaryRouteTable.id,
});
const primaryManagedInstance = new azure.mssql.ManagedInstance("primary", {
    name: primaryName,
    resourceGroupName: primary.name,
    location: primary.location,
    administratorLogin: "mradministrator",
    administratorLoginPassword: "thisIsDog11",
    licenseType: "BasePrice",
    subnetId: primarySubnet.id,
    skuName: "GP_Gen5",
    vcores: 4,
    storageSizeInGb: 32,
}, {
    dependsOn: [
        primarySubnetNetworkSecurityGroupAssociation,
        primarySubnetRouteTableAssociation,
    ],
});
//# Secondary (Fail-over) SQL Managed Instance
const failover = new azure.core.ResourceGroup("failover", {
    name: failoverName,
    location: failoverLocation,
});
const failoverVirtualNetwork = new azure.network.VirtualNetwork("failover", {
    name: failoverName,
    location: failover.location,
    resourceGroupName: failover.name,
    addressSpaces: ["10.1.0.0/16"],
});
const failoverZoneVirtualNetworkLink = new azure.privatedns.ZoneVirtualNetworkLink("failover", {
    name: "failover-link",
    resourceGroupName: exampleZone.resourceGroupName,
    privateDnsZoneName: exampleZone.name,
    virtualNetworkId: failoverVirtualNetwork.id,
});
const failoverSubnet = new azure.network.Subnet("failover", {
    name: "ManagedInstance",
    resourceGroupName: failover.name,
    virtualNetworkName: failoverVirtualNetwork.name,
    addressPrefixes: ["10.1.1.0/24"],
    delegations: [{
        name: "delegation",
        serviceDelegation: {
            actions: [
                "Microsoft.Network/virtualNetworks/subnets/join/action",
                "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
                "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action",
            ],
            name: "Microsoft.Sql/managedInstances",
        },
    }],
});
const failoverNetworkSecurityGroup = new azure.network.NetworkSecurityGroup("failover", {
    name: failoverName,
    location: failover.location,
    resourceGroupName: failover.name,
});
const failoverSubnetNetworkSecurityGroupAssociation = new azure.network.SubnetNetworkSecurityGroupAssociation("failover", {
    subnetId: failoverSubnet.id,
    networkSecurityGroupId: failoverNetworkSecurityGroup.id,
});
const failoverRouteTable = new azure.network.RouteTable("failover", {
    name: failoverName,
    location: failover.location,
    resourceGroupName: failover.name,
});
const failoverSubnetRouteTableAssociation = new azure.network.SubnetRouteTableAssociation("failover", {
    subnetId: failoverSubnet.id,
    routeTableId: failoverRouteTable.id,
});
const failoverManagedInstance = new azure.mssql.ManagedInstance("failover", {
    name: failoverName,
    resourceGroupName: failover.name,
    location: failover.location,
    administratorLogin: "mradministrator",
    administratorLoginPassword: "thisIsDog11",
    licenseType: "BasePrice",
    subnetId: failoverSubnet.id,
    skuName: "GP_Gen5",
    vcores: 4,
    storageSizeInGb: 32,
    dnsZonePartnerId: primaryManagedInstance.id,
}, {
    dependsOn: [
        failoverSubnetNetworkSecurityGroupAssociation,
        failoverSubnetRouteTableAssociation,
    ],
});
const example = new azure.mssql.ManagedInstanceFailoverGroup("example", {
    name: "example-failover-group",
    location: primaryManagedInstance.location,
    managedInstanceId: primaryManagedInstance.id,
    partnerManagedInstanceId: failoverManagedInstance.id,
    secondaryType: "Geo",
    readWriteEndpointFailoverPolicy: {
        mode: "Automatic",
        graceMinutes: 60,
    },
}, {
    dependsOn: [
        primaryZoneVirtualNetworkLink,
        failoverZoneVirtualNetworkLink,
    ],
});
const primaryToFailover = new azure.network.VirtualNetworkPeering("primary_to_failover", {
    name: "primary-to-failover",
    remoteVirtualNetworkId: failoverVirtualNetwork.id,
    resourceGroupName: primary.name,
    virtualNetworkName: primaryVirtualNetwork.name,
});
const _default = new azure.network.Subnet("default", {
    name: "default",
    resourceGroupName: failover.name,
    virtualNetworkName: failoverVirtualNetwork.name,
    addressPrefixes: ["10.1.0.0/24"],
});
const failoverToPrimary = new azure.network.VirtualNetworkPeering("failover_to_primary", {
    name: "failover-to-primary",
    remoteVirtualNetworkId: primaryVirtualNetwork.id,
    resourceGroupName: failover.name,
    virtualNetworkName: failoverVirtualNetwork.name,
});
Copy
import pulumi
import pulumi_azure as azure

name = "mymssqlmitest"
primary_name = f"{name}-primary"
primary_location = "West Europe"
failover_name = f"{name}-failover"
failover_location = "North Europe"
## Primary SQL Managed Instance
primary = azure.core.ResourceGroup("primary",
    name=primary_name,
    location=primary_location)
example_zone = azure.privatedns.Zone("example",
    name=f"{name}.private",
    resource_group_name=primary.name)
primary_virtual_network = azure.network.VirtualNetwork("primary",
    name=primary_name,
    location=primary.location,
    resource_group_name=primary.name,
    address_spaces=["10.0.0.0/16"])
primary_zone_virtual_network_link = azure.privatedns.ZoneVirtualNetworkLink("primary",
    name="primary-link",
    resource_group_name=primary.name,
    private_dns_zone_name=example_zone.name,
    virtual_network_id=primary_virtual_network.id)
primary_subnet = azure.network.Subnet("primary",
    name=primary_name,
    resource_group_name=primary.name,
    virtual_network_name=primary_virtual_network.name,
    address_prefixes=["10.0.1.0/24"],
    delegations=[{
        "name": "delegation",
        "service_delegation": {
            "actions": [
                "Microsoft.Network/virtualNetworks/subnets/join/action",
                "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
                "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action",
            ],
            "name": "Microsoft.Sql/managedInstances",
        },
    }])
primary_network_security_group = azure.network.NetworkSecurityGroup("primary",
    name=primary_name,
    location=primary.location,
    resource_group_name=primary.name)
primary_subnet_network_security_group_association = azure.network.SubnetNetworkSecurityGroupAssociation("primary",
    subnet_id=primary_subnet.id,
    network_security_group_id=primary_network_security_group.id)
primary_route_table = azure.network.RouteTable("primary",
    name=primary_name,
    location=primary.location,
    resource_group_name=primary.name)
primary_subnet_route_table_association = azure.network.SubnetRouteTableAssociation("primary",
    subnet_id=primary_subnet.id,
    route_table_id=primary_route_table.id)
primary_managed_instance = azure.mssql.ManagedInstance("primary",
    name=primary_name,
    resource_group_name=primary.name,
    location=primary.location,
    administrator_login="mradministrator",
    administrator_login_password="thisIsDog11",
    license_type="BasePrice",
    subnet_id=primary_subnet.id,
    sku_name="GP_Gen5",
    vcores=4,
    storage_size_in_gb=32,
    opts = pulumi.ResourceOptions(depends_on=[
            primary_subnet_network_security_group_association,
            primary_subnet_route_table_association,
        ]))
## Secondary (Fail-over) SQL Managed Instance
failover = azure.core.ResourceGroup("failover",
    name=failover_name,
    location=failover_location)
failover_virtual_network = azure.network.VirtualNetwork("failover",
    name=failover_name,
    location=failover.location,
    resource_group_name=failover.name,
    address_spaces=["10.1.0.0/16"])
failover_zone_virtual_network_link = azure.privatedns.ZoneVirtualNetworkLink("failover",
    name="failover-link",
    resource_group_name=example_zone.resource_group_name,
    private_dns_zone_name=example_zone.name,
    virtual_network_id=failover_virtual_network.id)
failover_subnet = azure.network.Subnet("failover",
    name="ManagedInstance",
    resource_group_name=failover.name,
    virtual_network_name=failover_virtual_network.name,
    address_prefixes=["10.1.1.0/24"],
    delegations=[{
        "name": "delegation",
        "service_delegation": {
            "actions": [
                "Microsoft.Network/virtualNetworks/subnets/join/action",
                "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
                "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action",
            ],
            "name": "Microsoft.Sql/managedInstances",
        },
    }])
failover_network_security_group = azure.network.NetworkSecurityGroup("failover",
    name=failover_name,
    location=failover.location,
    resource_group_name=failover.name)
failover_subnet_network_security_group_association = azure.network.SubnetNetworkSecurityGroupAssociation("failover",
    subnet_id=failover_subnet.id,
    network_security_group_id=failover_network_security_group.id)
failover_route_table = azure.network.RouteTable("failover",
    name=failover_name,
    location=failover.location,
    resource_group_name=failover.name)
failover_subnet_route_table_association = azure.network.SubnetRouteTableAssociation("failover",
    subnet_id=failover_subnet.id,
    route_table_id=failover_route_table.id)
failover_managed_instance = azure.mssql.ManagedInstance("failover",
    name=failover_name,
    resource_group_name=failover.name,
    location=failover.location,
    administrator_login="mradministrator",
    administrator_login_password="thisIsDog11",
    license_type="BasePrice",
    subnet_id=failover_subnet.id,
    sku_name="GP_Gen5",
    vcores=4,
    storage_size_in_gb=32,
    dns_zone_partner_id=primary_managed_instance.id,
    opts = pulumi.ResourceOptions(depends_on=[
            failover_subnet_network_security_group_association,
            failover_subnet_route_table_association,
        ]))
example = azure.mssql.ManagedInstanceFailoverGroup("example",
    name="example-failover-group",
    location=primary_managed_instance.location,
    managed_instance_id=primary_managed_instance.id,
    partner_managed_instance_id=failover_managed_instance.id,
    secondary_type="Geo",
    read_write_endpoint_failover_policy={
        "mode": "Automatic",
        "grace_minutes": 60,
    },
    opts = pulumi.ResourceOptions(depends_on=[
            primary_zone_virtual_network_link,
            failover_zone_virtual_network_link,
        ]))
primary_to_failover = azure.network.VirtualNetworkPeering("primary_to_failover",
    name="primary-to-failover",
    remote_virtual_network_id=failover_virtual_network.id,
    resource_group_name=primary.name,
    virtual_network_name=primary_virtual_network.name)
default = azure.network.Subnet("default",
    name="default",
    resource_group_name=failover.name,
    virtual_network_name=failover_virtual_network.name,
    address_prefixes=["10.1.0.0/24"])
failover_to_primary = azure.network.VirtualNetworkPeering("failover_to_primary",
    name="failover-to-primary",
    remote_virtual_network_id=primary_virtual_network.id,
    resource_group_name=failover.name,
    virtual_network_name=failover_virtual_network.name)
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/mssql"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/network"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/privatedns"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		name := "mymssqlmitest"
		primaryName := fmt.Sprintf("%v-primary", name)
		primaryLocation := "West Europe"
		failoverName := fmt.Sprintf("%v-failover", name)
		failoverLocation := "North Europe"
		// # Primary SQL Managed Instance
		primary, err := core.NewResourceGroup(ctx, "primary", &core.ResourceGroupArgs{
			Name:     pulumi.String(primaryName),
			Location: pulumi.String(primaryLocation),
		})
		if err != nil {
			return err
		}
		exampleZone, err := privatedns.NewZone(ctx, "example", &privatedns.ZoneArgs{
			Name:              pulumi.Sprintf("%v.private", name),
			ResourceGroupName: primary.Name,
		})
		if err != nil {
			return err
		}
		primaryVirtualNetwork, err := network.NewVirtualNetwork(ctx, "primary", &network.VirtualNetworkArgs{
			Name:              pulumi.String(primaryName),
			Location:          primary.Location,
			ResourceGroupName: primary.Name,
			AddressSpaces: pulumi.StringArray{
				pulumi.String("10.0.0.0/16"),
			},
		})
		if err != nil {
			return err
		}
		primaryZoneVirtualNetworkLink, err := privatedns.NewZoneVirtualNetworkLink(ctx, "primary", &privatedns.ZoneVirtualNetworkLinkArgs{
			Name:               pulumi.String("primary-link"),
			ResourceGroupName:  primary.Name,
			PrivateDnsZoneName: exampleZone.Name,
			VirtualNetworkId:   primaryVirtualNetwork.ID(),
		})
		if err != nil {
			return err
		}
		primarySubnet, err := network.NewSubnet(ctx, "primary", &network.SubnetArgs{
			Name:               pulumi.String(primaryName),
			ResourceGroupName:  primary.Name,
			VirtualNetworkName: primaryVirtualNetwork.Name,
			AddressPrefixes: pulumi.StringArray{
				pulumi.String("10.0.1.0/24"),
			},
			Delegations: network.SubnetDelegationArray{
				&network.SubnetDelegationArgs{
					Name: pulumi.String("delegation"),
					ServiceDelegation: &network.SubnetDelegationServiceDelegationArgs{
						Actions: pulumi.StringArray{
							pulumi.String("Microsoft.Network/virtualNetworks/subnets/join/action"),
							pulumi.String("Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action"),
							pulumi.String("Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action"),
						},
						Name: pulumi.String("Microsoft.Sql/managedInstances"),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		primaryNetworkSecurityGroup, err := network.NewNetworkSecurityGroup(ctx, "primary", &network.NetworkSecurityGroupArgs{
			Name:              pulumi.String(primaryName),
			Location:          primary.Location,
			ResourceGroupName: primary.Name,
		})
		if err != nil {
			return err
		}
		primarySubnetNetworkSecurityGroupAssociation, err := network.NewSubnetNetworkSecurityGroupAssociation(ctx, "primary", &network.SubnetNetworkSecurityGroupAssociationArgs{
			SubnetId:               primarySubnet.ID(),
			NetworkSecurityGroupId: primaryNetworkSecurityGroup.ID(),
		})
		if err != nil {
			return err
		}
		primaryRouteTable, err := network.NewRouteTable(ctx, "primary", &network.RouteTableArgs{
			Name:              pulumi.String(primaryName),
			Location:          primary.Location,
			ResourceGroupName: primary.Name,
		})
		if err != nil {
			return err
		}
		primarySubnetRouteTableAssociation, err := network.NewSubnetRouteTableAssociation(ctx, "primary", &network.SubnetRouteTableAssociationArgs{
			SubnetId:     primarySubnet.ID(),
			RouteTableId: primaryRouteTable.ID(),
		})
		if err != nil {
			return err
		}
		primaryManagedInstance, err := mssql.NewManagedInstance(ctx, "primary", &mssql.ManagedInstanceArgs{
			Name:                       pulumi.String(primaryName),
			ResourceGroupName:          primary.Name,
			Location:                   primary.Location,
			AdministratorLogin:         pulumi.String("mradministrator"),
			AdministratorLoginPassword: pulumi.String("thisIsDog11"),
			LicenseType:                pulumi.String("BasePrice"),
			SubnetId:                   primarySubnet.ID(),
			SkuName:                    pulumi.String("GP_Gen5"),
			Vcores:                     pulumi.Int(4),
			StorageSizeInGb:            pulumi.Int(32),
		}, pulumi.DependsOn([]pulumi.Resource{
			primarySubnetNetworkSecurityGroupAssociation,
			primarySubnetRouteTableAssociation,
		}))
		if err != nil {
			return err
		}
		// # Secondary (Fail-over) SQL Managed Instance
		failover, err := core.NewResourceGroup(ctx, "failover", &core.ResourceGroupArgs{
			Name:     pulumi.String(failoverName),
			Location: pulumi.String(failoverLocation),
		})
		if err != nil {
			return err
		}
		failoverVirtualNetwork, err := network.NewVirtualNetwork(ctx, "failover", &network.VirtualNetworkArgs{
			Name:              pulumi.String(failoverName),
			Location:          failover.Location,
			ResourceGroupName: failover.Name,
			AddressSpaces: pulumi.StringArray{
				pulumi.String("10.1.0.0/16"),
			},
		})
		if err != nil {
			return err
		}
		failoverZoneVirtualNetworkLink, err := privatedns.NewZoneVirtualNetworkLink(ctx, "failover", &privatedns.ZoneVirtualNetworkLinkArgs{
			Name:               pulumi.String("failover-link"),
			ResourceGroupName:  exampleZone.ResourceGroupName,
			PrivateDnsZoneName: exampleZone.Name,
			VirtualNetworkId:   failoverVirtualNetwork.ID(),
		})
		if err != nil {
			return err
		}
		failoverSubnet, err := network.NewSubnet(ctx, "failover", &network.SubnetArgs{
			Name:               pulumi.String("ManagedInstance"),
			ResourceGroupName:  failover.Name,
			VirtualNetworkName: failoverVirtualNetwork.Name,
			AddressPrefixes: pulumi.StringArray{
				pulumi.String("10.1.1.0/24"),
			},
			Delegations: network.SubnetDelegationArray{
				&network.SubnetDelegationArgs{
					Name: pulumi.String("delegation"),
					ServiceDelegation: &network.SubnetDelegationServiceDelegationArgs{
						Actions: pulumi.StringArray{
							pulumi.String("Microsoft.Network/virtualNetworks/subnets/join/action"),
							pulumi.String("Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action"),
							pulumi.String("Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action"),
						},
						Name: pulumi.String("Microsoft.Sql/managedInstances"),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		failoverNetworkSecurityGroup, err := network.NewNetworkSecurityGroup(ctx, "failover", &network.NetworkSecurityGroupArgs{
			Name:              pulumi.String(failoverName),
			Location:          failover.Location,
			ResourceGroupName: failover.Name,
		})
		if err != nil {
			return err
		}
		failoverSubnetNetworkSecurityGroupAssociation, err := network.NewSubnetNetworkSecurityGroupAssociation(ctx, "failover", &network.SubnetNetworkSecurityGroupAssociationArgs{
			SubnetId:               failoverSubnet.ID(),
			NetworkSecurityGroupId: failoverNetworkSecurityGroup.ID(),
		})
		if err != nil {
			return err
		}
		failoverRouteTable, err := network.NewRouteTable(ctx, "failover", &network.RouteTableArgs{
			Name:              pulumi.String(failoverName),
			Location:          failover.Location,
			ResourceGroupName: failover.Name,
		})
		if err != nil {
			return err
		}
		failoverSubnetRouteTableAssociation, err := network.NewSubnetRouteTableAssociation(ctx, "failover", &network.SubnetRouteTableAssociationArgs{
			SubnetId:     failoverSubnet.ID(),
			RouteTableId: failoverRouteTable.ID(),
		})
		if err != nil {
			return err
		}
		failoverManagedInstance, err := mssql.NewManagedInstance(ctx, "failover", &mssql.ManagedInstanceArgs{
			Name:                       pulumi.String(failoverName),
			ResourceGroupName:          failover.Name,
			Location:                   failover.Location,
			AdministratorLogin:         pulumi.String("mradministrator"),
			AdministratorLoginPassword: pulumi.String("thisIsDog11"),
			LicenseType:                pulumi.String("BasePrice"),
			SubnetId:                   failoverSubnet.ID(),
			SkuName:                    pulumi.String("GP_Gen5"),
			Vcores:                     pulumi.Int(4),
			StorageSizeInGb:            pulumi.Int(32),
			DnsZonePartnerId:           primaryManagedInstance.ID(),
		}, pulumi.DependsOn([]pulumi.Resource{
			failoverSubnetNetworkSecurityGroupAssociation,
			failoverSubnetRouteTableAssociation,
		}))
		if err != nil {
			return err
		}
		_, err = mssql.NewManagedInstanceFailoverGroup(ctx, "example", &mssql.ManagedInstanceFailoverGroupArgs{
			Name:                     pulumi.String("example-failover-group"),
			Location:                 primaryManagedInstance.Location,
			ManagedInstanceId:        primaryManagedInstance.ID(),
			PartnerManagedInstanceId: failoverManagedInstance.ID(),
			SecondaryType:            pulumi.String("Geo"),
			ReadWriteEndpointFailoverPolicy: &mssql.ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs{
				Mode:         pulumi.String("Automatic"),
				GraceMinutes: pulumi.Int(60),
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			primaryZoneVirtualNetworkLink,
			failoverZoneVirtualNetworkLink,
		}))
		if err != nil {
			return err
		}
		_, err = network.NewVirtualNetworkPeering(ctx, "primary_to_failover", &network.VirtualNetworkPeeringArgs{
			Name:                   pulumi.String("primary-to-failover"),
			RemoteVirtualNetworkId: failoverVirtualNetwork.ID(),
			ResourceGroupName:      primary.Name,
			VirtualNetworkName:     primaryVirtualNetwork.Name,
		})
		if err != nil {
			return err
		}
		_, err = network.NewSubnet(ctx, "default", &network.SubnetArgs{
			Name:               pulumi.String("default"),
			ResourceGroupName:  failover.Name,
			VirtualNetworkName: failoverVirtualNetwork.Name,
			AddressPrefixes: pulumi.StringArray{
				pulumi.String("10.1.0.0/24"),
			},
		})
		if err != nil {
			return err
		}
		_, err = network.NewVirtualNetworkPeering(ctx, "failover_to_primary", &network.VirtualNetworkPeeringArgs{
			Name:                   pulumi.String("failover-to-primary"),
			RemoteVirtualNetworkId: primaryVirtualNetwork.ID(),
			ResourceGroupName:      failover.Name,
			VirtualNetworkName:     failoverVirtualNetwork.Name,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var name = "mymssqlmitest";

    var primaryName = $"{name}-primary";

    var primaryLocation = "West Europe";

    var failoverName = $"{name}-failover";

    var failoverLocation = "North Europe";

    //# Primary SQL Managed Instance
    var primary = new Azure.Core.ResourceGroup("primary", new()
    {
        Name = primaryName,
        Location = primaryLocation,
    });

    var exampleZone = new Azure.PrivateDns.Zone("example", new()
    {
        Name = $"{name}.private",
        ResourceGroupName = primary.Name,
    });

    var primaryVirtualNetwork = new Azure.Network.VirtualNetwork("primary", new()
    {
        Name = primaryName,
        Location = primary.Location,
        ResourceGroupName = primary.Name,
        AddressSpaces = new[]
        {
            "10.0.0.0/16",
        },
    });

    var primaryZoneVirtualNetworkLink = new Azure.PrivateDns.ZoneVirtualNetworkLink("primary", new()
    {
        Name = "primary-link",
        ResourceGroupName = primary.Name,
        PrivateDnsZoneName = exampleZone.Name,
        VirtualNetworkId = primaryVirtualNetwork.Id,
    });

    var primarySubnet = new Azure.Network.Subnet("primary", new()
    {
        Name = primaryName,
        ResourceGroupName = primary.Name,
        VirtualNetworkName = primaryVirtualNetwork.Name,
        AddressPrefixes = new[]
        {
            "10.0.1.0/24",
        },
        Delegations = new[]
        {
            new Azure.Network.Inputs.SubnetDelegationArgs
            {
                Name = "delegation",
                ServiceDelegation = new Azure.Network.Inputs.SubnetDelegationServiceDelegationArgs
                {
                    Actions = new[]
                    {
                        "Microsoft.Network/virtualNetworks/subnets/join/action",
                        "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
                        "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action",
                    },
                    Name = "Microsoft.Sql/managedInstances",
                },
            },
        },
    });

    var primaryNetworkSecurityGroup = new Azure.Network.NetworkSecurityGroup("primary", new()
    {
        Name = primaryName,
        Location = primary.Location,
        ResourceGroupName = primary.Name,
    });

    var primarySubnetNetworkSecurityGroupAssociation = new Azure.Network.SubnetNetworkSecurityGroupAssociation("primary", new()
    {
        SubnetId = primarySubnet.Id,
        NetworkSecurityGroupId = primaryNetworkSecurityGroup.Id,
    });

    var primaryRouteTable = new Azure.Network.RouteTable("primary", new()
    {
        Name = primaryName,
        Location = primary.Location,
        ResourceGroupName = primary.Name,
    });

    var primarySubnetRouteTableAssociation = new Azure.Network.SubnetRouteTableAssociation("primary", new()
    {
        SubnetId = primarySubnet.Id,
        RouteTableId = primaryRouteTable.Id,
    });

    var primaryManagedInstance = new Azure.MSSql.ManagedInstance("primary", new()
    {
        Name = primaryName,
        ResourceGroupName = primary.Name,
        Location = primary.Location,
        AdministratorLogin = "mradministrator",
        AdministratorLoginPassword = "thisIsDog11",
        LicenseType = "BasePrice",
        SubnetId = primarySubnet.Id,
        SkuName = "GP_Gen5",
        Vcores = 4,
        StorageSizeInGb = 32,
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            primarySubnetNetworkSecurityGroupAssociation,
            primarySubnetRouteTableAssociation,
        },
    });

    //# Secondary (Fail-over) SQL Managed Instance
    var failover = new Azure.Core.ResourceGroup("failover", new()
    {
        Name = failoverName,
        Location = failoverLocation,
    });

    var failoverVirtualNetwork = new Azure.Network.VirtualNetwork("failover", new()
    {
        Name = failoverName,
        Location = failover.Location,
        ResourceGroupName = failover.Name,
        AddressSpaces = new[]
        {
            "10.1.0.0/16",
        },
    });

    var failoverZoneVirtualNetworkLink = new Azure.PrivateDns.ZoneVirtualNetworkLink("failover", new()
    {
        Name = "failover-link",
        ResourceGroupName = exampleZone.ResourceGroupName,
        PrivateDnsZoneName = exampleZone.Name,
        VirtualNetworkId = failoverVirtualNetwork.Id,
    });

    var failoverSubnet = new Azure.Network.Subnet("failover", new()
    {
        Name = "ManagedInstance",
        ResourceGroupName = failover.Name,
        VirtualNetworkName = failoverVirtualNetwork.Name,
        AddressPrefixes = new[]
        {
            "10.1.1.0/24",
        },
        Delegations = new[]
        {
            new Azure.Network.Inputs.SubnetDelegationArgs
            {
                Name = "delegation",
                ServiceDelegation = new Azure.Network.Inputs.SubnetDelegationServiceDelegationArgs
                {
                    Actions = new[]
                    {
                        "Microsoft.Network/virtualNetworks/subnets/join/action",
                        "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
                        "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action",
                    },
                    Name = "Microsoft.Sql/managedInstances",
                },
            },
        },
    });

    var failoverNetworkSecurityGroup = new Azure.Network.NetworkSecurityGroup("failover", new()
    {
        Name = failoverName,
        Location = failover.Location,
        ResourceGroupName = failover.Name,
    });

    var failoverSubnetNetworkSecurityGroupAssociation = new Azure.Network.SubnetNetworkSecurityGroupAssociation("failover", new()
    {
        SubnetId = failoverSubnet.Id,
        NetworkSecurityGroupId = failoverNetworkSecurityGroup.Id,
    });

    var failoverRouteTable = new Azure.Network.RouteTable("failover", new()
    {
        Name = failoverName,
        Location = failover.Location,
        ResourceGroupName = failover.Name,
    });

    var failoverSubnetRouteTableAssociation = new Azure.Network.SubnetRouteTableAssociation("failover", new()
    {
        SubnetId = failoverSubnet.Id,
        RouteTableId = failoverRouteTable.Id,
    });

    var failoverManagedInstance = new Azure.MSSql.ManagedInstance("failover", new()
    {
        Name = failoverName,
        ResourceGroupName = failover.Name,
        Location = failover.Location,
        AdministratorLogin = "mradministrator",
        AdministratorLoginPassword = "thisIsDog11",
        LicenseType = "BasePrice",
        SubnetId = failoverSubnet.Id,
        SkuName = "GP_Gen5",
        Vcores = 4,
        StorageSizeInGb = 32,
        DnsZonePartnerId = primaryManagedInstance.Id,
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            failoverSubnetNetworkSecurityGroupAssociation,
            failoverSubnetRouteTableAssociation,
        },
    });

    var example = new Azure.MSSql.ManagedInstanceFailoverGroup("example", new()
    {
        Name = "example-failover-group",
        Location = primaryManagedInstance.Location,
        ManagedInstanceId = primaryManagedInstance.Id,
        PartnerManagedInstanceId = failoverManagedInstance.Id,
        SecondaryType = "Geo",
        ReadWriteEndpointFailoverPolicy = new Azure.MSSql.Inputs.ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs
        {
            Mode = "Automatic",
            GraceMinutes = 60,
        },
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            primaryZoneVirtualNetworkLink,
            failoverZoneVirtualNetworkLink,
        },
    });

    var primaryToFailover = new Azure.Network.VirtualNetworkPeering("primary_to_failover", new()
    {
        Name = "primary-to-failover",
        RemoteVirtualNetworkId = failoverVirtualNetwork.Id,
        ResourceGroupName = primary.Name,
        VirtualNetworkName = primaryVirtualNetwork.Name,
    });

    var @default = new Azure.Network.Subnet("default", new()
    {
        Name = "default",
        ResourceGroupName = failover.Name,
        VirtualNetworkName = failoverVirtualNetwork.Name,
        AddressPrefixes = new[]
        {
            "10.1.0.0/24",
        },
    });

    var failoverToPrimary = new Azure.Network.VirtualNetworkPeering("failover_to_primary", new()
    {
        Name = "failover-to-primary",
        RemoteVirtualNetworkId = primaryVirtualNetwork.Id,
        ResourceGroupName = failover.Name,
        VirtualNetworkName = failoverVirtualNetwork.Name,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.privatedns.Zone;
import com.pulumi.azure.privatedns.ZoneArgs;
import com.pulumi.azure.network.VirtualNetwork;
import com.pulumi.azure.network.VirtualNetworkArgs;
import com.pulumi.azure.privatedns.ZoneVirtualNetworkLink;
import com.pulumi.azure.privatedns.ZoneVirtualNetworkLinkArgs;
import com.pulumi.azure.network.Subnet;
import com.pulumi.azure.network.SubnetArgs;
import com.pulumi.azure.network.inputs.SubnetDelegationArgs;
import com.pulumi.azure.network.inputs.SubnetDelegationServiceDelegationArgs;
import com.pulumi.azure.network.NetworkSecurityGroup;
import com.pulumi.azure.network.NetworkSecurityGroupArgs;
import com.pulumi.azure.network.SubnetNetworkSecurityGroupAssociation;
import com.pulumi.azure.network.SubnetNetworkSecurityGroupAssociationArgs;
import com.pulumi.azure.network.RouteTable;
import com.pulumi.azure.network.RouteTableArgs;
import com.pulumi.azure.network.SubnetRouteTableAssociation;
import com.pulumi.azure.network.SubnetRouteTableAssociationArgs;
import com.pulumi.azure.mssql.ManagedInstance;
import com.pulumi.azure.mssql.ManagedInstanceArgs;
import com.pulumi.azure.mssql.ManagedInstanceFailoverGroup;
import com.pulumi.azure.mssql.ManagedInstanceFailoverGroupArgs;
import com.pulumi.azure.mssql.inputs.ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs;
import com.pulumi.azure.network.VirtualNetworkPeering;
import com.pulumi.azure.network.VirtualNetworkPeeringArgs;
import com.pulumi.resources.CustomResourceOptions;
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 name = "mymssqlmitest";

        final var primaryName = String.format("%s-primary", name);

        final var primaryLocation = "West Europe";

        final var failoverName = String.format("%s-failover", name);

        final var failoverLocation = "North Europe";

        //# Primary SQL Managed Instance
        var primary = new ResourceGroup("primary", ResourceGroupArgs.builder()
            .name(primaryName)
            .location(primaryLocation)
            .build());

        var exampleZone = new Zone("exampleZone", ZoneArgs.builder()
            .name(String.format("%s.private", name))
            .resourceGroupName(primary.name())
            .build());

        var primaryVirtualNetwork = new VirtualNetwork("primaryVirtualNetwork", VirtualNetworkArgs.builder()
            .name(primaryName)
            .location(primary.location())
            .resourceGroupName(primary.name())
            .addressSpaces("10.0.0.0/16")
            .build());

        var primaryZoneVirtualNetworkLink = new ZoneVirtualNetworkLink("primaryZoneVirtualNetworkLink", ZoneVirtualNetworkLinkArgs.builder()
            .name("primary-link")
            .resourceGroupName(primary.name())
            .privateDnsZoneName(exampleZone.name())
            .virtualNetworkId(primaryVirtualNetwork.id())
            .build());

        var primarySubnet = new Subnet("primarySubnet", SubnetArgs.builder()
            .name(primaryName)
            .resourceGroupName(primary.name())
            .virtualNetworkName(primaryVirtualNetwork.name())
            .addressPrefixes("10.0.1.0/24")
            .delegations(SubnetDelegationArgs.builder()
                .name("delegation")
                .serviceDelegation(SubnetDelegationServiceDelegationArgs.builder()
                    .actions(                    
                        "Microsoft.Network/virtualNetworks/subnets/join/action",
                        "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
                        "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action")
                    .name("Microsoft.Sql/managedInstances")
                    .build())
                .build())
            .build());

        var primaryNetworkSecurityGroup = new NetworkSecurityGroup("primaryNetworkSecurityGroup", NetworkSecurityGroupArgs.builder()
            .name(primaryName)
            .location(primary.location())
            .resourceGroupName(primary.name())
            .build());

        var primarySubnetNetworkSecurityGroupAssociation = new SubnetNetworkSecurityGroupAssociation("primarySubnetNetworkSecurityGroupAssociation", SubnetNetworkSecurityGroupAssociationArgs.builder()
            .subnetId(primarySubnet.id())
            .networkSecurityGroupId(primaryNetworkSecurityGroup.id())
            .build());

        var primaryRouteTable = new RouteTable("primaryRouteTable", RouteTableArgs.builder()
            .name(primaryName)
            .location(primary.location())
            .resourceGroupName(primary.name())
            .build());

        var primarySubnetRouteTableAssociation = new SubnetRouteTableAssociation("primarySubnetRouteTableAssociation", SubnetRouteTableAssociationArgs.builder()
            .subnetId(primarySubnet.id())
            .routeTableId(primaryRouteTable.id())
            .build());

        var primaryManagedInstance = new ManagedInstance("primaryManagedInstance", ManagedInstanceArgs.builder()
            .name(primaryName)
            .resourceGroupName(primary.name())
            .location(primary.location())
            .administratorLogin("mradministrator")
            .administratorLoginPassword("thisIsDog11")
            .licenseType("BasePrice")
            .subnetId(primarySubnet.id())
            .skuName("GP_Gen5")
            .vcores(4)
            .storageSizeInGb(32)
            .build(), CustomResourceOptions.builder()
                .dependsOn(                
                    primarySubnetNetworkSecurityGroupAssociation,
                    primarySubnetRouteTableAssociation)
                .build());

        //# Secondary (Fail-over) SQL Managed Instance
        var failover = new ResourceGroup("failover", ResourceGroupArgs.builder()
            .name(failoverName)
            .location(failoverLocation)
            .build());

        var failoverVirtualNetwork = new VirtualNetwork("failoverVirtualNetwork", VirtualNetworkArgs.builder()
            .name(failoverName)
            .location(failover.location())
            .resourceGroupName(failover.name())
            .addressSpaces("10.1.0.0/16")
            .build());

        var failoverZoneVirtualNetworkLink = new ZoneVirtualNetworkLink("failoverZoneVirtualNetworkLink", ZoneVirtualNetworkLinkArgs.builder()
            .name("failover-link")
            .resourceGroupName(exampleZone.resourceGroupName())
            .privateDnsZoneName(exampleZone.name())
            .virtualNetworkId(failoverVirtualNetwork.id())
            .build());

        var failoverSubnet = new Subnet("failoverSubnet", SubnetArgs.builder()
            .name("ManagedInstance")
            .resourceGroupName(failover.name())
            .virtualNetworkName(failoverVirtualNetwork.name())
            .addressPrefixes("10.1.1.0/24")
            .delegations(SubnetDelegationArgs.builder()
                .name("delegation")
                .serviceDelegation(SubnetDelegationServiceDelegationArgs.builder()
                    .actions(                    
                        "Microsoft.Network/virtualNetworks/subnets/join/action",
                        "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
                        "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action")
                    .name("Microsoft.Sql/managedInstances")
                    .build())
                .build())
            .build());

        var failoverNetworkSecurityGroup = new NetworkSecurityGroup("failoverNetworkSecurityGroup", NetworkSecurityGroupArgs.builder()
            .name(failoverName)
            .location(failover.location())
            .resourceGroupName(failover.name())
            .build());

        var failoverSubnetNetworkSecurityGroupAssociation = new SubnetNetworkSecurityGroupAssociation("failoverSubnetNetworkSecurityGroupAssociation", SubnetNetworkSecurityGroupAssociationArgs.builder()
            .subnetId(failoverSubnet.id())
            .networkSecurityGroupId(failoverNetworkSecurityGroup.id())
            .build());

        var failoverRouteTable = new RouteTable("failoverRouteTable", RouteTableArgs.builder()
            .name(failoverName)
            .location(failover.location())
            .resourceGroupName(failover.name())
            .build());

        var failoverSubnetRouteTableAssociation = new SubnetRouteTableAssociation("failoverSubnetRouteTableAssociation", SubnetRouteTableAssociationArgs.builder()
            .subnetId(failoverSubnet.id())
            .routeTableId(failoverRouteTable.id())
            .build());

        var failoverManagedInstance = new ManagedInstance("failoverManagedInstance", ManagedInstanceArgs.builder()
            .name(failoverName)
            .resourceGroupName(failover.name())
            .location(failover.location())
            .administratorLogin("mradministrator")
            .administratorLoginPassword("thisIsDog11")
            .licenseType("BasePrice")
            .subnetId(failoverSubnet.id())
            .skuName("GP_Gen5")
            .vcores(4)
            .storageSizeInGb(32)
            .dnsZonePartnerId(primaryManagedInstance.id())
            .build(), CustomResourceOptions.builder()
                .dependsOn(                
                    failoverSubnetNetworkSecurityGroupAssociation,
                    failoverSubnetRouteTableAssociation)
                .build());

        var example = new ManagedInstanceFailoverGroup("example", ManagedInstanceFailoverGroupArgs.builder()
            .name("example-failover-group")
            .location(primaryManagedInstance.location())
            .managedInstanceId(primaryManagedInstance.id())
            .partnerManagedInstanceId(failoverManagedInstance.id())
            .secondaryType("Geo")
            .readWriteEndpointFailoverPolicy(ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs.builder()
                .mode("Automatic")
                .graceMinutes(60)
                .build())
            .build(), CustomResourceOptions.builder()
                .dependsOn(                
                    primaryZoneVirtualNetworkLink,
                    failoverZoneVirtualNetworkLink)
                .build());

        var primaryToFailover = new VirtualNetworkPeering("primaryToFailover", VirtualNetworkPeeringArgs.builder()
            .name("primary-to-failover")
            .remoteVirtualNetworkId(failoverVirtualNetwork.id())
            .resourceGroupName(primary.name())
            .virtualNetworkName(primaryVirtualNetwork.name())
            .build());

        var default_ = new Subnet("default", SubnetArgs.builder()
            .name("default")
            .resourceGroupName(failover.name())
            .virtualNetworkName(failoverVirtualNetwork.name())
            .addressPrefixes("10.1.0.0/24")
            .build());

        var failoverToPrimary = new VirtualNetworkPeering("failoverToPrimary", VirtualNetworkPeeringArgs.builder()
            .name("failover-to-primary")
            .remoteVirtualNetworkId(primaryVirtualNetwork.id())
            .resourceGroupName(failover.name())
            .virtualNetworkName(failoverVirtualNetwork.name())
            .build());

    }
}
Copy
resources:
  example:
    type: azure:mssql:ManagedInstanceFailoverGroup
    properties:
      name: example-failover-group
      location: ${primaryManagedInstance.location}
      managedInstanceId: ${primaryManagedInstance.id}
      partnerManagedInstanceId: ${failoverManagedInstance.id}
      secondaryType: Geo
      readWriteEndpointFailoverPolicy:
        mode: Automatic
        graceMinutes: 60
    options:
      dependsOn:
        - ${primaryZoneVirtualNetworkLink}
        - ${failoverZoneVirtualNetworkLink}
  exampleZone:
    type: azure:privatedns:Zone
    name: example
    properties:
      name: ${name}.private
      resourceGroupName: ${primary.name}
  ## Primary SQL Managed Instance
  primary:
    type: azure:core:ResourceGroup
    properties:
      name: ${primaryName}
      location: ${primaryLocation}
  primaryVirtualNetwork:
    type: azure:network:VirtualNetwork
    name: primary
    properties:
      name: ${primaryName}
      location: ${primary.location}
      resourceGroupName: ${primary.name}
      addressSpaces:
        - 10.0.0.0/16
  primaryZoneVirtualNetworkLink:
    type: azure:privatedns:ZoneVirtualNetworkLink
    name: primary
    properties:
      name: primary-link
      resourceGroupName: ${primary.name}
      privateDnsZoneName: ${exampleZone.name}
      virtualNetworkId: ${primaryVirtualNetwork.id}
  primarySubnet:
    type: azure:network:Subnet
    name: primary
    properties:
      name: ${primaryName}
      resourceGroupName: ${primary.name}
      virtualNetworkName: ${primaryVirtualNetwork.name}
      addressPrefixes:
        - 10.0.1.0/24
      delegations:
        - name: delegation
          serviceDelegation:
            actions:
              - Microsoft.Network/virtualNetworks/subnets/join/action
              - Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action
              - Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action
            name: Microsoft.Sql/managedInstances
  primaryNetworkSecurityGroup:
    type: azure:network:NetworkSecurityGroup
    name: primary
    properties:
      name: ${primaryName}
      location: ${primary.location}
      resourceGroupName: ${primary.name}
  primarySubnetNetworkSecurityGroupAssociation:
    type: azure:network:SubnetNetworkSecurityGroupAssociation
    name: primary
    properties:
      subnetId: ${primarySubnet.id}
      networkSecurityGroupId: ${primaryNetworkSecurityGroup.id}
  primaryRouteTable:
    type: azure:network:RouteTable
    name: primary
    properties:
      name: ${primaryName}
      location: ${primary.location}
      resourceGroupName: ${primary.name}
  primarySubnetRouteTableAssociation:
    type: azure:network:SubnetRouteTableAssociation
    name: primary
    properties:
      subnetId: ${primarySubnet.id}
      routeTableId: ${primaryRouteTable.id}
  primaryManagedInstance:
    type: azure:mssql:ManagedInstance
    name: primary
    properties:
      name: ${primaryName}
      resourceGroupName: ${primary.name}
      location: ${primary.location}
      administratorLogin: mradministrator
      administratorLoginPassword: thisIsDog11
      licenseType: BasePrice
      subnetId: ${primarySubnet.id}
      skuName: GP_Gen5
      vcores: 4
      storageSizeInGb: 32
    options:
      dependsOn:
        - ${primarySubnetNetworkSecurityGroupAssociation}
        - ${primarySubnetRouteTableAssociation}
  primaryToFailover:
    type: azure:network:VirtualNetworkPeering
    name: primary_to_failover
    properties:
      name: primary-to-failover
      remoteVirtualNetworkId: ${failoverVirtualNetwork.id}
      resourceGroupName: ${primary.name}
      virtualNetworkName: ${primaryVirtualNetwork.name}
  ## Secondary (Fail-over) SQL Managed Instance
  failover:
    type: azure:core:ResourceGroup
    properties:
      name: ${failoverName}
      location: ${failoverLocation}
  failoverVirtualNetwork:
    type: azure:network:VirtualNetwork
    name: failover
    properties:
      name: ${failoverName}
      location: ${failover.location}
      resourceGroupName: ${failover.name}
      addressSpaces:
        - 10.1.0.0/16
  failoverZoneVirtualNetworkLink:
    type: azure:privatedns:ZoneVirtualNetworkLink
    name: failover
    properties:
      name: failover-link
      resourceGroupName: ${exampleZone.resourceGroupName}
      privateDnsZoneName: ${exampleZone.name}
      virtualNetworkId: ${failoverVirtualNetwork.id}
  default:
    type: azure:network:Subnet
    properties:
      name: default
      resourceGroupName: ${failover.name}
      virtualNetworkName: ${failoverVirtualNetwork.name}
      addressPrefixes:
        - 10.1.0.0/24
  failoverSubnet:
    type: azure:network:Subnet
    name: failover
    properties:
      name: ManagedInstance
      resourceGroupName: ${failover.name}
      virtualNetworkName: ${failoverVirtualNetwork.name}
      addressPrefixes:
        - 10.1.1.0/24
      delegations:
        - name: delegation
          serviceDelegation:
            actions:
              - Microsoft.Network/virtualNetworks/subnets/join/action
              - Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action
              - Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action
            name: Microsoft.Sql/managedInstances
  failoverNetworkSecurityGroup:
    type: azure:network:NetworkSecurityGroup
    name: failover
    properties:
      name: ${failoverName}
      location: ${failover.location}
      resourceGroupName: ${failover.name}
  failoverSubnetNetworkSecurityGroupAssociation:
    type: azure:network:SubnetNetworkSecurityGroupAssociation
    name: failover
    properties:
      subnetId: ${failoverSubnet.id}
      networkSecurityGroupId: ${failoverNetworkSecurityGroup.id}
  failoverRouteTable:
    type: azure:network:RouteTable
    name: failover
    properties:
      name: ${failoverName}
      location: ${failover.location}
      resourceGroupName: ${failover.name}
  failoverSubnetRouteTableAssociation:
    type: azure:network:SubnetRouteTableAssociation
    name: failover
    properties:
      subnetId: ${failoverSubnet.id}
      routeTableId: ${failoverRouteTable.id}
  failoverManagedInstance:
    type: azure:mssql:ManagedInstance
    name: failover
    properties:
      name: ${failoverName}
      resourceGroupName: ${failover.name}
      location: ${failover.location}
      administratorLogin: mradministrator
      administratorLoginPassword: thisIsDog11
      licenseType: BasePrice
      subnetId: ${failoverSubnet.id}
      skuName: GP_Gen5
      vcores: 4
      storageSizeInGb: 32
      dnsZonePartnerId: ${primaryManagedInstance.id}
    options:
      dependsOn:
        - ${failoverSubnetNetworkSecurityGroupAssociation}
        - ${failoverSubnetRouteTableAssociation}
  failoverToPrimary:
    type: azure:network:VirtualNetworkPeering
    name: failover_to_primary
    properties:
      name: failover-to-primary
      remoteVirtualNetworkId: ${primaryVirtualNetwork.id}
      resourceGroupName: ${failover.name}
      virtualNetworkName: ${failoverVirtualNetwork.name}
variables:
  name: mymssqlmitest
  primaryName: ${name}-primary
  primaryLocation: West Europe
  failoverName: ${name}-failover
  failoverLocation: North Europe
Copy

Note: There are many prerequisites that must be in place before creating the failover group. To see them all, refer to Configure a failover group for Azure SQL Managed Instance.

Create ManagedInstanceFailoverGroup Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ManagedInstanceFailoverGroup(name: string, args: ManagedInstanceFailoverGroupArgs, opts?: CustomResourceOptions);
@overload
def ManagedInstanceFailoverGroup(resource_name: str,
                                 args: ManagedInstanceFailoverGroupArgs,
                                 opts: Optional[ResourceOptions] = None)

@overload
def ManagedInstanceFailoverGroup(resource_name: str,
                                 opts: Optional[ResourceOptions] = None,
                                 managed_instance_id: Optional[str] = None,
                                 partner_managed_instance_id: Optional[str] = None,
                                 read_write_endpoint_failover_policy: Optional[ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs] = None,
                                 location: Optional[str] = None,
                                 name: Optional[str] = None,
                                 readonly_endpoint_failover_policy_enabled: Optional[bool] = None,
                                 secondary_type: Optional[str] = None)
func NewManagedInstanceFailoverGroup(ctx *Context, name string, args ManagedInstanceFailoverGroupArgs, opts ...ResourceOption) (*ManagedInstanceFailoverGroup, error)
public ManagedInstanceFailoverGroup(string name, ManagedInstanceFailoverGroupArgs args, CustomResourceOptions? opts = null)
public ManagedInstanceFailoverGroup(String name, ManagedInstanceFailoverGroupArgs args)
public ManagedInstanceFailoverGroup(String name, ManagedInstanceFailoverGroupArgs args, CustomResourceOptions options)
type: azure:mssql:ManagedInstanceFailoverGroup
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ManagedInstanceFailoverGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ManagedInstanceFailoverGroupArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ManagedInstanceFailoverGroupArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ManagedInstanceFailoverGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ManagedInstanceFailoverGroupArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var managedInstanceFailoverGroupResource = new Azure.MSSql.ManagedInstanceFailoverGroup("managedInstanceFailoverGroupResource", new()
{
    ManagedInstanceId = "string",
    PartnerManagedInstanceId = "string",
    ReadWriteEndpointFailoverPolicy = new Azure.MSSql.Inputs.ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs
    {
        Mode = "string",
        GraceMinutes = 0,
    },
    Location = "string",
    Name = "string",
    ReadonlyEndpointFailoverPolicyEnabled = false,
    SecondaryType = "string",
});
Copy
example, err := mssql.NewManagedInstanceFailoverGroup(ctx, "managedInstanceFailoverGroupResource", &mssql.ManagedInstanceFailoverGroupArgs{
	ManagedInstanceId:        pulumi.String("string"),
	PartnerManagedInstanceId: pulumi.String("string"),
	ReadWriteEndpointFailoverPolicy: &mssql.ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs{
		Mode:         pulumi.String("string"),
		GraceMinutes: pulumi.Int(0),
	},
	Location:                              pulumi.String("string"),
	Name:                                  pulumi.String("string"),
	ReadonlyEndpointFailoverPolicyEnabled: pulumi.Bool(false),
	SecondaryType:                         pulumi.String("string"),
})
Copy
var managedInstanceFailoverGroupResource = new ManagedInstanceFailoverGroup("managedInstanceFailoverGroupResource", ManagedInstanceFailoverGroupArgs.builder()
    .managedInstanceId("string")
    .partnerManagedInstanceId("string")
    .readWriteEndpointFailoverPolicy(ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs.builder()
        .mode("string")
        .graceMinutes(0)
        .build())
    .location("string")
    .name("string")
    .readonlyEndpointFailoverPolicyEnabled(false)
    .secondaryType("string")
    .build());
Copy
managed_instance_failover_group_resource = azure.mssql.ManagedInstanceFailoverGroup("managedInstanceFailoverGroupResource",
    managed_instance_id="string",
    partner_managed_instance_id="string",
    read_write_endpoint_failover_policy={
        "mode": "string",
        "grace_minutes": 0,
    },
    location="string",
    name="string",
    readonly_endpoint_failover_policy_enabled=False,
    secondary_type="string")
Copy
const managedInstanceFailoverGroupResource = new azure.mssql.ManagedInstanceFailoverGroup("managedInstanceFailoverGroupResource", {
    managedInstanceId: "string",
    partnerManagedInstanceId: "string",
    readWriteEndpointFailoverPolicy: {
        mode: "string",
        graceMinutes: 0,
    },
    location: "string",
    name: "string",
    readonlyEndpointFailoverPolicyEnabled: false,
    secondaryType: "string",
});
Copy
type: azure:mssql:ManagedInstanceFailoverGroup
properties:
    location: string
    managedInstanceId: string
    name: string
    partnerManagedInstanceId: string
    readWriteEndpointFailoverPolicy:
        graceMinutes: 0
        mode: string
    readonlyEndpointFailoverPolicyEnabled: false
    secondaryType: string
Copy

ManagedInstanceFailoverGroup Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ManagedInstanceFailoverGroup resource accepts the following input properties:

ManagedInstanceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Azure SQL Managed Instance which will be replicated using a Managed Instance Failover Group. Changing this forces a new resource to be created.
PartnerManagedInstanceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Azure SQL Managed Instance which will be replicated to. Changing this forces a new resource to be created.
ReadWriteEndpointFailoverPolicy This property is required. ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicy
A read_write_endpoint_failover_policy block as defined below.
Location Changes to this property will trigger replacement. string
The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
Name Changes to this property will trigger replacement. string
The name which should be used for this Managed Instance Failover Group. Changing this forces a new resource to be created.
ReadonlyEndpointFailoverPolicyEnabled bool
Failover policy for the read-only endpoint. Defaults to true.
SecondaryType string
The type of the secondary Managed Instance. Possible values are Geo, Standby. Defaults to Geo.
ManagedInstanceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Azure SQL Managed Instance which will be replicated using a Managed Instance Failover Group. Changing this forces a new resource to be created.
PartnerManagedInstanceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Azure SQL Managed Instance which will be replicated to. Changing this forces a new resource to be created.
ReadWriteEndpointFailoverPolicy This property is required. ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs
A read_write_endpoint_failover_policy block as defined below.
Location Changes to this property will trigger replacement. string
The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
Name Changes to this property will trigger replacement. string
The name which should be used for this Managed Instance Failover Group. Changing this forces a new resource to be created.
ReadonlyEndpointFailoverPolicyEnabled bool
Failover policy for the read-only endpoint. Defaults to true.
SecondaryType string
The type of the secondary Managed Instance. Possible values are Geo, Standby. Defaults to Geo.
managedInstanceId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Azure SQL Managed Instance which will be replicated using a Managed Instance Failover Group. Changing this forces a new resource to be created.
partnerManagedInstanceId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Azure SQL Managed Instance which will be replicated to. Changing this forces a new resource to be created.
readWriteEndpointFailoverPolicy This property is required. ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicy
A read_write_endpoint_failover_policy block as defined below.
location Changes to this property will trigger replacement. String
The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. String
The name which should be used for this Managed Instance Failover Group. Changing this forces a new resource to be created.
readonlyEndpointFailoverPolicyEnabled Boolean
Failover policy for the read-only endpoint. Defaults to true.
secondaryType String
The type of the secondary Managed Instance. Possible values are Geo, Standby. Defaults to Geo.
managedInstanceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Azure SQL Managed Instance which will be replicated using a Managed Instance Failover Group. Changing this forces a new resource to be created.
partnerManagedInstanceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Azure SQL Managed Instance which will be replicated to. Changing this forces a new resource to be created.
readWriteEndpointFailoverPolicy This property is required. ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicy
A read_write_endpoint_failover_policy block as defined below.
location Changes to this property will trigger replacement. string
The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. string
The name which should be used for this Managed Instance Failover Group. Changing this forces a new resource to be created.
readonlyEndpointFailoverPolicyEnabled boolean
Failover policy for the read-only endpoint. Defaults to true.
secondaryType string
The type of the secondary Managed Instance. Possible values are Geo, Standby. Defaults to Geo.
managed_instance_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the Azure SQL Managed Instance which will be replicated using a Managed Instance Failover Group. Changing this forces a new resource to be created.
partner_managed_instance_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the Azure SQL Managed Instance which will be replicated to. Changing this forces a new resource to be created.
read_write_endpoint_failover_policy This property is required. ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs
A read_write_endpoint_failover_policy block as defined below.
location Changes to this property will trigger replacement. str
The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. str
The name which should be used for this Managed Instance Failover Group. Changing this forces a new resource to be created.
readonly_endpoint_failover_policy_enabled bool
Failover policy for the read-only endpoint. Defaults to true.
secondary_type str
The type of the secondary Managed Instance. Possible values are Geo, Standby. Defaults to Geo.
managedInstanceId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Azure SQL Managed Instance which will be replicated using a Managed Instance Failover Group. Changing this forces a new resource to be created.
partnerManagedInstanceId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Azure SQL Managed Instance which will be replicated to. Changing this forces a new resource to be created.
readWriteEndpointFailoverPolicy This property is required. Property Map
A read_write_endpoint_failover_policy block as defined below.
location Changes to this property will trigger replacement. String
The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. String
The name which should be used for this Managed Instance Failover Group. Changing this forces a new resource to be created.
readonlyEndpointFailoverPolicyEnabled Boolean
Failover policy for the read-only endpoint. Defaults to true.
secondaryType String
The type of the secondary Managed Instance. Possible values are Geo, Standby. Defaults to Geo.

Outputs

All input properties are implicitly available as output properties. Additionally, the ManagedInstanceFailoverGroup resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
PartnerRegions List<ManagedInstanceFailoverGroupPartnerRegion>
A partner_region block as defined below.
Role string
The partner replication role of the Managed Instance Failover Group.
Id string
The provider-assigned unique ID for this managed resource.
PartnerRegions []ManagedInstanceFailoverGroupPartnerRegion
A partner_region block as defined below.
Role string
The partner replication role of the Managed Instance Failover Group.
id String
The provider-assigned unique ID for this managed resource.
partnerRegions List<ManagedInstanceFailoverGroupPartnerRegion>
A partner_region block as defined below.
role String
The partner replication role of the Managed Instance Failover Group.
id string
The provider-assigned unique ID for this managed resource.
partnerRegions ManagedInstanceFailoverGroupPartnerRegion[]
A partner_region block as defined below.
role string
The partner replication role of the Managed Instance Failover Group.
id str
The provider-assigned unique ID for this managed resource.
partner_regions Sequence[ManagedInstanceFailoverGroupPartnerRegion]
A partner_region block as defined below.
role str
The partner replication role of the Managed Instance Failover Group.
id String
The provider-assigned unique ID for this managed resource.
partnerRegions List<Property Map>
A partner_region block as defined below.
role String
The partner replication role of the Managed Instance Failover Group.

Look up Existing ManagedInstanceFailoverGroup Resource

Get an existing ManagedInstanceFailoverGroup resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ManagedInstanceFailoverGroupState, opts?: CustomResourceOptions): ManagedInstanceFailoverGroup
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        location: Optional[str] = None,
        managed_instance_id: Optional[str] = None,
        name: Optional[str] = None,
        partner_managed_instance_id: Optional[str] = None,
        partner_regions: Optional[Sequence[ManagedInstanceFailoverGroupPartnerRegionArgs]] = None,
        read_write_endpoint_failover_policy: Optional[ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs] = None,
        readonly_endpoint_failover_policy_enabled: Optional[bool] = None,
        role: Optional[str] = None,
        secondary_type: Optional[str] = None) -> ManagedInstanceFailoverGroup
func GetManagedInstanceFailoverGroup(ctx *Context, name string, id IDInput, state *ManagedInstanceFailoverGroupState, opts ...ResourceOption) (*ManagedInstanceFailoverGroup, error)
public static ManagedInstanceFailoverGroup Get(string name, Input<string> id, ManagedInstanceFailoverGroupState? state, CustomResourceOptions? opts = null)
public static ManagedInstanceFailoverGroup get(String name, Output<String> id, ManagedInstanceFailoverGroupState state, CustomResourceOptions options)
resources:  _:    type: azure:mssql:ManagedInstanceFailoverGroup    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Location Changes to this property will trigger replacement. string
The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
ManagedInstanceId Changes to this property will trigger replacement. string
The ID of the Azure SQL Managed Instance which will be replicated using a Managed Instance Failover Group. Changing this forces a new resource to be created.
Name Changes to this property will trigger replacement. string
The name which should be used for this Managed Instance Failover Group. Changing this forces a new resource to be created.
PartnerManagedInstanceId Changes to this property will trigger replacement. string
The ID of the Azure SQL Managed Instance which will be replicated to. Changing this forces a new resource to be created.
PartnerRegions List<ManagedInstanceFailoverGroupPartnerRegion>
A partner_region block as defined below.
ReadWriteEndpointFailoverPolicy ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicy
A read_write_endpoint_failover_policy block as defined below.
ReadonlyEndpointFailoverPolicyEnabled bool
Failover policy for the read-only endpoint. Defaults to true.
Role string
The partner replication role of the Managed Instance Failover Group.
SecondaryType string
The type of the secondary Managed Instance. Possible values are Geo, Standby. Defaults to Geo.
Location Changes to this property will trigger replacement. string
The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
ManagedInstanceId Changes to this property will trigger replacement. string
The ID of the Azure SQL Managed Instance which will be replicated using a Managed Instance Failover Group. Changing this forces a new resource to be created.
Name Changes to this property will trigger replacement. string
The name which should be used for this Managed Instance Failover Group. Changing this forces a new resource to be created.
PartnerManagedInstanceId Changes to this property will trigger replacement. string
The ID of the Azure SQL Managed Instance which will be replicated to. Changing this forces a new resource to be created.
PartnerRegions []ManagedInstanceFailoverGroupPartnerRegionArgs
A partner_region block as defined below.
ReadWriteEndpointFailoverPolicy ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs
A read_write_endpoint_failover_policy block as defined below.
ReadonlyEndpointFailoverPolicyEnabled bool
Failover policy for the read-only endpoint. Defaults to true.
Role string
The partner replication role of the Managed Instance Failover Group.
SecondaryType string
The type of the secondary Managed Instance. Possible values are Geo, Standby. Defaults to Geo.
location Changes to this property will trigger replacement. String
The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
managedInstanceId Changes to this property will trigger replacement. String
The ID of the Azure SQL Managed Instance which will be replicated using a Managed Instance Failover Group. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. String
The name which should be used for this Managed Instance Failover Group. Changing this forces a new resource to be created.
partnerManagedInstanceId Changes to this property will trigger replacement. String
The ID of the Azure SQL Managed Instance which will be replicated to. Changing this forces a new resource to be created.
partnerRegions List<ManagedInstanceFailoverGroupPartnerRegion>
A partner_region block as defined below.
readWriteEndpointFailoverPolicy ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicy
A read_write_endpoint_failover_policy block as defined below.
readonlyEndpointFailoverPolicyEnabled Boolean
Failover policy for the read-only endpoint. Defaults to true.
role String
The partner replication role of the Managed Instance Failover Group.
secondaryType String
The type of the secondary Managed Instance. Possible values are Geo, Standby. Defaults to Geo.
location Changes to this property will trigger replacement. string
The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
managedInstanceId Changes to this property will trigger replacement. string
The ID of the Azure SQL Managed Instance which will be replicated using a Managed Instance Failover Group. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. string
The name which should be used for this Managed Instance Failover Group. Changing this forces a new resource to be created.
partnerManagedInstanceId Changes to this property will trigger replacement. string
The ID of the Azure SQL Managed Instance which will be replicated to. Changing this forces a new resource to be created.
partnerRegions ManagedInstanceFailoverGroupPartnerRegion[]
A partner_region block as defined below.
readWriteEndpointFailoverPolicy ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicy
A read_write_endpoint_failover_policy block as defined below.
readonlyEndpointFailoverPolicyEnabled boolean
Failover policy for the read-only endpoint. Defaults to true.
role string
The partner replication role of the Managed Instance Failover Group.
secondaryType string
The type of the secondary Managed Instance. Possible values are Geo, Standby. Defaults to Geo.
location Changes to this property will trigger replacement. str
The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
managed_instance_id Changes to this property will trigger replacement. str
The ID of the Azure SQL Managed Instance which will be replicated using a Managed Instance Failover Group. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. str
The name which should be used for this Managed Instance Failover Group. Changing this forces a new resource to be created.
partner_managed_instance_id Changes to this property will trigger replacement. str
The ID of the Azure SQL Managed Instance which will be replicated to. Changing this forces a new resource to be created.
partner_regions Sequence[ManagedInstanceFailoverGroupPartnerRegionArgs]
A partner_region block as defined below.
read_write_endpoint_failover_policy ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs
A read_write_endpoint_failover_policy block as defined below.
readonly_endpoint_failover_policy_enabled bool
Failover policy for the read-only endpoint. Defaults to true.
role str
The partner replication role of the Managed Instance Failover Group.
secondary_type str
The type of the secondary Managed Instance. Possible values are Geo, Standby. Defaults to Geo.
location Changes to this property will trigger replacement. String
The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
managedInstanceId Changes to this property will trigger replacement. String
The ID of the Azure SQL Managed Instance which will be replicated using a Managed Instance Failover Group. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. String
The name which should be used for this Managed Instance Failover Group. Changing this forces a new resource to be created.
partnerManagedInstanceId Changes to this property will trigger replacement. String
The ID of the Azure SQL Managed Instance which will be replicated to. Changing this forces a new resource to be created.
partnerRegions List<Property Map>
A partner_region block as defined below.
readWriteEndpointFailoverPolicy Property Map
A read_write_endpoint_failover_policy block as defined below.
readonlyEndpointFailoverPolicyEnabled Boolean
Failover policy for the read-only endpoint. Defaults to true.
role String
The partner replication role of the Managed Instance Failover Group.
secondaryType String
The type of the secondary Managed Instance. Possible values are Geo, Standby. Defaults to Geo.

Supporting Types

ManagedInstanceFailoverGroupPartnerRegion
, ManagedInstanceFailoverGroupPartnerRegionArgs

Location string
The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
Role string
The partner replication role of the Managed Instance Failover Group.
Location string
The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
Role string
The partner replication role of the Managed Instance Failover Group.
location String
The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
role String
The partner replication role of the Managed Instance Failover Group.
location string
The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
role string
The partner replication role of the Managed Instance Failover Group.
location str
The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
role str
The partner replication role of the Managed Instance Failover Group.
location String
The Azure Region where the Managed Instance Failover Group should exist. Changing this forces a new resource to be created.
role String
The partner replication role of the Managed Instance Failover Group.

ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicy
, ManagedInstanceFailoverGroupReadWriteEndpointFailoverPolicyArgs

Mode This property is required. string
The failover mode. Possible values are Automatic or Manual.
GraceMinutes int
Applies only if mode is Automatic. The grace period in minutes before failover with data loss is attempted.
Mode This property is required. string
The failover mode. Possible values are Automatic or Manual.
GraceMinutes int
Applies only if mode is Automatic. The grace period in minutes before failover with data loss is attempted.
mode This property is required. String
The failover mode. Possible values are Automatic or Manual.
graceMinutes Integer
Applies only if mode is Automatic. The grace period in minutes before failover with data loss is attempted.
mode This property is required. string
The failover mode. Possible values are Automatic or Manual.
graceMinutes number
Applies only if mode is Automatic. The grace period in minutes before failover with data loss is attempted.
mode This property is required. str
The failover mode. Possible values are Automatic or Manual.
grace_minutes int
Applies only if mode is Automatic. The grace period in minutes before failover with data loss is attempted.
mode This property is required. String
The failover mode. Possible values are Automatic or Manual.
graceMinutes Number
Applies only if mode is Automatic. The grace period in minutes before failover with data loss is attempted.

Import

SQL Instance Failover Groups can be imported using the resource id, e.g.

$ pulumi import azure:mssql/managedInstanceFailoverGroup:ManagedInstanceFailoverGroup example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Sql/locations/Location/instanceFailoverGroups/failoverGroup1
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

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