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-03-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-03-01-preview/serverDnsAliases.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: sql-serverDnsAliases
  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
  DatabaseNameParameter:
    description: The name of the database.
    in: path
    name: databaseName
    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
  SubscriptionIdParameter:
    description: The subscription ID that identifies an Azure subscription.
    in: path
    name: subscriptionId
    required: true
    type: string
    x-ms-parameter-location: client
paths:
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases":
    get:
      description: Gets a list of server DNS aliases for a server.
      operationId: ServerDnsAliases_ListByServer
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The name of the server that the alias is pointing to.
          in: path
          name: serverName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the list of server DNS aliases.
          schema:
            $ref: "#/definitions/ServerDnsAliasListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 ResourceNotFound - The requested resource was not found.
      tags:
        - ServerDnsAliases
      x-ms-examples:
        List server DNS aliases:
          parameters:
            api-version: 2017-03-01-preview
            parameters: {}
            resourceGroupName: Default
            serverName: dns-alias-server
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-server/dnsAliases/dns-alias-1
                    name: server-dns-alias-1
                    properties:
                      azureDnsRecord: dns-alias-1.database.windows.net
                    type: Microsoft.Sql/servers/dnsAliases
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-server/dnsAliases/dns-alias-2
                    name: server-dns-alias-2
                    properties:
                      azureDnsRecord: dns-alias-2.database.windows.net
                    type: Microsoft.Sql/servers/dnsAliases
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}":
    delete:
      description: Deletes the server DNS alias with the given name.
      operationId: ServerDnsAliases_Delete
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The name of the server that the alias is pointing to.
          in: path
          name: serverName
          required: true
          type: string
        - description: The name of the server DNS alias.
          in: path
          name: dnsAliasName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully deleted the server DNS alias.
        "202":
          description: Accepted
        "204":
          description: The specified server DNS alias does not exist.
        default:
          description: |-
            *** Error Responses: ***

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 ResourceNotFound - The requested resource was not found.
      tags:
        - ServerDnsAliases
      x-ms-examples:
        Delete server DNS alias:
          parameters:
            api-version: 2017-03-01-preview
            dnsAliasName: dns-alias-name-1
            resourceGroupName: Default
            serverName: dns-alias-server
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200": {}
            "202": {}
            "204": {}
      x-ms-long-running-operation: true
    get:
      description: Gets a server DNS alias.
      operationId: ServerDnsAliases_Get
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The name of the server that the alias is pointing to.
          in: path
          name: serverName
          required: true
          type: string
        - description: The name of the server DNS alias.
          in: path
          name: dnsAliasName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the specified server DNS alias.
          schema:
            $ref: "#/definitions/ServerDnsAlias"
        default:
          description: |-
            *** Error Responses: ***

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 ResourceNotFound - The requested resource was not found.
      tags:
        - ServerDnsAliases
      x-ms-examples:
        Get server DNS alias:
          parameters:
            api-version: 2017-03-01-preview
            dnsAliasName: dns-alias-name-1
            parameters: {}
            resourceGroupName: Default
            serverName: dns-alias-server
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-server/dnsAliases/dns-alias-name-1
                name: dns-alias-name-1
                properties:
                  azureDnsRecord: dns-alias-name-1.database.windows.net
                type: Microsoft.Sql/servers/dnsAliases
    put:
      description: Creates a server dns alias.
      operationId: ServerDnsAliases_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The name of the server that the alias is pointing to.
          in: path
          name: serverName
          required: true
          type: string
        - description: The name of the server DNS alias.
          in: path
          name: dnsAliasName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: The server DNS alias already exists.
          schema:
            $ref: "#/definitions/ServerDnsAlias"
        "201":
          description: Successfully created a server DNS alias.
          schema:
            $ref: "#/definitions/ServerDnsAlias"
        "202":
          description: Accepted
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidServerDnsAliasAcquireRequest - The acquire server DNS alias request body is empty or invalid (it should contain the old server alias id, for example: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-old-server/dnsAliases/dns-alias-name-1).

             * 400 ServerDnsAliasAcquireRequestInvalidOldServerDnsAliasId - 

             * 400 UnableToResolveRemoteServer - 

             * 400 ServerNotFound - The requested server was not found.

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

             * 400 TokenTooLong - The provided token is too long.

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

             * 400 InvalidServerName - Invalid server name specified.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 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.

             * 409 ServerDnsAliasAlreadyExists - 

             * 409 ServerDnsAliasAlreadyExists - 

             * 409 ServerDnsAliasBusy - 

             * 409 ServerDnsAliasDnsRecordInUse - 

             * 409 InvalidServerDnsAliasName - 

             * 409 SubscriptionDisabled - Subscription is disabled.

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

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

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

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

             * 504 RequestTimeout - Service request exceeded the allowed timeout.
      tags:
        - ServerDnsAliases
      x-ms-examples:
        Create server DNS alias:
          parameters:
            api-version: 2017-03-01-preview
            dnsAliasName: dns-alias-name-1
            parameters: {}
            resourceGroupName: Default
            serverName: dns-alias-server
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-server/dnsAliases/dns-alias-name-1
                name: dns-alias-name-1
                properties:
                  azureDnsRecord: dns-alias-name-1.database.windows.net
                type: Microsoft.Sql/servers/dnsAliases
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-server/dnsAliases/dns-alias-name-1
                name: dns-alias-name-1
                properties:
                  azureDnsRecord: dns-alias-name-1.database.windows.net
                type: Microsoft.Sql/servers/dnsAliases
            "202": {}
      x-ms-long-running-operation: true
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}/acquire":
    post:
      description: Acquires server DNS alias from another server.
      operationId: ServerDnsAliases_Acquire
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The name of the server that the alias is pointing to.
          in: path
          name: serverName
          required: true
          type: string
        - description: The name of the server dns alias.
          in: path
          name: dnsAliasName
          required: true
          type: string
        - in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/ServerDnsAliasAcquisition"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully acquired server DNS alias.
        "202":
          description: Accepted
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidServerDnsAliasAcquireRequest - The acquire server DNS alias request body is empty or invalid (it should contain the old server alias id, for example: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-old-server/dnsAliases/dns-alias-name-1).

             * 400 ServerDnsAliasAcquireRequestInvalidOldServerDnsAliasId - 

             * 400 UnableToResolveRemoteServer - 

             * 400 ServerNotFound - The requested server was not found.

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

             * 400 TokenTooLong - The provided token is too long.

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

             * 400 InvalidServerName - Invalid server name specified.

             * 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.

             * 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 ServerDnsAliasAlreadyExists - 

             * 409 ServerDnsAliasAlreadyExists - 

             * 409 ServerDnsAliasBusy - 

             * 409 ServerDnsAliasDnsRecordInUse - 

             * 409 InvalidServerDnsAliasName - 

             * 409 SubscriptionDisabled - Subscription is disabled.

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

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

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

             * 429 SubscriptionTooManyCreateUpdateRequests - 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.

             * 504 RequestTimeout - Service request exceeded the allowed timeout.
      tags:
        - ServerDnsAliases
      x-ms-examples:
        Acquire server DNS alias:
          parameters:
            api-version: 2017-03-01-preview
            dnsAliasName: dns-alias-name-1
            parameters:
              oldServerDnsAliasId: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-old-server/dnsAliases/dns-alias-name-1
            resourceGroupName: Default
            serverName: dns-alias-new-server
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-new-server/dnsAliases/dns-alias-name-1
                name: server-dns-alias-name-1
                properties:
                  azureDnsRecord: dns-alias-name-1.database.windows.net
                type: Microsoft.Sql/servers/dnsAliases
            "202": {}
      x-ms-long-running-operation: true
definitions:
  ServerDnsAlias:
    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: A server DNS alias.
    properties:
      properties:
        $ref: "#/definitions/ServerDnsAliasProperties"
        description: Resource properties.
        x-ms-client-flatten: true
    type: object
  ServerDnsAliasAcquisition:
    description: A server DNS alias acquisition request.
    properties:
      oldServerDnsAliasId:
        description: The id of the server alias that will be acquired to point to this server instead.
        type: string
    type: object
  ServerDnsAliasListResult:
    description: A list of server DNS aliases.
    properties:
      nextLink:
        description: Link to retrieve next page of results.
        readOnly: true
        type: string
      value:
        description: Array of results.
        items:
          $ref: "#/definitions/ServerDnsAlias"
        readOnly: true
        type: array
    type: object
  ServerDnsAliasProperties:
    description: Properties of a server DNS alias.
    properties:
      azureDnsRecord:
        description: The fully qualified DNS record for alias
        readOnly: true
        type: string
    type: object
