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-10-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-10-01-preview/managedDatabaseVulnerabilityAssessmentScans.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: sql-managedDatabaseVulnerabilityAssessmentScans
  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/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans":
    get:
      description: Lists the vulnerability assessment scans of a database.
      operationId: ManagedDatabaseVulnerabilityAssessmentScans_ListByDatabase
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The name of the managed instance.
          in: path
          name: managedInstanceName
          required: true
          type: string
        - $ref: "#/parameters/DatabaseNameParameter"
        - 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 scan records.
          schema:
            $ref: "#/definitions/VulnerabilityAssessmentScanRecordListResult"
        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:
        - ManagedDatabaseVulnerabilityAssessmentScans
      x-ms-examples:
        Gets the list of a database vulnerability assessment scan records:
          parameters:
            api-version: 2017-10-01-preview
            databaseName: testdb
            managedInstanceName: vulnerabilityassessmenttest-6411
            resourceGroupName: vulnerabilityassessmenttest-4711
            subscriptionId: 00000000-1111-2222-3333-444444444444
            vulnerabilityAssessmentName: default
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityassessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityassessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/scans/scan001
                    name: scan001
                    properties:
                      endTime: 2017-12-12T17:47:06Z
                      errors: []
                      numberOfFailedSecurityChecks: 9
                      scanId: scan001
                      startTime: 2017-12-12T17:45:06Z
                      state: Passed
                      storageContainerPath: https://myaccount.blob.core.windows.net/vulnerability-assessment
                      triggerType: OnDemand
                    type: Microsoft.Sql/servers/databases/vulnerabilityAssessments/scans
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityassessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityassessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/scans/scan002
                    name: scan002
                    properties:
                      endTime: 2017-12-12T17:47:06Z
                      errors: []
                      numberOfFailedSecurityChecks: 9
                      scanId: scan002
                      startTime: 2017-12-12T17:45:06Z
                      state: Failed
                      storageContainerPath: https://myaccount.blob.core.windows.net/vulnerability-assessment
                      triggerType: Recurring
                    type: Microsoft.Sql/servers/databases/vulnerabilityAssessments/scans
                  - id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityassessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityassessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/scans/scan003
                    name: scan003
                    properties:
                      endTime: 2017-12-12T17:47:06Z
                      errors:
                        - code: StorageNotFound
                          message: Storage not found
                      numberOfFailedSecurityChecks: 0
                      scanId: scan003
                      startTime: 2017-12-12T17:45:06Z
                      state: FailedToRun
                      storageContainerPath: https://myaccount.blob.core.windows.net/vulnerability-assessment
                      triggerType: Recurring
                    type: Microsoft.Sql/servers/databases/vulnerabilityAssessments/scans
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}":
    get:
      description: Gets a vulnerability assessment scan record of a database.
      operationId: ManagedDatabaseVulnerabilityAssessmentScans_Get
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The name of the managed instance.
          in: path
          name: managedInstanceName
          required: true
          type: string
        - $ref: "#/parameters/DatabaseNameParameter"
        - 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 vulnerability assessment scan Id of the scan to retrieve.
          in: path
          name: scanId
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully retrieved the database vulnerability assessment scan record.
          schema:
            $ref: "#/definitions/VulnerabilityAssessmentScanRecord"
        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:
        - ManagedDatabaseVulnerabilityAssessmentScans
      x-ms-examples:
        Gets a database vulnerability assessment scan record by scan ID:
          parameters:
            api-version: 2017-10-01-preview
            databaseName: testdb
            managedInstanceName: vulnerabilityassessmenttest-6411
            resourceGroupName: vulnerabilityassessmenttest-4711
            scanId: scan001
            subscriptionId: 00000000-1111-2222-3333-444444444444
            vulnerabilityAssessmentName: default
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityassessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityassessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/scans/scan001
                name: scan001
                properties:
                  endTime: 2017-12-12T17:47:06Z
                  errors: []
                  numberOfFailedSecurityChecks: 9
                  scanId: scan001
                  startTime: 2017-12-12T17:45:06Z
                  state: Passed
                  storageContainerPath: https://myaccount.blob.core.windows.net/vulnerability-assessment
                  triggerType: OnDemand
                type: Microsoft.Sql/servers/databases/vulnerabilityAssessments/scans
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export":
    post:
      description: Convert an existing scan result to a human readable format. If already exists nothing happens
      operationId: ManagedDatabaseVulnerabilityAssessmentScans_Export
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The name of the managed instance.
          in: path
          name: managedInstanceName
          required: true
          type: string
        - description: The name of the scanned database.
          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 vulnerability assessment scan Id.
          in: path
          name: scanId
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Scan result was converted successfully.
          schema:
            $ref: "#/definitions/DatabaseVulnerabilityAssessmentScansExport"
        "201":
          description: Scan result was converted successfully.
          schema:
            $ref: "#/definitions/DatabaseVulnerabilityAssessmentScansExport"
        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.

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

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

             * 500 DatabaseIsUnavailable - Loading failed. Please try again later.
      tags:
        - ManagedDatabaseVulnerabilityAssessmentScansExport
      x-ms-examples:
        Export a database's vulnerability assessment scan results.:
          parameters:
            api-version: 2017-10-01-preview
            databaseName: testdb
            managedInstanceName: vulnerabilityassessmenttest-6440
            parameters: {}
            resourceGroupName: vulnerabilityassessmenttest-4799
            scanId: scan001
            subscriptionId: 00000000-1111-2222-3333-444444444444
            vulnerabilityAssessmentName: default
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityassessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityassessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/scans/scan001/export
                name: scan001
                properties:
                  exportedReportLocation: https://myaccount.blob.core.windows.net/vulnerabilityAssessment/vulnerabilityassessmenttest-6440/testdb/scan001.xlsx
                type: Microsoft.Sql/servers/databases/vulnerabilityAssessments/scans/export
            "201":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityassessmenttest-4799/providers/Microsoft.Sql/managedInstances/vulnerabilityassessmenttest-6440/databases/testdb/vulnerabilityAssessments/default/scans/scan001/export
                name: scan001
                properties:
                  exportedReportLocation: https://myaccount.blob.core.windows.net/vulnerabilityAssessment/vulnerabilityassessmenttest-6440/testdb/scan001.xlsx
                type: Microsoft.Sql/servers/databases/vulnerabilityAssessments/scans/export
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan":
    post:
      description: Executes a Vulnerability Assessment database scan.
      operationId: ManagedDatabaseVulnerabilityAssessmentScans_InitiateScan
      parameters:
        - $ref: "#/parameters/ResourceGroupParameter"
        - description: The name of the managed instance.
          in: path
          name: managedInstanceName
          required: true
          type: string
        - $ref: "#/parameters/DatabaseNameParameter"
        - 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 vulnerability assessment scan Id of the scan to retrieve.
          in: path
          name: scanId
          required: true
          type: string
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: Successfully executed a Vulnerability Assessment database scan.
        "202":
          description: Successfully started a Vulnerability Assessment database scan.
        default:
          description: |-
            *** Error Responses: ***

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

             * 400 InvalidVulnerabilityAssessmentScanIdLength - The vulnerability assessment scan ID length must be below {0} characters.

             * 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:
        - ManagedDatabaseVulnerabilityAssessmentScansExecute
      x-ms-examples:
        Executes a database's vulnerability assessment scan.:
          parameters:
            api-version: 2017-10-01-preview
            databaseName: testdb
            managedInstanceName: vulnerabilityassessmenttest-6411
            resourceGroupName: vulnerabilityassessmenttest-4711
            scanId: scan01
            subscriptionId: 00000000-1111-2222-3333-444444444444
            vulnerabilityAssessmentName: default
          responses:
            "200": {}
            "202": {}
      x-ms-long-running-operation: true
definitions:
  DatabaseVulnerabilityAssessmentScanExportProperties:
    description: Properties of the export operation's result.
    properties:
      exportedReportLocation:
        description: Location of the exported report (e.g. https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx).
        readOnly: true
        type: string
    type: object
  DatabaseVulnerabilityAssessmentScansExport:
    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 scan export resource.
    properties:
      properties:
        $ref: "#/definitions/DatabaseVulnerabilityAssessmentScanExportProperties"
        description: Resource properties.
        x-ms-client-flatten: true
    type: object
  VulnerabilityAssessmentScanError:
    description: Properties of a vulnerability assessment scan error.
    properties:
      code:
        description: The error code.
        readOnly: true
        type: string
      message:
        description: The error message.
        readOnly: true
        type: string
    type: object
  VulnerabilityAssessmentScanRecord:
    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 vulnerability assessment scan record.
    properties:
      properties:
        $ref: "#/definitions/VulnerabilityAssessmentScanRecordProperties"
        description: Resource properties.
        x-ms-client-flatten: true
    type: object
  VulnerabilityAssessmentScanRecordListResult:
    description: A list of vulnerability assessment scan records.
    properties:
      nextLink:
        description: Link to retrieve next page of results.
        readOnly: true
        type: string
      value:
        description: Array of results.
        items:
          $ref: "#/definitions/VulnerabilityAssessmentScanRecord"
        readOnly: true
        type: array
    type: object
  VulnerabilityAssessmentScanRecordProperties:
    description: Properties of a vulnerability assessment scan record.
    properties:
      endTime:
        description: The scan end time (UTC).
        format: date-time
        readOnly: true
        type: string
      errors:
        description: The scan errors.
        items:
          $ref: "#/definitions/VulnerabilityAssessmentScanError"
        readOnly: true
        type: array
      numberOfFailedSecurityChecks:
        description: The number of failed security checks.
        format: int32
        readOnly: true
        type: integer
      scanId:
        description: The scan ID.
        readOnly: true
        type: string
      startTime:
        description: The scan start time (UTC).
        format: date-time
        readOnly: true
        type: string
      state:
        description: The scan status.
        enum:
          - Passed
          - Failed
          - FailedToRun
          - InProgress
        readOnly: true
        type: string
        x-ms-enum:
          modelAsString: true
          name: VulnerabilityAssessmentScanState
      storageContainerPath:
        description: The scan results storage container path.
        readOnly: true
        type: string
      triggerType:
        description: The scan trigger type.
        enum:
          - OnDemand
          - Recurring
        readOnly: true
        type: string
        x-ms-enum:
          modelAsString: true
          name: VulnerabilityAssessmentScanTriggerType
    type: object
