swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: Provides create, read, update, and delete functionality for Azure SQL Database server firewall rules.
  title: Azure SQL Database server firewall rules
  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/firewallRules.json
      version: "2.0"
  x-preferred: false
  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:
  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}/firewallRules":
    get:
      description: Returns a list of firewall rules.
      operationId: FirewallRules_ListByServer
      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/FirewallRuleListResult"
      tags:
        - FirewallRules
      x-ms-examples:
        List Firewall Rules:
          parameters:
            api-version: 2014-04-01
            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
                    kind: v12.0
                    location: Japan East
                    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
                    kind: v12.0
                    location: Japan East
                    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
                    kind: v12.0
                    location: Japan East
                    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
                    kind: v12.0
                    location: Japan East
                    name: firewallrulecrudtest-5767
                    properties:
                      endIpAddress: 0.0.0.2
                      startIpAddress: 0.0.0.2
                    type: Microsoft.Sql/servers/firewallRules
      x-ms-pageable:
        nextLinkName: null
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}":
    delete:
      description: Deletes a firewall rule.
      operationId: FirewallRules_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 firewall rule.
          in: path
          name: firewallRuleName
          required: true
          type: string
      responses:
        "200":
          description: OK
        "204":
          description: NoContent
      tags:
        - FirewallRules
      x-ms-examples:
        Delete a firewall rule:
          parameters:
            api-version: 2014-04-01
            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:
        - 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 firewall rule.
          in: path
          name: firewallRuleName
          required: true
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/FirewallRule"
      tags:
        - FirewallRules
      x-ms-examples:
        Get Firewall Rule:
          parameters:
            api-version: 2014-04-01
            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
                kind: v12.0
                location: Japan East
                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:
        - 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 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"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/FirewallRule"
        "201":
          description: Created
          schema:
            $ref: "#/definitions/FirewallRule"
      tags:
        - FirewallRules
      x-ms-examples:
        Create a firewall rule max/min:
          parameters:
            api-version: 2014-04-01
            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
                kind: v12.0
                location: Japan East
                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
                kind: v12.0
                location: Japan East
                name: firewallrulecrudtest-5370
                properties:
                  endIpAddress: 0.0.0.3
                  startIpAddress: 0.0.0.3
                type: Microsoft.Sql/servers/firewallRules
        Update a firewall rule max/min:
          parameters:
            api-version: 2014-04-01
            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
                kind: v12.0
                location: Japan East
                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
                kind: v12.0
                location: Japan East
                name: firewallrulecrudtest-3927
                properties:
                  endIpAddress: 0.0.0.1
                  startIpAddress: 0.0.0.1
                type: Microsoft.Sql/servers/firewallRules
definitions:
  FirewallRule:
    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 server firewall rule.
    properties:
      kind:
        description: Kind of server that contains this firewall rule.
        readOnly: true
        type: string
      location:
        description: Location of the server that contains this firewall rule.
        readOnly: true
        type: string
      properties:
        $ref: "#/definitions/FirewallRuleProperties"
        description: The properties representing the resource.
        x-ms-client-flatten: true
      type:
        description: Type of resource this is.
        readOnly: true
        type: string
  FirewallRuleListResult:
    description: Represents the response to a List Firewall Rules request.
    properties:
      value:
        description: The list of server firewall rules.
        items:
          $ref: "#/definitions/FirewallRule"
        type: array
  FirewallRuleProperties:
    description: Represents 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' to represent 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' to represent all Azure-internal IP addresses.
        type: string
    required:
      - startIpAddress
      - endIpAddress
