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/databaseVulnerabilityAssessments.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: sql-databaseVulnerabilityAssessments
  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}/databases/{databaseName}/vulnerabilityAssessments":
    get:
      description: Lists the vulnerability assessment policies associated with a database.
      operationId: DatabaseVulnerabilityAssessments_ListByDatabase
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - description: The name of the database for which the vulnerability assessment policies are defined.
          in: path
          name: databaseName
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the database vulnerability assessment policies.
          schema:
            $ref: "#/definitions/DatabaseVulnerabilityAssessmentListResult"
        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 VulnerabilityAssessmentInvalidPolicy - Vulnerability Assessment settings don't exist or invalid storage specified in settings. 

             * 400 DatabaseVulnerabilityAssessmentMissingStorageContainerPath - Storage container path must be provided if it isn't set in server level policy

             * 400 VulnerabilityAssessmentDatawarehouseDatabaseIsDeactivated - Could not execute Vulnerability Assessment operation because the database is paused. Please resume it.

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 SourceDatabaseNotFound - The source database does not exist.

             * 404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.

             * 409 DatabaseVulnerabilityAssessmentScanIsAlreadyInProgress - Vulnerability Assessment scan is already in progress.

             * 500 DatabaseIsUnavailable - Loading failed. Please try again later.
      tags:
        - DatabaseVulnerabilityAssessments
      x-ms-examples:
        Get the database'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
            vulnerabilityAssessmentName: default
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/databases/testdb/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/databases/vulnerabilityAssessments
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}":
    delete:
      description: Removes the database's vulnerability assessment.
      operationId: DatabaseVulnerabilityAssessments_Delete
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - description: The name of the database for which the vulnerability assessment is defined.
          in: path
          name: databaseName
          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 database 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.

             * 400 DatabaseVulnerabilityAssessmentMissingStorageContainerPath - Storage container path must be provided if it isn't set in server level policy

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 SourceDatabaseNotFound - The source database does not exist.

             * 404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.

             * 500 DatabaseIsUnavailable - Loading failed. Please try again later.
      tags:
        - DatabaseVulnerabilityAssessments
      x-ms-examples:
        Remove a database's vulnerability assessment:
          parameters:
            api-version: 2017-03-01-preview
            databaseName: testdb
            resourceGroupName: vulnerabilityaseessmenttest-4799
            serverName: vulnerabilityaseessmenttest-6440
            subscriptionId: 00000000-1111-2222-3333-444444444444
            vulnerabilityAssessmentName: default
          responses:
            "200": {}
    get:
      description: Gets the database's vulnerability assessment.
      operationId: DatabaseVulnerabilityAssessments_Get
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - description: The name of the database for which the vulnerability assessment is defined.
          in: path
          name: databaseName
          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 database vulnerability assessment.
          schema:
            $ref: "#/definitions/DatabaseVulnerabilityAssessment"
        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 DatabaseVulnerabilityAssessmentMissingStorageContainerPath - Storage container path must be provided if it isn't set in server level policy

             * 404 SubscriptionDoesNotHaveServer - The requested server was not found

             * 404 SourceDatabaseNotFound - The source database does not exist.

             * 404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.

             * 500 DatabaseIsUnavailable - Loading failed. Please try again later.
      tags:
        - DatabaseVulnerabilityAssessments
      x-ms-examples:
        Get a database's vulnerability assessment:
          parameters:
            api-version: 2017-03-01-preview
            databaseName: testdb
            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/databases/testdb/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/databases/vulnerabilityAssessments
    put:
      description: Creates or updates the database's vulnerability assessment.
      operationId: DatabaseVulnerabilityAssessments_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - $ref: "#/parameters/ServerNameParameter"
        - description: The name of the database for which the vulnerability assessment is defined.
          in: path
          name: databaseName
          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/DatabaseVulnerabilityAssessment"
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully set the vulnerability assessment.
          schema:
            $ref: "#/definitions/DatabaseVulnerabilityAssessment"
        "201":
          description: Successfully created the vulnerability assessment.
          schema:
            $ref: "#/definitions/DatabaseVulnerabilityAssessment"
        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 DatabaseVulnerabilityAssessmentMissingStorageContainerPath - Storage container path must be provided if it isn't set in server level policy

             * 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

             * 404 SourceDatabaseNotFound - The source database does not exist.

             * 404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.

             * 500 DatabaseIsUnavailable - Loading failed. Please try again later.
      tags:
        - DatabaseVulnerabilityAssessments
      x-ms-examples:
        Create a database's vulnerability assessment with all parameters:
          parameters:
            api-version: 2017-03-01-preview
            databaseName: testdb
            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/databases/testdb/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/databases/vulnerabilityAssessments
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/databases/testdb/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/databases/vulnerabilityAssessments
        "Create a database's vulnerability assessment with minimal parameters, when storageAccountAccessKey is specified":
          parameters:
            api-version: 2017-03-01-preview
            databaseName: testdb
            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/databases/testdb/vulnerabilityAssessments/default
                name: default
                properties:
                  recurringScans:
                    emailSubscriptionAdmins: false
                    emails: []
                    isEnabled: true
                  storageContainerPath: https://myStorage.blob.core.windows.net/vulnerability-assessment/
                type: Microsoft.Sql/servers/databases/vulnerabilityAssessments
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/databases/testdb/vulnerabilityAssessments/default
                name: default
                properties:
                  recurringScans:
                    emailSubscriptionAdmins: false
                    emails: []
                    isEnabled: true
                  storageContainerPath: https://myStorage.blob.core.windows.net/vulnerability-assessment/
                type: Microsoft.Sql/servers/databases/vulnerabilityAssessments
        "Create a database's vulnerability assessment with minimal parameters, when storageContainerSasKey is specified":
          parameters:
            api-version: 2017-03-01-preview
            databaseName: testdb
            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/databases/testdb/vulnerabilityAssessments/default
                name: default
                properties:
                  recurringScans:
                    emailSubscriptionAdmins: false
                    emails: []
                    isEnabled: true
                  storageContainerPath: https://myStorage.blob.core.windows.net/vulnerability-assessment/
                type: Microsoft.Sql/servers/databases/vulnerabilityAssessments
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/databases/testdb/vulnerabilityAssessments/default
                name: default
                properties:
                  recurringScans:
                    emailSubscriptionAdmins: false
                    emails: []
                    isEnabled: true
                  storageContainerPath: https://myStorage.blob.core.windows.net/vulnerability-assessment/
                type: Microsoft.Sql/servers/databases/vulnerabilityAssessments
definitions:
  DatabaseVulnerabilityAssessment:
    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 database vulnerability assessment.
    properties:
      properties:
        $ref: "#/definitions/DatabaseVulnerabilityAssessmentProperties"
        description: Resource properties.
        x-ms-client-flatten: true
    type: object
  DatabaseVulnerabilityAssessmentListResult:
    description: A list of the database'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/DatabaseVulnerabilityAssessment"
        readOnly: true
        type: array
    type: object
  DatabaseVulnerabilityAssessmentProperties:
    description: Properties of a database 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/).  It is required if server level vulnerability assessment policy doesn't set
        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
    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
