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: 2015-05-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/2015-05-01-preview/firewallRules.json
      version: "2.0"
  x-preferred: true
  x-providerName: azure.com
  x-serviceName: sql-firewallRules
  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
  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/servers/{serverName}/firewallRules":
    get:
      description: Gets a list of firewall rules.
      operationId: FirewallRules_ListByServer
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the list of firewall rules.
          schema:
            $ref: "#/definitions/FirewallRuleListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 ResourceNotFound - The requested resource was not found.
      tags:
        - FirewallRules
      x-ms-examples:
        List Firewall Rules:
          parameters:
            api-version: 2015-05-01-preview
            resourceGroupName: firewallrulecrudtest-12
            serverName: firewallrulecrudtest-6285
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/firewallRules/firewallrulecrudtest-2304
                    name: firewallrulecrudtest-2304
                    properties:
                      endIpAddress: 0.0.0.0
                      startIpAddress: 0.0.0.0
                    type: Microsoft.Sql/servers/firewallRules
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/firewallRules/firewallrulecrudtest-3927
                    name: firewallrulecrudtest-3927
                    properties:
                      endIpAddress: 0.0.0.1
                      startIpAddress: 0.0.0.1
                    type: Microsoft.Sql/servers/firewallRules
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/firewallRules/firewallrulecrudtest-5370
                    name: firewallrulecrudtest-5370
                    properties:
                      endIpAddress: 0.0.0.3
                      startIpAddress: 0.0.0.3
                    type: Microsoft.Sql/servers/firewallRules
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/firewallRules/firewallrulecrudtest-5767
                    name: firewallrulecrudtest-5767
                    properties:
                      endIpAddress: 0.0.0.2
                      startIpAddress: 0.0.0.2
                    type: Microsoft.Sql/servers/firewallRules
      x-ms-pageable:
        nextLinkName: nextLink
    put:
      description: Replaces all firewall rules on the server.
      operationId: FirewallRules_Replace
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/FirewallRuleList"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully updated the firewall rules.
          schema:
            $ref: "#/definitions/FirewallRule"
        "202":
          description: Creating or updating the Server Firewall Rules is in progress.
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidResourceId - Invalid resource identifier.

             * 400 MismatchingSubscriptionWithUrl - The provided subscription did not match the subscription in the Url.

             * 400 MismatchingResourceGroupNameWithUrl - The provided resource group name did not match the name in the Url.

             * 400 MismatchingServerNameWithUrl - The provided server name did not match the name in the Url.

             * 400 InvalidServerFirewallRuleResourceRequest - The server firewall rule resource request is invalid.

             * 400 InvalidServerFirewallRuleResourceParameters - The server firewall rule resource parameter is invalid.

             * 400 FirewallRuleNotIPv4Address - The provided firewall rule address is not IPv4

             * 400 FirewallRuleInvalidRange - The specified firewall rule range is invalid.

             * 400 FirewallRuleNameTooLong - The provided firewall rule name is too long

             * 400 FirewallRuleNameEmpty - The provided firewall rule name is empty

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

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

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

             * 500 OperationTimedOut - The operation timed out and automatically rolled back. Please retry the operation.
      tags:
        - FirewallRules
      x-ms-examples:
        Replace firewall rules:
          parameters:
            api-version: 2015-05-01-preview
            parameters:
              values:
                - name: "firewallrulecrudtest-5370 "
                  properties:
                    endIpAddress: 100.0.0.0
                    startIpAddress: 0.0.0.0
            resourceGroupName: firewallrulecrudtest-12
            serverName: firewallrulecrudtest-6285
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/firewallRules/firewallrulecrudtest-5370
                name: firewallrulecrudtest-5370
                properties:
                  endIpAddress: 0.0.0.3
                  startIpAddress: 0.0.0.3
                type: Microsoft.Sql/servers/firewallRules
            "202": {}
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}":
    delete:
      description: Deletes a firewall rule.
      operationId: FirewallRules_Delete
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - description: The name of the firewall rule.
          in: path
          name: firewallRuleName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully deleted the firewall rule.
        "204":
          description: The specified firewall rule does not exist.
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidResourceId - Invalid resource identifier.

             * 400 MismatchingSubscriptionWithUrl - The provided subscription did not match the subscription in the Url.

             * 400 MismatchingResourceGroupNameWithUrl - The provided resource group name did not match the name in the Url.

             * 400 MismatchingServerNameWithUrl - The provided server name did not match the name in the Url.

             * 400 InvalidServerFirewallRuleResourceRequest - The server firewall rule resource request is invalid.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

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

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

             * 500 OperationTimedOut - The operation timed out and automatically rolled back. Please retry the operation.
      tags:
        - FirewallRules
      x-ms-examples:
        Delete a firewall rule:
          parameters:
            api-version: 2015-05-01-preview
            firewallRuleName: firewallrulecrudtest-7011
            resourceGroupName: firewallrulecrudtest-9886
            serverName: firewallrulecrudtest-2368
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200": {}
            "204": {}
    get:
      description: Gets a firewall rule.
      operationId: FirewallRules_Get
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - description: The name of the firewall rule.
          in: path
          name: firewallRuleName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the specified firewall rule.
          schema:
            $ref: "#/definitions/FirewallRule"
        default:
          description: |-
            *** Error Responses: ***

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 ResourceNotFound - The requested resource was not found.
      tags:
        - FirewallRules
      x-ms-examples:
        Get Firewall Rule:
          parameters:
            api-version: 2015-05-01-preview
            firewallRuleName: firewallrulecrudtest-2304
            resourceGroupName: firewallrulecrudtest-12
            serverName: firewallrulecrudtest-6285
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/firewallRules/firewallrulecrudtest-2304
                name: firewallrulecrudtest-2304
                properties:
                  endIpAddress: 0.0.0.0
                  startIpAddress: 0.0.0.0
                type: Microsoft.Sql/servers/firewallRules
    put:
      description: Creates or updates a firewall rule.
      operationId: FirewallRules_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - description: The name of the firewall rule.
          in: path
          name: firewallRuleName
          required: true
          type: string
        - description: The required parameters for creating or updating a firewall rule.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/FirewallRule"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully updated the firewall rule.
          schema:
            $ref: "#/definitions/FirewallRule"
        "201":
          description: Successfully created the firewall rule.
          schema:
            $ref: "#/definitions/FirewallRule"
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidResourceId - Invalid resource identifier.

             * 400 MismatchingSubscriptionWithUrl - The provided subscription did not match the subscription in the Url.

             * 400 MismatchingResourceGroupNameWithUrl - The provided resource group name did not match the name in the Url.

             * 400 MismatchingServerNameWithUrl - The provided server name did not match the name in the Url.

             * 400 InvalidServerFirewallRuleResourceRequest - The server firewall rule resource request is invalid.

             * 400 InvalidServerFirewallRuleResourceParameters - The server firewall rule resource parameter is invalid.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found
      tags:
        - FirewallRules
      x-ms-examples:
        Create a firewall rule max/min:
          parameters:
            api-version: 2015-05-01-preview
            firewallRuleName: firewallrulecrudtest-5370
            parameters:
              properties:
                endIpAddress: 0.0.0.3
                startIpAddress: 0.0.0.3
            resourceGroupName: firewallrulecrudtest-12
            serverName: firewallrulecrudtest-6285
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/firewallRules/firewallrulecrudtest-5370
                name: firewallrulecrudtest-5370
                properties:
                  endIpAddress: 0.0.0.3
                  startIpAddress: 0.0.0.3
                type: Microsoft.Sql/servers/firewallRules
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/firewallRules/firewallrulecrudtest-5370
                name: firewallrulecrudtest-5370
                properties:
                  endIpAddress: 0.0.0.3
                  startIpAddress: 0.0.0.3
        Update a firewall rule max/min:
          parameters:
            api-version: 2015-05-01-preview
            firewallRuleName: firewallrulecrudtest-3927
            parameters:
              properties:
                endIpAddress: 0.0.0.1
                startIpAddress: 0.0.0.1
            resourceGroupName: firewallrulecrudtest-12
            serverName: firewallrulecrudtest-6285
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/firewallRules/firewallrulecrudtest-3927
                name: firewallrulecrudtest-3927
                properties:
                  endIpAddress: 0.0.0.1
                  startIpAddress: 0.0.0.1
                type: Microsoft.Sql/servers/firewallRules
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/firewallrulecrudtest-12/providers/Microsoft.Sql/servers/firewallrulecrudtest-6285/firewallRules/firewallrulecrudtest-3927
                name: firewallrulecrudtest-3927
                properties:
                  endIpAddress: 0.0.0.1
                  startIpAddress: 0.0.0.1
                type: Microsoft.Sql/servers/firewallRules
definitions:
  FirewallRule:
    allOf:
      - $ref: "#/definitions/ProxyResourceWithWritableName"
    description: A server firewall rule.
    properties:
      properties:
        $ref: "#/definitions/ServerFirewallRuleProperties"
        description: Resource properties.
        x-ms-client-flatten: true
    type: object
  FirewallRuleList:
    description: A list of server firewall rules.
    properties:
      values:
        items:
          $ref: "#/definitions/FirewallRule"
        type: array
    type: object
  FirewallRuleListResult:
    description: The response to a list firewall rules request
    properties:
      nextLink:
        description: Link to retrieve next page of results.
        readOnly: true
        type: string
      value:
        description: Array of results.
        items:
          $ref: "#/definitions/FirewallRule"
        readOnly: true
        type: array
    type: object
  ProxyResourceWithWritableName:
    allOf:
      - $ref: "#/definitions/ResourceWithWritableName"
    description: ARM proxy resource.
    properties: {}
    type: object
  ResourceWithWritableName:
    description: ARM resource.
    properties:
      id:
        description: Resource ID.
        readOnly: true
        type: string
      name:
        description: Resource name.
        type: string
      type:
        description: Resource type.
        readOnly: true
        type: string
    type: object
    x-ms-azure-resource: true
  ServerFirewallRuleProperties:
    description: The properties of a server firewall rule.
    properties:
      endIpAddress:
        description: The end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. Use value '0.0.0.0' for all Azure-internal IP addresses.
        type: string
      startIpAddress:
        description: The start IP address of the firewall rule. Must be IPv4 format. Use value '0.0.0.0' for all Azure-internal IP addresses.
        type: string
    type: object
