swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: The Azure SQL Server management API provides a RESTful set of web services that interact with Azure SQL Server services to manage your databases. The API enables users update server connection policy.
  title: Azure SQL Server API spec
  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/connectionPolicies.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: sql-connectionPolicies
  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:
  ConnectionPolicyNameParameter:
    description: The name of the connection policy.
    enum:
      - default
    in: path
    name: connectionPolicyName
    required: true
    type: string
    x-ms-enum:
      modelAsString: true
      name: ConnectionPolicyName
    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}/connectionPolicies/{connectionPolicyName}":
    get:
      description: Gets the server's secure connection policy.
      operationId: ServerConnectionPolicies_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"
        - $ref: "#/parameters/ConnectionPolicyNameParameter"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/ServerConnectionPolicy"
      tags:
        - ConnectionPolicies
      x-ms-examples:
        Get a server's secure connection policy:
          parameters:
            api-version: 2014-04-01
            connectionPolicyName: default
            resourceGroupName: test-1234
            serverName: test-5678
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-1234/providers/Microsoft.Sql/servers/test-5678/connectionPolicies/default
                kind: null
                location: West US
                name: default
                properties:
                  connectionType: Default
                type: Microsoft.Sql/servers/connectionPolicies
    put:
      description: Creates or updates the server's connection policy.
      operationId: ServerConnectionPolicies_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"
        - $ref: "#/parameters/ConnectionPolicyNameParameter"
        - description: The required parameters for updating a secure connection policy.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/ServerConnectionPolicy"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/ServerConnectionPolicy"
        "201":
          description: Created
          schema:
            $ref: "#/definitions/ServerConnectionPolicy"
      tags:
        - ConnectionPolicies
      x-ms-examples:
        Create or update a server's secure connection policy:
          parameters:
            api-version: 2014-04-01
            connectionPolicyName: default
            parameters:
              properties:
                connectionType: Proxy
            resourceGroupName: test-1234
            serverName: test-5678
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-1234/providers/Microsoft.Sql/servers/test-5678/connectionPolicies/default
                kind: null
                location: West US
                name: default
                properties:
                  connectionType: Proxy
                type: Microsoft.Sql/servers/connectionPolicies
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-1234/providers/Microsoft.Sql/servers/test-5678/connectionPolicies/default
                kind: null
                location: West US
                name: default
                properties:
                  connectionType: Proxy
                type: Microsoft.Sql/servers/connectionPolicies
definitions:
  ServerConnectionPolicy:
    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 secure connection policy.
    properties:
      kind:
        description: Metadata used for the Azure portal experience.
        readOnly: true
        type: string
      location:
        description: Resource location.
        readOnly: true
        type: string
      properties:
        $ref: "#/definitions/ServerConnectionPolicyProperties"
        description: The properties of the server secure connection policy.
        x-ms-client-flatten: true
  ServerConnectionPolicyProperties:
    description: The properties of a server secure connection policy.
    properties:
      connectionType:
        description: The server connection type.
        enum:
          - Default
          - Proxy
          - Redirect
        type: string
        x-ms-enum:
          name: ServerConnectionType
    required:
      - connectionType
