swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: The Azure SQL Database management API provides a RESTful set of web APIs that interact with Azure SQL Database services to manage your databases. The API enables users to create, retrieve, update, and delete databases, servers, and other entities.
  title: SqlManagementClient
  version: 2017-10-01-preview
  x-apisguru-categories:
    - cloud
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/sql/resource-manager/Microsoft.Sql/preview/2017-10-01-preview/instanceFailoverGroups.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: sql-instanceFailoverGroups
  x-tags:
    - Azure
    - Microsoft
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  azure_auth:
    authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
    description: Azure Active Directory OAuth2 Flow
    flow: implicit
    scopes:
      user_impersonation: impersonate your user account
    type: oauth2
parameters:
  ApiVersionParameter:
    description: The API version to use for the request.
    in: query
    name: api-version
    required: true
    type: string
    x-ms-parameter-location: client
  BlobAuditingPolicyNameParameter:
    description: The name of the blob auditing policy.
    enum:
      - default
    in: path
    name: blobAuditingPolicyName
    required: true
    type: string
    x-ms-parameter-location: method
  DatabaseNameParameter:
    description: The name of the database.
    in: path
    name: databaseName
    required: true
    type: string
    x-ms-parameter-location: method
  ManagedInstanceNameParameter:
    description: The name of the managed instance.
    in: path
    name: managedInstanceName
    required: true
    type: string
    x-ms-parameter-location: method
  ResourceGroupParameter:
    description: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
    in: path
    name: resourceGroupName
    required: true
    type: string
    x-ms-parameter-location: method
  ServerNameParameter:
    description: The name of the server.
    in: path
    name: serverName
    required: true
    type: string
    x-ms-parameter-location: method
  SqlVirtualMachineContainerNameParameter:
    description: The name of the SqlVirtualMachineContainer.
    in: path
    name: sqlVirtualMachineContainerName
    required: true
    type: string
    x-ms-parameter-location: method
  SqlVirtualMachineInstanceNameParameter:
    description: The name of the SqlVirtualMachineInstance.
    in: path
    name: sqlVirtualMachineInstanceName
    required: true
    type: string
    x-ms-parameter-location: method
  SubscriptionIdParameter:
    description: The subscription ID that identifies an Azure subscription.
    in: path
    name: subscriptionId
    required: true
    type: string
    x-ms-parameter-location: client
  VirtualClusterNameParameter:
    description: The name of the virtual cluster.
    in: path
    name: virtualClusterName
    required: true
    type: string
    x-ms-parameter-location: method
paths:
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups":
    get:
      description: Lists the failover groups in a location.
      operationId: InstanceFailoverGroups_ListByLocation
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The name of the region where the resource is located.
          in: path
          name: locationName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the failover groups.
          schema:
            $ref: "#/definitions/InstanceFailoverGroupListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidPartner - The given partners field in create or update instance failover group request body is empty or invalid.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestDuplicatePartner - One or more of the provided partner servers are already part of the instance failover group. Please make sure the primary server and all of the given partner servers are unique.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidManagedInstanceRegion - The provided partner managed instance region in the instance failover group request body is empty or invalid.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestUnsupportedPartnerCount - Only one partner region is supported.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestUnsupportedPairCount - Only one managed instance pair is supported.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteEndpoint - The readWriteEndpoint field is required for create or update requests.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalid - The create or update instance failover group request body is empty or invalid.

             * 400 InstanceFailoverGroupUpdateOrDeleteRequestOnSecondary - Modifications to the instance failover group are not allowed on a secondary server. Execute the request on the primary server.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestNegativeGracePeriodValues - Grace period value for the read-write endpoint must be non-negative.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteEndpointFields - The property failoverWithDataLossGracePeriodMinutes must be provided when failover policy Automatic is selected for the read-write endpoint.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteFailoverPolicy - The failoverPolicy field for the read-write endpoint is required for create or update requests.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteEndpointFieldsForManualPolicy - Grace period value should not be provided when failover policy Manual is selected for the read-write endpoint.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestReadOnlyPropertyModified - The create or update instance failover group request body should not modify the read-only property '{0}'.

             * 400 InstanceFailoverGroupFailoverRequestOnPrimary - The failover request should be initiated on the secondary server of instance failover group.

             * 400 InstanceFailoverGroupPartnerManagedInstanceFromDifferentSubscription - Primary server and the partner server of failover group are from different subscriptions. Cross subscription for servers of failover group is not allowed.

             * 400 InvalidAddSecondaryPermission - User does not have sufficient permission to add secondary on the specified server.

             * 400 InvalidSku - The user specified an invalid sku.

             * 400 ServerNotFound - The requested server was not found.

             * 400 FeatureDisabledOnSelectedEdition - User attempted to use a feature which is disabled on current database edition.

             * 400 TokenTooLong - The provided token is too long.

             * 400 InvalidTargetSubregion - The target server of a non-readable secondary is not in a DR paired Azure region.

             * 400 IncorrectReplicationLinkState - The operation expects the database to be in an expected state on the replication link.

             * 400 PlannedFailoverTimedOutForDatabase - User invoked planned failover, it timed out, and a specific database appears to be to blame.

             * 400 PlannedFailoverTimedOut - User invoked planned failover, and it timed out while trying to contact the partner management service.

             * 400 CannotUseReservedDatabaseName - Cannot use reserved database name in this operation.

             * 400 InvalidFailoverGroupRegion - Servers specified in an Instance Failover Group need to reside in different regions to provide isolation.

             * 400 InstanceFailoverGroupDoesNotExist - Failover group does not exist on a server.

             * 400 InstanceFailoverGroupNotSecondary - Failover cannot be initiated from the primary server in a instance failover group.

             * 400 InvalidServerName - Invalid server name specified.

             * 400 InvalidIdentifier - The identifier contains NULL or an invalid unicode character.

             * 400 GeoReplicationDatabaseNotSecondary - The operation expects the database to be a replication target.

             * 400 UnableToResolveRemoteServer - The remote partner server name could not be resolved due to an invalid server name or DNS connectivity issues.

             * 400 RemoteDatabaseCopyPermission - User does not have sufficient permission to create a database copy on the specified server.

             * 404 ResourceNotFound - The requested resource was not found.

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 404 ServerNotInSubscription - Specified server does not exist on the specified subscription.

             * 404 SourceDatabaseNotFound - The source database does not exist.

             * 405 UnsupportedReplicationOperation - An unsupported replication operation was initiated on the database.

             * 409 ConflictingServerOperation - An operation is currently in progress for the server.

             * 409 SubscriptionDisabled - Subscription is disabled.

             * 409 ConflictingSystemOperationInProgress - A system maintenance operation is in progress on the database and further operations need to wait until it is completed.

             * 409 GeoReplicationCannotBecomePrimaryDuringUndo - User attempted to failover or force-terminate a geo-link while the secondary is in a state where it may not be physically consistent and so cannot enter the primary role.

             * 409 UpdateSloInProgress - User tried to initiate an incompatible operation while a SLO update was in progress.

             * 409 InstanceFailoverGroupAlreadyExists - Failover group already exists on a given server.

             * 409 InstanceFailoverGroupBusy - Instance failover group is busy with another operation.

             * 409 InstanceFailoverGroupDnsRecordInUse - A duplicate DNS record exists for the requested endpoint.

             * 409 InvalidFailoverGroupName - Invalid Instance Failover Group name was supplied.

             * 409 InvalidOperationForDatabaseNotInReplicationRelationship - A replication seeding operation was performed on a database that is already in a replication relationship.

             * 409 InvalidDatabaseStateForOperation - The operation is not allowed on the database in its current replication state.

             * 409 DuplicateGeoDrRelation - The databases are already in a replication relation. This is a duplicate request.

             * 409 RemoteDatabaseExists - The destination database name already exists on the destination server.

             * 429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.

             * 429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 503 TooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 504 RequestTimeout - Service request exceeded the allowed timeout.
      tags:
        - InstanceFailoverGroups
      x-ms-examples:
        List failover group:
          parameters:
            api-version: 2017-10-01-preview
            locationName: Japan East
            resourceGroupName: Default
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/JapanEast/instanceFailoverGroups/failover-group-test
                    name: failover-group-test
                    properties:
                      managedInstancePairs:
                        - partnerManagedInstanceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance
                          primaryManagedInstanceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance
                      partnerRegions:
                        - location: Japan West
                          replicationRole: Secondary
                      readOnlyEndpoint:
                        failoverPolicy: Disabled
                      readWriteEndpoint:
                        failoverPolicy: Automatic
                        failoverWithDataLossGracePeriodMinutes: 480
                      replicationRole: Primary
                      replicationState: CATCH_UP
                    type: Microsoft.Sql/locations/failoverGroups
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/JapanEast/instanceFailoverGroups/failover-group-test-1
                    name: failover-group-test-1
                    properties:
                      managedInstancePairs:
                        - partnerManagedInstanceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance-1
                          primaryManagedInstanceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance-1
                      partnerRegions:
                        - location: Japan West
                          replicationRole: Secondary
                      readOnlyEndpoint:
                        failoverPolicy: Disabled
                      readWriteEndpoint:
                        failoverPolicy: Automatic
                        failoverWithDataLossGracePeriodMinutes: 480
                      replicationRole: Primary
                      replicationState: CATCH_UP
                    type: Microsoft.Sql/locations/failoverGroups
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}":
    delete:
      description: Deletes a failover group.
      operationId: InstanceFailoverGroups_Delete
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The name of the region where the resource is located.
          in: path
          name: locationName
          required: true
          type: string
        - description: The name of the failover group.
          in: path
          name: failoverGroupName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully deleted the failover group.
        "202":
          description: Accepted
        "204":
          description: The specified failover group does not exist.
        default:
          description: |-
            *** Error Responses: ***

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidPartner - The given partners field in create or update instance failover group request body is empty or invalid.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestDuplicatePartner - One or more of the provided partner servers are already part of the instance failover group. Please make sure the primary server and all of the given partner servers are unique.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidManagedInstanceRegion - The provided partner managed instance region in the instance failover group request body is empty or invalid.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestUnsupportedPartnerCount - Only one partner region is supported.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestUnsupportedPairCount - Only one managed instance pair is supported.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteEndpoint - The readWriteEndpoint field is required for create or update requests.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalid - The create or update instance failover group request body is empty or invalid.

             * 400 InstanceFailoverGroupUpdateOrDeleteRequestOnSecondary - Modifications to the instance failover group are not allowed on a secondary server. Execute the request on the primary server.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestNegativeGracePeriodValues - Grace period value for the read-write endpoint must be non-negative.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteEndpointFields - The property failoverWithDataLossGracePeriodMinutes must be provided when failover policy Automatic is selected for the read-write endpoint.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteFailoverPolicy - The failoverPolicy field for the read-write endpoint is required for create or update requests.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteEndpointFieldsForManualPolicy - Grace period value should not be provided when failover policy Manual is selected for the read-write endpoint.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestReadOnlyPropertyModified - The create or update instance failover group request body should not modify the read-only property '{0}'.

             * 400 InstanceFailoverGroupFailoverRequestOnPrimary - The failover request should be initiated on the secondary server of instance failover group.

             * 400 InstanceFailoverGroupPartnerManagedInstanceFromDifferentSubscription - Primary server and the partner server of failover group are from different subscriptions. Cross subscription for servers of failover group is not allowed.

             * 400 InvalidAddSecondaryPermission - User does not have sufficient permission to add secondary on the specified server.

             * 400 InvalidSku - The user specified an invalid sku.

             * 400 ServerNotFound - The requested server was not found.

             * 400 FeatureDisabledOnSelectedEdition - User attempted to use a feature which is disabled on current database edition.

             * 400 TokenTooLong - The provided token is too long.

             * 400 InvalidTargetSubregion - The target server of a non-readable secondary is not in a DR paired Azure region.

             * 400 IncorrectReplicationLinkState - The operation expects the database to be in an expected state on the replication link.

             * 400 PlannedFailoverTimedOutForDatabase - User invoked planned failover, it timed out, and a specific database appears to be to blame.

             * 400 PlannedFailoverTimedOut - User invoked planned failover, and it timed out while trying to contact the partner management service.

             * 400 CannotUseReservedDatabaseName - Cannot use reserved database name in this operation.

             * 400 InvalidFailoverGroupRegion - Servers specified in an Instance Failover Group need to reside in different regions to provide isolation.

             * 400 InstanceFailoverGroupDoesNotExist - Failover group does not exist on a server.

             * 400 InstanceFailoverGroupNotSecondary - Failover cannot be initiated from the primary server in a instance failover group.

             * 400 InvalidServerName - Invalid server name specified.

             * 400 InvalidIdentifier - The identifier contains NULL or an invalid unicode character.

             * 400 GeoReplicationDatabaseNotSecondary - The operation expects the database to be a replication target.

             * 400 UnableToResolveRemoteServer - The remote partner server name could not be resolved due to an invalid server name or DNS connectivity issues.

             * 400 RemoteDatabaseCopyPermission - User does not have sufficient permission to create a database copy on the specified server.

             * 404 OperationIdNotFound - The operation with Id does not exist.

             * 404 ResourceNotFound - The requested resource was not found.

             * 404 OperationIdNotFound - The operation with Id does not exist.

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 404 ServerNotInSubscription - Specified server does not exist on the specified subscription.

             * 404 SourceDatabaseNotFound - The source database does not exist.

             * 405 UnsupportedReplicationOperation - An unsupported replication operation was initiated on the database.

             * 409 OperationCancelled - The operation has been cancelled by user.

             * 409 OperationInterrupted - The operation on the resource could not be completed because it was interrupted by another operation on the same resource.

             * 409 ConflictingServerOperation - An operation is currently in progress for the server.

             * 409 SubscriptionDisabled - Subscription is disabled.

             * 409 ConflictingSystemOperationInProgress - A system maintenance operation is in progress on the database and further operations need to wait until it is completed.

             * 409 GeoReplicationCannotBecomePrimaryDuringUndo - User attempted to failover or force-terminate a geo-link while the secondary is in a state where it may not be physically consistent and so cannot enter the primary role.

             * 409 UpdateSloInProgress - User tried to initiate an incompatible operation while a SLO update was in progress.

             * 409 InstanceFailoverGroupAlreadyExists - Failover group already exists on a given server.

             * 409 InstanceFailoverGroupBusy - Instance failover group is busy with another operation.

             * 409 InstanceFailoverGroupDnsRecordInUse - A duplicate DNS record exists for the requested endpoint.

             * 409 InvalidFailoverGroupName - Invalid Instance Failover Group name was supplied.

             * 409 InvalidOperationForDatabaseNotInReplicationRelationship - A replication seeding operation was performed on a database that is already in a replication relationship.

             * 409 InvalidDatabaseStateForOperation - The operation is not allowed on the database in its current replication state.

             * 409 DuplicateGeoDrRelation - The databases are already in a replication relation. This is a duplicate request.

             * 409 RemoteDatabaseExists - The destination database name already exists on the destination server.

             * 429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.

             * 429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 500 OperationTimedOut - The operation timed out and automatically rolled back. Please retry the operation.

             * 503 TooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 504 RequestTimeout - Service request exceeded the allowed timeout.
      tags:
        - InstanceFailoverGroups
      x-ms-examples:
        Delete failover group:
          parameters:
            api-version: 2017-10-01-preview
            failoverGroupName: failover-group-test-1
            locationName: Japan East
            resourceGroupName: Default
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200": {}
            "202": {}
            "204": {}
      x-ms-long-running-operation: true
    get:
      description: Gets a failover group.
      operationId: InstanceFailoverGroups_Get
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The name of the region where the resource is located.
          in: path
          name: locationName
          required: true
          type: string
        - description: The name of the failover group.
          in: path
          name: failoverGroupName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the specified failover group.
          schema:
            $ref: "#/definitions/InstanceFailoverGroup"
        default:
          description: |-
            *** Error Responses: ***

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidPartner - The given partners field in create or update instance failover group request body is empty or invalid.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestDuplicatePartner - One or more of the provided partner servers are already part of the instance failover group. Please make sure the primary server and all of the given partner servers are unique.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidManagedInstanceRegion - The provided partner managed instance region in the instance failover group request body is empty or invalid.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestUnsupportedPartnerCount - Only one partner region is supported.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestUnsupportedPairCount - Only one managed instance pair is supported.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteEndpoint - The readWriteEndpoint field is required for create or update requests.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalid - The create or update instance failover group request body is empty or invalid.

             * 400 InstanceFailoverGroupUpdateOrDeleteRequestOnSecondary - Modifications to the instance failover group are not allowed on a secondary server. Execute the request on the primary server.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestNegativeGracePeriodValues - Grace period value for the read-write endpoint must be non-negative.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteEndpointFields - The property failoverWithDataLossGracePeriodMinutes must be provided when failover policy Automatic is selected for the read-write endpoint.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteFailoverPolicy - The failoverPolicy field for the read-write endpoint is required for create or update requests.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteEndpointFieldsForManualPolicy - Grace period value should not be provided when failover policy Manual is selected for the read-write endpoint.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestReadOnlyPropertyModified - The create or update instance failover group request body should not modify the read-only property '{0}'.

             * 400 InstanceFailoverGroupFailoverRequestOnPrimary - The failover request should be initiated on the secondary server of instance failover group.

             * 400 InstanceFailoverGroupPartnerManagedInstanceFromDifferentSubscription - Primary server and the partner server of failover group are from different subscriptions. Cross subscription for servers of failover group is not allowed.

             * 400 InvalidAddSecondaryPermission - User does not have sufficient permission to add secondary on the specified server.

             * 400 InvalidSku - The user specified an invalid sku.

             * 400 ServerNotFound - The requested server was not found.

             * 400 FeatureDisabledOnSelectedEdition - User attempted to use a feature which is disabled on current database edition.

             * 400 TokenTooLong - The provided token is too long.

             * 400 InvalidTargetSubregion - The target server of a non-readable secondary is not in a DR paired Azure region.

             * 400 IncorrectReplicationLinkState - The operation expects the database to be in an expected state on the replication link.

             * 400 PlannedFailoverTimedOutForDatabase - User invoked planned failover, it timed out, and a specific database appears to be to blame.

             * 400 PlannedFailoverTimedOut - User invoked planned failover, and it timed out while trying to contact the partner management service.

             * 400 CannotUseReservedDatabaseName - Cannot use reserved database name in this operation.

             * 400 InvalidFailoverGroupRegion - Servers specified in an Instance Failover Group need to reside in different regions to provide isolation.

             * 400 InstanceFailoverGroupDoesNotExist - Failover group does not exist on a server.

             * 400 InstanceFailoverGroupNotSecondary - Failover cannot be initiated from the primary server in a instance failover group.

             * 400 InvalidServerName - Invalid server name specified.

             * 400 InvalidIdentifier - The identifier contains NULL or an invalid unicode character.

             * 400 GeoReplicationDatabaseNotSecondary - The operation expects the database to be a replication target.

             * 400 UnableToResolveRemoteServer - The remote partner server name could not be resolved due to an invalid server name or DNS connectivity issues.

             * 400 RemoteDatabaseCopyPermission - User does not have sufficient permission to create a database copy on the specified server.

             * 404 ResourceNotFound - The requested resource was not found.

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 404 ServerNotInSubscription - Specified server does not exist on the specified subscription.

             * 404 SourceDatabaseNotFound - The source database does not exist.

             * 405 UnsupportedReplicationOperation - An unsupported replication operation was initiated on the database.

             * 409 ConflictingServerOperation - An operation is currently in progress for the server.

             * 409 SubscriptionDisabled - Subscription is disabled.

             * 409 ConflictingSystemOperationInProgress - A system maintenance operation is in progress on the database and further operations need to wait until it is completed.

             * 409 GeoReplicationCannotBecomePrimaryDuringUndo - User attempted to failover or force-terminate a geo-link while the secondary is in a state where it may not be physically consistent and so cannot enter the primary role.

             * 409 UpdateSloInProgress - User tried to initiate an incompatible operation while a SLO update was in progress.

             * 409 InstanceFailoverGroupAlreadyExists - Failover group already exists on a given server.

             * 409 InstanceFailoverGroupBusy - Instance failover group is busy with another operation.

             * 409 InstanceFailoverGroupDnsRecordInUse - A duplicate DNS record exists for the requested endpoint.

             * 409 InvalidFailoverGroupName - Invalid Instance Failover Group name was supplied.

             * 409 InvalidOperationForDatabaseNotInReplicationRelationship - A replication seeding operation was performed on a database that is already in a replication relationship.

             * 409 InvalidDatabaseStateForOperation - The operation is not allowed on the database in its current replication state.

             * 409 DuplicateGeoDrRelation - The databases are already in a replication relation. This is a duplicate request.

             * 409 RemoteDatabaseExists - The destination database name already exists on the destination server.

             * 429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.

             * 429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 503 TooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 504 RequestTimeout - Service request exceeded the allowed timeout.
      tags:
        - InstanceFailoverGroups
      x-ms-examples:
        Get failover group:
          parameters:
            api-version: 2017-10-01-preview
            failoverGroupName: failover-group-test
            locationName: Japan East
            resourceGroupName: Default
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/JapanEast/instanceFailoverGroups/failover-group-test-3
                name: failover-group-test-3
                properties:
                  managedInstancePairs:
                    - partnerManagedInstanceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance
                      primaryManagedInstanceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance
                  partnerRegions:
                    - location: Japan West
                      replicationRole: Secondary
                  readOnlyEndpoint:
                    failoverPolicy: Disabled
                  readWriteEndpoint:
                    failoverPolicy: Automatic
                    failoverWithDataLossGracePeriodMinutes: 480
                  replicationRole: Primary
                  replicationState: CATCH_UP
                type: Microsoft.Sql/locations/failoverGroups
    put:
      description: Creates or updates a failover group.
      operationId: InstanceFailoverGroups_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The name of the region where the resource is located.
          in: path
          name: locationName
          required: true
          type: string
        - description: The name of the failover group.
          in: path
          name: failoverGroupName
          required: true
          type: string
        - description: The failover group parameters.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/InstanceFailoverGroup"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully updated the failover group.
          schema:
            $ref: "#/definitions/InstanceFailoverGroup"
        "201":
          description: Successfully created the failover group.
          schema:
            $ref: "#/definitions/InstanceFailoverGroup"
        "202":
          description: Accepted
        default:
          description: |-
            *** Error Responses: ***

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidPartner - The given partners field in create or update instance failover group request body is empty or invalid.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestDuplicatePartner - One or more of the provided partner servers are already part of the instance failover group. Please make sure the primary server and all of the given partner servers are unique.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidManagedInstanceRegion - The provided partner managed instance region in the instance failover group request body is empty or invalid.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestUnsupportedPartnerCount - Only one partner region is supported.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestUnsupportedPairCount - Only one managed instance pair is supported.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteEndpoint - The readWriteEndpoint field is required for create or update requests.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalid - The create or update instance failover group request body is empty or invalid.

             * 400 InstanceFailoverGroupUpdateOrDeleteRequestOnSecondary - Modifications to the instance failover group are not allowed on a secondary server. Execute the request on the primary server.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestNegativeGracePeriodValues - Grace period value for the read-write endpoint must be non-negative.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteEndpointFields - The property failoverWithDataLossGracePeriodMinutes must be provided when failover policy Automatic is selected for the read-write endpoint.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteFailoverPolicy - The failoverPolicy field for the read-write endpoint is required for create or update requests.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteEndpointFieldsForManualPolicy - Grace period value should not be provided when failover policy Manual is selected for the read-write endpoint.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestReadOnlyPropertyModified - The create or update instance failover group request body should not modify the read-only property '{0}'.

             * 400 InstanceFailoverGroupFailoverRequestOnPrimary - The failover request should be initiated on the secondary server of instance failover group.

             * 400 InstanceFailoverGroupPartnerManagedInstanceFromDifferentSubscription - Primary server and the partner server of failover group are from different subscriptions. Cross subscription for servers of failover group is not allowed.

             * 400 InvalidAddSecondaryPermission - User does not have sufficient permission to add secondary on the specified server.

             * 400 InvalidSku - The user specified an invalid sku.

             * 400 ServerNotFound - The requested server was not found.

             * 400 FeatureDisabledOnSelectedEdition - User attempted to use a feature which is disabled on current database edition.

             * 400 TokenTooLong - The provided token is too long.

             * 400 InvalidTargetSubregion - The target server of a non-readable secondary is not in a DR paired Azure region.

             * 400 IncorrectReplicationLinkState - The operation expects the database to be in an expected state on the replication link.

             * 400 PlannedFailoverTimedOutForDatabase - User invoked planned failover, it timed out, and a specific database appears to be to blame.

             * 400 PlannedFailoverTimedOut - User invoked planned failover, and it timed out while trying to contact the partner management service.

             * 400 CannotUseReservedDatabaseName - Cannot use reserved database name in this operation.

             * 400 InvalidFailoverGroupRegion - Servers specified in an Instance Failover Group need to reside in different regions to provide isolation.

             * 400 InstanceFailoverGroupDoesNotExist - Failover group does not exist on a server.

             * 400 InstanceFailoverGroupNotSecondary - Failover cannot be initiated from the primary server in a instance failover group.

             * 400 InvalidServerName - Invalid server name specified.

             * 400 InvalidIdentifier - The identifier contains NULL or an invalid unicode character.

             * 400 GeoReplicationDatabaseNotSecondary - The operation expects the database to be a replication target.

             * 400 UnableToResolveRemoteServer - The remote partner server name could not be resolved due to an invalid server name or DNS connectivity issues.

             * 400 RemoteDatabaseCopyPermission - User does not have sufficient permission to create a database copy on the specified server.

             * 404 OperationIdNotFound - The operation with Id does not exist.

             * 404 ResourceNotFound - The requested resource was not found.

             * 404 OperationIdNotFound - The operation with Id does not exist.

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 404 ServerNotInSubscription - Specified server does not exist on the specified subscription.

             * 404 SourceDatabaseNotFound - The source database does not exist.

             * 405 UnsupportedReplicationOperation - An unsupported replication operation was initiated on the database.

             * 409 OperationCancelled - The operation has been cancelled by user.

             * 409 OperationInterrupted - The operation on the resource could not be completed because it was interrupted by another operation on the same resource.

             * 409 ConflictingServerOperation - An operation is currently in progress for the server.

             * 409 SubscriptionDisabled - Subscription is disabled.

             * 409 ConflictingSystemOperationInProgress - A system maintenance operation is in progress on the database and further operations need to wait until it is completed.

             * 409 GeoReplicationCannotBecomePrimaryDuringUndo - User attempted to failover or force-terminate a geo-link while the secondary is in a state where it may not be physically consistent and so cannot enter the primary role.

             * 409 UpdateSloInProgress - User tried to initiate an incompatible operation while a SLO update was in progress.

             * 409 InstanceFailoverGroupAlreadyExists - Failover group already exists on a given server.

             * 409 InstanceFailoverGroupBusy - Instance failover group is busy with another operation.

             * 409 InstanceFailoverGroupDnsRecordInUse - A duplicate DNS record exists for the requested endpoint.

             * 409 InvalidFailoverGroupName - Invalid Instance Failover Group name was supplied.

             * 409 InvalidOperationForDatabaseNotInReplicationRelationship - A replication seeding operation was performed on a database that is already in a replication relationship.

             * 409 InvalidDatabaseStateForOperation - The operation is not allowed on the database in its current replication state.

             * 409 DuplicateGeoDrRelation - The databases are already in a replication relation. This is a duplicate request.

             * 409 RemoteDatabaseExists - The destination database name already exists on the destination server.

             * 429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.

             * 429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 500 OperationTimedOut - The operation timed out and automatically rolled back. Please retry the operation.

             * 503 TooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 504 RequestTimeout - Service request exceeded the allowed timeout.
      tags:
        - InstanceFailoverGroups
      x-ms-examples:
        Create failover group:
          parameters:
            api-version: 2017-10-01-preview
            failoverGroupName: failover-group-test-3
            locationName: Japan East
            parameters:
              properties:
                managedInstancePairs:
                  - partnerManagedInstanceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance
                    primaryManagedInstanceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance
                partnerRegions:
                  - location: Japan West
                readOnlyEndpoint:
                  failoverPolicy: Disabled
                readWriteEndpoint:
                  failoverPolicy: Automatic
                  failoverWithDataLossGracePeriodMinutes: 480
            resourceGroupName: Default
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/JapanEast/instanceFailoverGroups/failover-group-test-3
                name: failover-group-test-3
                properties:
                  managedInstancePairs:
                    - partnerManagedInstanceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance
                      primaryManagedInstanceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance
                  partnerRegions:
                    - location: Japan West
                      replicationRole: Secondary
                  readOnlyEndpoint:
                    failoverPolicy: Disabled
                  readWriteEndpoint:
                    failoverPolicy: Automatic
                    failoverWithDataLossGracePeriodMinutes: 480
                  replicationRole: Primary
                  replicationState: CATCH_UP
                type: Microsoft.Sql/locations/failoverGroups
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/JapanEast/instanceFailoverGroups/failover-group-test-3
                name: failover-group-test-3
                properties:
                  managedInstancePairs:
                    - partnerManagedInstanceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance
                      primaryManagedInstanceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance
                  partnerRegions:
                    - location: Japan West
                      replicationRole: Secondary
                  readOnlyEndpoint:
                    failoverPolicy: Disabled
                  readWriteEndpoint:
                    failoverPolicy: Automatic
                    failoverWithDataLossGracePeriodMinutes: 480
                  replicationRole: Primary
                  replicationState: CATCH_UP
                type: Microsoft.Sql/locations/failoverGroups
            "202": {}
      x-ms-long-running-operation: true
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/failover":
    post:
      description: Fails over from the current primary managed instance to this managed instance.
      operationId: InstanceFailoverGroups_Failover
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The name of the region where the resource is located.
          in: path
          name: locationName
          required: true
          type: string
        - description: The name of the failover group.
          in: path
          name: failoverGroupName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully failed over.
          schema:
            $ref: "#/definitions/InstanceFailoverGroup"
        "202":
          description: Accepted
        default:
          description: |-
            *** Error Responses: ***

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidPartner - The given partners field in create or update instance failover group request body is empty or invalid.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestDuplicatePartner - One or more of the provided partner servers are already part of the instance failover group. Please make sure the primary server and all of the given partner servers are unique.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidManagedInstanceRegion - The provided partner managed instance region in the instance failover group request body is empty or invalid.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestUnsupportedPartnerCount - Only one partner region is supported.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestUnsupportedPairCount - Only one managed instance pair is supported.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteEndpoint - The readWriteEndpoint field is required for create or update requests.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalid - The create or update instance failover group request body is empty or invalid.

             * 400 InstanceFailoverGroupUpdateOrDeleteRequestOnSecondary - Modifications to the instance failover group are not allowed on a secondary server. Execute the request on the primary server.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestNegativeGracePeriodValues - Grace period value for the read-write endpoint must be non-negative.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteEndpointFields - The property failoverWithDataLossGracePeriodMinutes must be provided when failover policy Automatic is selected for the read-write endpoint.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteFailoverPolicy - The failoverPolicy field for the read-write endpoint is required for create or update requests.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteEndpointFieldsForManualPolicy - Grace period value should not be provided when failover policy Manual is selected for the read-write endpoint.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestReadOnlyPropertyModified - The create or update instance failover group request body should not modify the read-only property '{0}'.

             * 400 InstanceFailoverGroupFailoverRequestOnPrimary - The failover request should be initiated on the secondary server of instance failover group.

             * 400 InstanceFailoverGroupPartnerManagedInstanceFromDifferentSubscription - Primary server and the partner server of failover group are from different subscriptions. Cross subscription for servers of failover group is not allowed.

             * 400 InvalidAddSecondaryPermission - User does not have sufficient permission to add secondary on the specified server.

             * 400 InvalidSku - The user specified an invalid sku.

             * 400 ServerNotFound - The requested server was not found.

             * 400 FeatureDisabledOnSelectedEdition - User attempted to use a feature which is disabled on current database edition.

             * 400 TokenTooLong - The provided token is too long.

             * 400 InvalidTargetSubregion - The target server of a non-readable secondary is not in a DR paired Azure region.

             * 400 IncorrectReplicationLinkState - The operation expects the database to be in an expected state on the replication link.

             * 400 PlannedFailoverTimedOutForDatabase - User invoked planned failover, it timed out, and a specific database appears to be to blame.

             * 400 PlannedFailoverTimedOut - User invoked planned failover, and it timed out while trying to contact the partner management service.

             * 400 CannotUseReservedDatabaseName - Cannot use reserved database name in this operation.

             * 400 InvalidFailoverGroupRegion - Servers specified in an Instance Failover Group need to reside in different regions to provide isolation.

             * 400 InstanceFailoverGroupDoesNotExist - Failover group does not exist on a server.

             * 400 InstanceFailoverGroupNotSecondary - Failover cannot be initiated from the primary server in a instance failover group.

             * 400 InvalidServerName - Invalid server name specified.

             * 400 InvalidIdentifier - The identifier contains NULL or an invalid unicode character.

             * 400 GeoReplicationDatabaseNotSecondary - The operation expects the database to be a replication target.

             * 400 UnableToResolveRemoteServer - The remote partner server name could not be resolved due to an invalid server name or DNS connectivity issues.

             * 400 RemoteDatabaseCopyPermission - User does not have sufficient permission to create a database copy on the specified server.

             * 404 OperationIdNotFound - The operation with Id does not exist.

             * 404 ResourceNotFound - The requested resource was not found.

             * 404 OperationIdNotFound - The operation with Id does not exist.

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 404 ServerNotInSubscription - Specified server does not exist on the specified subscription.

             * 404 SourceDatabaseNotFound - The source database does not exist.

             * 405 UnsupportedReplicationOperation - An unsupported replication operation was initiated on the database.

             * 409 OperationCancelled - The operation has been cancelled by user.

             * 409 OperationInterrupted - The operation on the resource could not be completed because it was interrupted by another operation on the same resource.

             * 409 ConflictingServerOperation - An operation is currently in progress for the server.

             * 409 SubscriptionDisabled - Subscription is disabled.

             * 409 ConflictingSystemOperationInProgress - A system maintenance operation is in progress on the database and further operations need to wait until it is completed.

             * 409 GeoReplicationCannotBecomePrimaryDuringUndo - User attempted to failover or force-terminate a geo-link while the secondary is in a state where it may not be physically consistent and so cannot enter the primary role.

             * 409 UpdateSloInProgress - User tried to initiate an incompatible operation while a SLO update was in progress.

             * 409 InstanceFailoverGroupAlreadyExists - Failover group already exists on a given server.

             * 409 InstanceFailoverGroupBusy - Instance failover group is busy with another operation.

             * 409 InstanceFailoverGroupDnsRecordInUse - A duplicate DNS record exists for the requested endpoint.

             * 409 InvalidFailoverGroupName - Invalid Instance Failover Group name was supplied.

             * 409 InvalidOperationForDatabaseNotInReplicationRelationship - A replication seeding operation was performed on a database that is already in a replication relationship.

             * 409 InvalidDatabaseStateForOperation - The operation is not allowed on the database in its current replication state.

             * 409 DuplicateGeoDrRelation - The databases are already in a replication relation. This is a duplicate request.

             * 409 RemoteDatabaseExists - The destination database name already exists on the destination server.

             * 429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.

             * 429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 500 OperationTimedOut - The operation timed out and automatically rolled back. Please retry the operation.

             * 503 TooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 504 RequestTimeout - Service request exceeded the allowed timeout.
      tags:
        - InstanceFailoverGroups
      x-ms-examples:
        Planned failover of a failover group:
          parameters:
            api-version: 2017-10-01-preview
            failoverGroupName: failover-group-test-3
            locationName: Japan West
            resourceGroupName: Default
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/JapanWest/instanceFailoverGroups/failover-group-test-3
                name: failover-group-test-3
                properties:
                  managedInstancePairs:
                    - partnerManagedInstanceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance
                      primaryManagedInstanceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance
                  partnerRegions:
                    - location: Japan East
                      replicationRole: Secondary
                  readOnlyEndpoint:
                    failoverPolicy: Disabled
                  readWriteEndpoint:
                    failoverPolicy: Automatic
                    failoverWithDataLossGracePeriodMinutes: 480
                  replicationRole: Primary
                  replicationState: CATCH_UP
                type: Microsoft.Sql/locations/failoverGroups
            "202": {}
      x-ms-long-running-operation: true
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss":
    post:
      description: Fails over from the current primary managed instance to this managed instance. This operation might result in data loss.
      operationId: InstanceFailoverGroups_ForceFailoverAllowDataLoss
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The name of the region where the resource is located.
          in: path
          name: locationName
          required: true
          type: string
        - description: The name of the failover group.
          in: path
          name: failoverGroupName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully failed over.
          schema:
            $ref: "#/definitions/InstanceFailoverGroup"
        "202":
          description: Accepted
        default:
          description: |-
            *** Error Responses: ***

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidPartner - The given partners field in create or update instance failover group request body is empty or invalid.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestDuplicatePartner - One or more of the provided partner servers are already part of the instance failover group. Please make sure the primary server and all of the given partner servers are unique.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidManagedInstanceRegion - The provided partner managed instance region in the instance failover group request body is empty or invalid.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestUnsupportedPartnerCount - Only one partner region is supported.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestUnsupportedPairCount - Only one managed instance pair is supported.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteEndpoint - The readWriteEndpoint field is required for create or update requests.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalid - The create or update instance failover group request body is empty or invalid.

             * 400 InstanceFailoverGroupUpdateOrDeleteRequestOnSecondary - Modifications to the instance failover group are not allowed on a secondary server. Execute the request on the primary server.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestNegativeGracePeriodValues - Grace period value for the read-write endpoint must be non-negative.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteEndpointFields - The property failoverWithDataLossGracePeriodMinutes must be provided when failover policy Automatic is selected for the read-write endpoint.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteFailoverPolicy - The failoverPolicy field for the read-write endpoint is required for create or update requests.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestInvalidReadWriteEndpointFieldsForManualPolicy - Grace period value should not be provided when failover policy Manual is selected for the read-write endpoint.

             * 400 InstanceFailoverGroupCreateOrUpdateRequestReadOnlyPropertyModified - The create or update instance failover group request body should not modify the read-only property '{0}'.

             * 400 InstanceFailoverGroupFailoverRequestOnPrimary - The failover request should be initiated on the secondary server of instance failover group.

             * 400 InstanceFailoverGroupPartnerManagedInstanceFromDifferentSubscription - Primary server and the partner server of failover group are from different subscriptions. Cross subscription for servers of failover group is not allowed.

             * 400 InvalidAddSecondaryPermission - User does not have sufficient permission to add secondary on the specified server.

             * 400 InvalidSku - The user specified an invalid sku.

             * 400 ServerNotFound - The requested server was not found.

             * 400 FeatureDisabledOnSelectedEdition - User attempted to use a feature which is disabled on current database edition.

             * 400 TokenTooLong - The provided token is too long.

             * 400 InvalidTargetSubregion - The target server of a non-readable secondary is not in a DR paired Azure region.

             * 400 IncorrectReplicationLinkState - The operation expects the database to be in an expected state on the replication link.

             * 400 PlannedFailoverTimedOutForDatabase - User invoked planned failover, it timed out, and a specific database appears to be to blame.

             * 400 PlannedFailoverTimedOut - User invoked planned failover, and it timed out while trying to contact the partner management service.

             * 400 CannotUseReservedDatabaseName - Cannot use reserved database name in this operation.

             * 400 InvalidFailoverGroupRegion - Servers specified in an Instance Failover Group need to reside in different regions to provide isolation.

             * 400 InstanceFailoverGroupDoesNotExist - Failover group does not exist on a server.

             * 400 InstanceFailoverGroupNotSecondary - Failover cannot be initiated from the primary server in a instance failover group.

             * 400 InvalidServerName - Invalid server name specified.

             * 400 InvalidIdentifier - The identifier contains NULL or an invalid unicode character.

             * 400 GeoReplicationDatabaseNotSecondary - The operation expects the database to be a replication target.

             * 400 UnableToResolveRemoteServer - The remote partner server name could not be resolved due to an invalid server name or DNS connectivity issues.

             * 400 RemoteDatabaseCopyPermission - User does not have sufficient permission to create a database copy on the specified server.

             * 404 OperationIdNotFound - The operation with Id does not exist.

             * 404 ResourceNotFound - The requested resource was not found.

             * 404 OperationIdNotFound - The operation with Id does not exist.

             * 404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.

             * 404 ServerNotInSubscription - Specified server does not exist on the specified subscription.

             * 404 SourceDatabaseNotFound - The source database does not exist.

             * 405 UnsupportedReplicationOperation - An unsupported replication operation was initiated on the database.

             * 409 OperationCancelled - The operation has been cancelled by user.

             * 409 OperationInterrupted - The operation on the resource could not be completed because it was interrupted by another operation on the same resource.

             * 409 ConflictingServerOperation - An operation is currently in progress for the server.

             * 409 SubscriptionDisabled - Subscription is disabled.

             * 409 ConflictingSystemOperationInProgress - A system maintenance operation is in progress on the database and further operations need to wait until it is completed.

             * 409 GeoReplicationCannotBecomePrimaryDuringUndo - User attempted to failover or force-terminate a geo-link while the secondary is in a state where it may not be physically consistent and so cannot enter the primary role.

             * 409 UpdateSloInProgress - User tried to initiate an incompatible operation while a SLO update was in progress.

             * 409 InstanceFailoverGroupAlreadyExists - Failover group already exists on a given server.

             * 409 InstanceFailoverGroupBusy - Instance failover group is busy with another operation.

             * 409 InstanceFailoverGroupDnsRecordInUse - A duplicate DNS record exists for the requested endpoint.

             * 409 InvalidFailoverGroupName - Invalid Instance Failover Group name was supplied.

             * 409 InvalidOperationForDatabaseNotInReplicationRelationship - A replication seeding operation was performed on a database that is already in a replication relationship.

             * 409 InvalidDatabaseStateForOperation - The operation is not allowed on the database in its current replication state.

             * 409 DuplicateGeoDrRelation - The databases are already in a replication relation. This is a duplicate request.

             * 409 RemoteDatabaseExists - The destination database name already exists on the destination server.

             * 429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.

             * 429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 500 OperationTimedOut - The operation timed out and automatically rolled back. Please retry the operation.

             * 503 TooManyRequests - Requests beyond max requests that can be processed by available resources.

             * 504 RequestTimeout - Service request exceeded the allowed timeout.
      tags:
        - InstanceFailoverGroups
      x-ms-examples:
        Forced failover of a failover group allowing data loss:
          parameters:
            api-version: 2017-10-01-preview
            failoverGroupName: failover-group-test-3
            locationName: Japan West
            resourceGroupName: Default
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/locations/JapanWest/instanceFailoverGroups/failover-group-test-3
                name: failover-group-test-3
                properties:
                  managedInstancePairs:
                    - partnerManagedInstanceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance
                      primaryManagedInstanceId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance
                  partnerRegions:
                    - location: Japan East
                      replicationRole: Secondary
                  readOnlyEndpoint:
                    failoverPolicy: Disabled
                  readWriteEndpoint:
                    failoverPolicy: Automatic
                    failoverWithDataLossGracePeriodMinutes: 480
                  replicationRole: Primary
                  replicationState: CATCH_UP
                type: Microsoft.Sql/locations/failoverGroups
            "202": {}
      x-ms-long-running-operation: true
definitions:
  InstanceFailoverGroup:
    allOf:
      - allOf:
          - description: ARM resource.
            properties:
              id:
                description: Resource ID.
                readOnly: true
                type: string
              name:
                description: Resource name.
                readOnly: true
                type: string
              type:
                description: Resource type.
                readOnly: true
                type: string
            type: object
            x-ms-azure-resource: true
        description: ARM proxy resource.
        properties: {}
        type: object
    description: An instance failover group.
    properties:
      properties:
        $ref: "#/definitions/InstanceFailoverGroupProperties"
        description: Resource properties.
        x-ms-client-flatten: true
    type: object
  InstanceFailoverGroupListResult:
    description: A list of instance failover groups.
    properties:
      nextLink:
        description: Link to retrieve next page of results.
        readOnly: true
        type: string
      value:
        description: Array of results.
        items:
          $ref: "#/definitions/InstanceFailoverGroup"
        readOnly: true
        type: array
    type: object
  InstanceFailoverGroupProperties:
    description: Properties of a instance failover group.
    properties:
      managedInstancePairs:
        description: List of managed instance pairs in the failover group.
        items:
          $ref: "#/definitions/ManagedInstancePairInfo"
        type: array
      partnerRegions:
        description: Partner region information for the failover group.
        items:
          $ref: "#/definitions/PartnerRegionInfo"
        type: array
        x-ms-mutability:
          - read
          - create
      readOnlyEndpoint:
        $ref: "#/definitions/InstanceFailoverGroupReadOnlyEndpoint"
        description: Read-only endpoint of the failover group instance.
      readWriteEndpoint:
        $ref: "#/definitions/InstanceFailoverGroupReadWriteEndpoint"
        description: Read-write endpoint of the failover group instance.
      replicationRole:
        description: Local replication role of the failover group instance.
        enum:
          - Primary
          - Secondary
        readOnly: true
        type: string
        x-ms-enum:
          modelAsString: true
          name: InstanceFailoverGroupReplicationRole
      replicationState:
        description: Replication state of the failover group instance.
        readOnly: true
        type: string
    required:
      - readWriteEndpoint
      - partnerRegions
      - managedInstancePairs
    type: object
  InstanceFailoverGroupReadOnlyEndpoint:
    description: Read-only endpoint of the failover group instance.
    properties:
      failoverPolicy:
        description: Failover policy of the read-only endpoint for the failover group.
        enum:
          - Disabled
          - Enabled
        type: string
        x-ms-enum:
          modelAsString: true
          name: ReadOnlyEndpointFailoverPolicy
    type: object
  InstanceFailoverGroupReadWriteEndpoint:
    description: Read-write endpoint of the failover group instance.
    properties:
      failoverPolicy:
        description: Failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required.
        enum:
          - Manual
          - Automatic
        type: string
        x-ms-enum:
          modelAsString: true
          name: ReadWriteEndpointFailoverPolicy
      failoverWithDataLossGracePeriodMinutes:
        description: Grace period before failover with data loss is attempted for the read-write endpoint. If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required.
        format: int32
        type: integer
    required:
      - failoverPolicy
    type: object
  ManagedInstancePairInfo:
    description: Pairs of Managed Instances in the failover group.
    properties:
      partnerManagedInstanceId:
        description: Id of Partner Managed Instance in pair.
        type: string
      primaryManagedInstanceId:
        description: Id of Primary Managed Instance in pair.
        type: string
    type: object
  PartnerRegionInfo:
    description: Partner region information for the failover group.
    properties:
      location:
        description: Geo location of the partner managed instances.
        type: string
      replicationRole:
        description: Replication role of the partner managed instances.
        enum:
          - Primary
          - Secondary
        readOnly: true
        type: string
        x-ms-enum:
          modelAsString: true
          name: InstanceFailoverGroupReplicationRole
    type: object
