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: 2018-06-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/2018-06-01-preview/ServerVulnerabilityAssessments.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: sql-ServerVulnerabilityAssessments
  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
  BlobAuditingPolicyNameParameter:
    description: The name of the blob auditing policy.
    enum:
      - default
    in: path
    name: blobAuditingPolicyName
    required: true
    type: string
    x-ms-parameter-location: method
  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}/vulnerabilityAssessments":
    get:
      description: Lists the vulnerability assessment policies associated with a server.
      operationId: ServerVulnerabilityAssessments_ListByServer
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the server vulnerability assessment policies.
          schema:
            $ref: "#/definitions/ServerVulnerabilityAssessmentListResult"
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidStorageAccountName - The provided storage account is not valid or does not exist.

             * 400 InvalidStorageAccountCredentials - The provided storage account shared access signature or account storage key is not valid.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found
      tags:
        - ServerVulnerabilityAssessments
      x-ms-examples:
        Get a server's vulnerability assessment policies:
          parameters:
            api-version: 2018-06-01-preview
            databaseName: testdb
            resourceGroupName: vulnerabilityaseessmenttest-4799
            serverName: vulnerabilityaseessmenttest-6440
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default
                    name: default
                    properties:
                      recurringScans:
                        emailSubscriptionAdmins: true
                        emails:
                          - email1@mail.com
                          - email2@mail.com
                        isEnabled: true
                      storageContainerPath: https://myStorage.blob.core.windows.net/vulnerability-assessment/
                    type: Microsoft.Sql/servers/vulnerabilityAssessments
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}":
    delete:
      description: Removes the server's vulnerability assessment.
      operationId: ServerVulnerabilityAssessments_Delete
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The name of the server for which the vulnerability assessment is defined.
          in: path
          name: serverName
          required: true
          type: string
        - description: The name of the vulnerability assessment.
          enum:
            - default
          in: path
          name: vulnerabilityAssessmentName
          required: true
          type: string
          x-ms-enum:
            modelAsString: true
            name: VulnerabilityAssessmentName
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully removed the server vulnerability assessment.
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidStorageAccountName - The provided storage account is not valid or does not exist.

             * 400 InvalidStorageAccountCredentials - The provided storage account shared access signature or account storage key is not valid.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found
      tags:
        - ServerVulnerabilityAssessments
      x-ms-examples:
        Remove a server's vulnerability assessment:
          parameters:
            api-version: 2018-06-01-preview
            resourceGroupName: vulnerabilityaseessmenttest-4799
            serverName: vulnerabilityaseessmenttest-6440
            subscriptionId: 00000000-1111-2222-3333-444444444444
            vulnerabilityAssessmentName: default
          responses:
            "200": {}
    get:
      description: Gets the server's vulnerability assessment.
      operationId: ServerVulnerabilityAssessments_Get
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The name of the server for which the vulnerability assessment is defined.
          in: path
          name: serverName
          required: true
          type: string
        - description: The name of the vulnerability assessment.
          enum:
            - default
          in: path
          name: vulnerabilityAssessmentName
          required: true
          type: string
          x-ms-enum:
            modelAsString: true
            name: VulnerabilityAssessmentName
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the server vulnerability assessment.
          schema:
            $ref: "#/definitions/ServerVulnerabilityAssessment"
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidStorageAccountName - The provided storage account is not valid or does not exist.

             * 400 InvalidStorageAccountCredentials - The provided storage account shared access signature or account storage key is not valid.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found
      tags:
        - ServerVulnerabilityAssessments
      x-ms-examples:
        Get a server's vulnerability assessment:
          parameters:
            api-version: 2018-06-01-preview
            resourceGroupName: vulnerabilityaseessmenttest-4799
            serverName: vulnerabilityaseessmenttest-6440
            subscriptionId: 00000000-1111-2222-3333-444444444444
            vulnerabilityAssessmentName: default
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default
                name: default
                properties:
                  recurringScans:
                    emailSubscriptionAdmins: true
                    emails:
                      - email1@mail.com
                      - email2@mail.com
                    isEnabled: true
                  storageContainerPath: https://myStorage.blob.core.windows.net/vulnerability-assessment/
                type: Microsoft.Sql/servers/vulnerabilityAssessments
    put:
      description: Creates or updates the server's vulnerability assessment.
      operationId: ServerVulnerabilityAssessments_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The name of the server for which the vulnerability assessment is defined.
          in: path
          name: serverName
          required: true
          type: string
        - description: The name of the vulnerability assessment.
          enum:
            - default
          in: path
          name: vulnerabilityAssessmentName
          required: true
          type: string
          x-ms-enum:
            modelAsString: true
            name: VulnerabilityAssessmentName
        - description: The requested resource.
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/ServerVulnerabilityAssessment"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully set the vulnerability assessment.
          schema:
            $ref: "#/definitions/ServerVulnerabilityAssessment"
        "201":
          description: Successfully created the vulnerability assessment.
          schema:
            $ref: "#/definitions/ServerVulnerabilityAssessment"
        default:
          description: |-
            *** Error Responses: ***

             * 400 InvalidStorageAccountName - The provided storage account is not valid or does not exist.

             * 400 InvalidStorageAccountCredentials - The provided storage account shared access signature or account storage key is not valid.

             * 400 InvalidVulnerabilityAssessmentOperationRequest - The vulnerability assessment operation request does not exist or has no properties object.

             * 400 DataSecurityInvalidUserSuppliedParameter - An invalid parameter value was provided by the client.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found
      tags:
        - ServerVulnerabilityAssessments
      x-ms-examples:
        Create a server's vulnerability assessment with all parameters:
          parameters:
            api-version: 2018-06-01-preview
            parameters:
              properties:
                recurringScans:
                  emailSubscriptionAdmins: true
                  emails:
                    - email1@mail.com
                    - email2@mail.com
                  isEnabled: true
                storageAccountAccessKey: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                storageContainerPath: https://myStorage.blob.core.windows.net/vulnerability-assessment/
                storageContainerSasKey: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
            resourceGroupName: vulnerabilityaseessmenttest-4799
            serverName: vulnerabilityaseessmenttest-6440
            subscriptionId: 00000000-1111-2222-3333-444444444444
            vulnerabilityAssessmentName: default
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default
                name: default
                properties:
                  recurringScans:
                    emailSubscriptionAdmins: true
                    emails:
                      - email1@mail.com
                      - email2@mail.com
                    isEnabled: true
                  storageContainerPath: https://myStorage.blob.core.windows.net/vulnerability-assessment/
                type: Microsoft.Sql/servers/vulnerabilityAssessments
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default
                name: default
                properties:
                  recurringScans:
                    emailSubscriptionAdmins: true
                    emails:
                      - email1@mail.com
                      - email2@mail.com
                    isEnabled: true
                  storageContainerPath: https://myStorage.blob.core.windows.net/vulnerability-assessment/
                type: Microsoft.Sql/servers/vulnerabilityAssessments
        "Create a server's vulnerability assessment with minimal parameters, when storageAccountAccessKey is specified":
          parameters:
            api-version: 2018-06-01-preview
            parameters:
              properties:
                storageAccountAccessKey: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                storageContainerPath: https://myStorage.blob.core.windows.net/vulnerability-assessment/
            resourceGroupName: vulnerabilityaseessmenttest-4799
            serverName: vulnerabilityaseessmenttest-6440
            subscriptionId: 00000000-1111-2222-3333-444444444444
            vulnerabilityAssessmentName: default
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default
                name: default
                properties:
                  recurringScans:
                    emailSubscriptionAdmins: false
                    emails: []
                    isEnabled: true
                  storageContainerPath: https://myStorage.blob.core.windows.net/vulnerability-assessment/
                type: Microsoft.Sql/servers/vulnerabilityAssessments
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default
                name: default
                properties:
                  recurringScans:
                    emailSubscriptionAdmins: false
                    emails: []
                    isEnabled: true
                  storageContainerPath: https://myStorage.blob.core.windows.net/vulnerability-assessment/
                type: Microsoft.Sql/servers/vulnerabilityAssessments
        "Create a server's vulnerability assessment with minimal parameters, when storageContainerSasKey is specified":
          parameters:
            api-version: 2018-06-01-preview
            parameters:
              properties:
                storageContainerPath: https://myStorage.blob.core.windows.net/vulnerability-assessment/
                storageContainerSasKey: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
            resourceGroupName: vulnerabilityaseessmenttest-4799
            serverName: vulnerabilityaseessmenttest-6440
            subscriptionId: 00000000-1111-2222-3333-444444444444
            vulnerabilityAssessmentName: default
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default
                name: default
                properties:
                  recurringScans:
                    emailSubscriptionAdmins: false
                    emails: []
                    isEnabled: true
                  storageContainerPath: https://myStorage.blob.core.windows.net/vulnerability-assessment/
                type: Microsoft.Sql/servers/vulnerabilityAssessments
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default
                name: default
                properties:
                  recurringScans:
                    emailSubscriptionAdmins: false
                    emails: []
                    isEnabled: true
                  storageContainerPath: https://myStorage.blob.core.windows.net/vulnerability-assessment/
                type: Microsoft.Sql/servers/vulnerabilityAssessments
definitions:
  ServerVulnerabilityAssessment:
    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 vulnerability assessment.
    properties:
      properties:
        $ref: "#/definitions/ServerVulnerabilityAssessmentProperties"
        description: Resource properties.
        x-ms-client-flatten: true
    type: object
  ServerVulnerabilityAssessmentListResult:
    description: A list of the server's vulnerability assessments.
    properties:
      nextLink:
        description: Link to retrieve next page of results.
        readOnly: true
        type: string
      value:
        description: Array of results.
        items:
          $ref: "#/definitions/ServerVulnerabilityAssessment"
        readOnly: true
        type: array
    type: object
  ServerVulnerabilityAssessmentProperties:
    description: Properties of a server Vulnerability Assessment.
    properties:
      recurringScans:
        $ref: "#/definitions/VulnerabilityAssessmentRecurringScansProperties"
        description: The recurring scans settings
      storageAccountAccessKey:
        description: Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required.
        type: string
        x-ms-mutability:
          - create
          - update
      storageContainerPath:
        description: A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/).
        type: string
        x-ms-mutability:
          - create
          - update
      storageContainerSasKey:
        description: A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required.
        type: string
        x-ms-mutability:
          - create
          - update
    required:
      - storageContainerPath
    type: object
  VulnerabilityAssessmentRecurringScansProperties:
    description: Properties of a Vulnerability Assessment recurring scans.
    properties:
      emailSubscriptionAdmins:
        default: true
        description: Specifies that the schedule scan notification will be is sent to the subscription administrators.
        type: boolean
      emails:
        description: Specifies an array of e-mail addresses to which the scan notification is sent.
        items:
          type: string
        type: array
      isEnabled:
        description: Recurring scans state.
        type: boolean
    type: object
