swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: Provides create, read, update, delete, and failover functionality for Azure SQL Database disaster recovery configurations.
  title: Azure SQL Database disaster recovery configurations
  version: 2014-04-01
  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/stable/2014-04-01/disasterRecoveryConfigurations.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: sql-disasterRecoveryConfigurations
  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:
  DisasterRecoveryConfigurationNameParameter:
    description: The name of the disaster recovery configuration.
    in: path
    name: disasterRecoveryConfigName
    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
paths:
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration":
    get:
      description: Lists a server's disaster recovery configuration.
      operationId: DisasterRecoveryConfigurations_List
      parameters:
        - description: The API version to use for the request.
          in: query
          name: api-version
          required: true
          type: string
          x-ms-parameter-location: client
        - description: The subscription ID that identifies an Azure subscription.
          in: path
          name: subscriptionId
          required: true
          type: string
          x-ms-parameter-location: client
        - 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
        - $ref: "#/parameters/ServerNameParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/DisasterRecoveryConfigurationListResult"
      tags:
        - DisasterRecoveryConfigurations
      x-ms-examples:
        List Replication links:
          parameters:
            api-version: 2014-04-01
            disasterRecoveryConfigurationName: Default
            resourceGroupName: sqlcrudtest-4799
            serverName: sqlcrudtest-5961
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5961/databases/testdw/geoBackupPolicies/Default
                    location: West US
                    name: Default
                    properties:
                      autoFailover: On
                      failoverPolicy: Automatic
                      logicalServerName: sqlcrudtest-5961
                      partnerLogicalServerName: sqlcrudtest-5962
                      partnerServerId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5962
                      role: Primary
                      status: Ready
                    type: Microsoft.Sql/servers/disasterRecoveryConfigurations
      x-ms-pageable:
        nextLinkName: null
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}":
    delete:
      description: Deletes a disaster recovery configuration.
      operationId: DisasterRecoveryConfigurations_Delete
      parameters:
        - description: The API version to use for the request.
          in: query
          name: api-version
          required: true
          type: string
          x-ms-parameter-location: client
        - description: The subscription ID that identifies an Azure subscription.
          in: path
          name: subscriptionId
          required: true
          type: string
          x-ms-parameter-location: client
        - 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
        - $ref: "#/parameters/ServerNameParameter"
        - description: The name of the disaster recovery configuration to be deleted.
          in: path
          name: disasterRecoveryConfigurationName
          required: true
          type: string
      responses:
        "200":
          description: OK
        "202":
          description: Accepted
        "204":
          description: NoContent
      tags:
        - DisasterRecoveryConfigurations
      x-ms-examples:
        Delete a disaster recovery configuration:
          parameters:
            api-version: 2014-04-01
            disasterRecoveryConfigurationName: Default
            resourceGroupName: sqlcrudtest-4799
            serverName: sqlcrudtest-5961
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200": {}
            "202": {}
            "204": {}
      x-ms-long-running-operation: true
    get:
      description: Gets a disaster recovery configuration.
      operationId: DisasterRecoveryConfigurations_Get
      parameters:
        - description: The API version to use for the request.
          in: query
          name: api-version
          required: true
          type: string
          x-ms-parameter-location: client
        - description: The subscription ID that identifies an Azure subscription.
          in: path
          name: subscriptionId
          required: true
          type: string
          x-ms-parameter-location: client
        - 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
        - $ref: "#/parameters/ServerNameParameter"
        - description: The name of the disaster recovery configuration.
          in: path
          name: disasterRecoveryConfigurationName
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/DisasterRecoveryConfiguration"
      tags:
        - DisasterRecoveryConfigurations
      x-ms-examples:
        Get a disaster recovery configuration:
          parameters:
            api-version: 2014-04-01
            disasterRecoveryConfigurationName: Default
            resourceGroupName: sqlcrudtest-4799
            serverName: sqlcrudtest-5961
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5961/databases/testdw/geoBackupPolicies/Default
                location: West US
                name: Default
                properties:
                  autoFailover: On
                  failoverPolicy: Automatic
                  logicalServerName: sqlcrudtest-5961
                  partnerLogicalServerName: sqlcrudtest-5962
                  partnerServerId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5962
                  role: Primary
                  status: Ready
                type: Microsoft.Sql/servers/disasterRecoveryConfigurations
    put:
      description: Creates or updates a disaster recovery configuration.
      operationId: DisasterRecoveryConfigurations_CreateOrUpdate
      parameters:
        - description: The API version to use for the request.
          in: query
          name: api-version
          required: true
          type: string
          x-ms-parameter-location: client
        - description: The subscription ID that identifies an Azure subscription.
          in: path
          name: subscriptionId
          required: true
          type: string
          x-ms-parameter-location: client
        - 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
        - $ref: "#/parameters/ServerNameParameter"
        - description: The name of the disaster recovery configuration to be created/updated.
          in: path
          name: disasterRecoveryConfigurationName
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/DisasterRecoveryConfiguration"
        "201":
          description: Created
          schema:
            $ref: "#/definitions/DisasterRecoveryConfiguration"
        "202":
          description: Accepted
          schema:
            $ref: "#/definitions/DisasterRecoveryConfiguration"
      tags:
        - DisasterRecoveryConfigurations
      x-ms-examples:
        Update a disaster recovery configuration:
          parameters:
            api-version: 2014-04-01
            disasterRecoveryConfigurationName: Default
            parameters:
              properties:
                autoFailover: On
                failoverPolicy: Automatic
                partnerServerId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5962
            resourceGroupName: sqlcrudtest-4799
            serverName: sqlcrudtest-5961
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5961/databases/testdw/geoBackupPolicies/Default
                location: West US
                name: Default
                properties:
                  autoFailover: On
                  failoverPolicy: Automatic
                  logicalServerName: sqlcrudtest-5961
                  partnerLogicalServerName: sqlcrudtest-5962
                  partnerServerId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5962
                  role: Primary
                  status: Ready
                type: Microsoft.Sql/servers/disasterRecoveryConfigurations
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5961/databases/testdw/geoBackupPolicies/Default
                location: West US
                name: Default
                properties:
                  autoFailover: On
                  failoverPolicy: Automatic
                  logicalServerName: sqlcrudtest-5961
                  partnerLogicalServerName: sqlcrudtest-5962
                  partnerServerId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5962
                  role: Primary
                  status: Ready
                type: Microsoft.Sql/servers/disasterRecoveryConfigurations
            "202":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5961/databases/testdw/geoBackupPolicies/Default
                location: West US
                name: Default
                properties:
                  autoFailover: On
                  failoverPolicy: Automatic
                  logicalServerName: sqlcrudtest-5961
                  partnerLogicalServerName: sqlcrudtest-5962
                  partnerServerId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-5962
                  role: Primary
                  status: Ready
                type: Microsoft.Sql/servers/disasterRecoveryConfigurations
      x-ms-long-running-operation: true
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}/failover":
    post:
      description: Fails over from the current primary server to this server.
      operationId: DisasterRecoveryConfigurations_Failover
      parameters:
        - description: The API version to use for the request.
          in: query
          name: api-version
          required: true
          type: string
          x-ms-parameter-location: client
        - description: The subscription ID that identifies an Azure subscription.
          in: path
          name: subscriptionId
          required: true
          type: string
          x-ms-parameter-location: client
        - 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
        - $ref: "#/parameters/ServerNameParameter"
        - description: The name of the disaster recovery configuration to failover.
          in: path
          name: disasterRecoveryConfigurationName
          required: true
          type: string
      responses:
        "202":
          description: Accepted
        "204":
          description: No Content
      tags:
        - DisasterRecoveryConfigurations
      x-ms-examples:
        Failover a disaster recovery configuration:
          parameters:
            api-version: 2014-04-01
            disasterRecoveryConfigurationName: Default
            resourceGroupName: sqlcrudtest-4799
            serverName: sqlcrudtest-5962
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "202": {}
            "204": {}
      x-ms-long-running-operation: true
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/disasterRecoveryConfiguration/{disasterRecoveryConfigurationName}/forceFailoverAllowDataLoss":
    post:
      description: Fails over from the current primary server to this server. This operation might result in data loss.
      operationId: DisasterRecoveryConfigurations_FailoverAllowDataLoss
      parameters:
        - description: The API version to use for the request.
          in: query
          name: api-version
          required: true
          type: string
          x-ms-parameter-location: client
        - description: The subscription ID that identifies an Azure subscription.
          in: path
          name: subscriptionId
          required: true
          type: string
          x-ms-parameter-location: client
        - 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
        - $ref: "#/parameters/ServerNameParameter"
        - description: The name of the disaster recovery configuration to failover forcefully.
          in: path
          name: disasterRecoveryConfigurationName
          required: true
          type: string
      responses:
        "202":
          description: Accepted
        "204":
          description: No Content
      tags:
        - DisasterRecoveryConfigurations
      x-ms-examples:
        Failover a disaster recovery configuration:
          parameters:
            api-version: 2014-04-01
            disasterRecoveryConfigurationName: Default
            resourceGroupName: sqlcrudtest-4799
            serverName: sqlcrudtest-5962
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "202": {}
            "204": {}
      x-ms-long-running-operation: true
definitions:
  DisasterRecoveryConfiguration:
    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: Represents a disaster recovery configuration.
    properties:
      location:
        description: Location of the server that contains this disaster recovery configuration.
        readOnly: true
        type: string
      properties:
        $ref: "#/definitions/DisasterRecoveryConfigurationProperties"
        description: The properties representing the resource.
        x-ms-client-flatten: true
      type:
        description: Type of resource this is.
        readOnly: true
        type: string
    required:
      - properties
  DisasterRecoveryConfigurationListResult:
    description: Represents the response to a List disaster recovery configuration request.
    properties:
      value:
        description: The list of disaster recovery configurations housed under the server.
        items:
          $ref: "#/definitions/DisasterRecoveryConfiguration"
        type: array
  DisasterRecoveryConfigurationProperties:
    description: Represents the properties of a disaster recovery configuration.
    properties:
      autoFailover:
        description: Whether or not failover can be done automatically.
        enum:
          - Off
          - On
        type: string
        x-ms-enum:
          modelAsString: true
          name: DisasterRecoveryConfigurationAutoFailover
      failoverPolicy:
        description: How aggressive the automatic failover should be.
        enum:
          - Manual
          - Automatic
        type: string
        x-ms-enum:
          modelAsString: true
          name: DisasterRecoveryConfigurationFailoverPolicy
      logicalServerName:
        description: Logical name of the server.
        readOnly: true
        type: string
      partnerLogicalServerName:
        description: Logical name of the partner server.
        readOnly: true
        type: string
      partnerServerId:
        description: Id of the partner server.
        type: string
      role:
        description: The role of the current server in the disaster recovery configuration.
        enum:
          - None
          - Primary
          - Secondary
        readOnly: true
        type: string
        x-ms-enum:
          modelAsString: true
          name: DisasterRecoveryConfigurationRole
      status:
        description: The status of the disaster recovery configuration.
        enum:
          - Creating
          - Ready
          - FailingOver
          - Dropping
        readOnly: true
        type: string
        x-ms-enum:
          modelAsString: true
          name: DisasterRecoveryConfigurationStatus
    required:
      - autoFailover
      - failoverPolicy
      - partnerServerId
