Edit

Share via


Convert-AzSqlDatabaseVulnerabilityAssessmentScan

Converts a vulnerability assessment scan results to Excel format.

Syntax

Default (Default)

Convert-AzSqlDatabaseVulnerabilityAssessmentScan
    [-ServerName] <String>
    [-DatabaseName] <String>
    [-InputObject <VulnerabilityAssessmentScanRecordModel>]
    [-ScanId <String>]
    [-ResourceGroupName] <String>
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Convert-AzSqlDatabaseVulnerabilityAssessmentScan cmdlet converts a scan results, that resides in the customer storage, identified by the ScanId parameter to an Excel format placed in the storage defined by the Set-AzSqlServerVulnerabilityAssessmentSettings cmdlet. Note that you need to run Enable-AzSqlServerAdvancedDataSecurity and Update-AzSqlServerVulnerabilityAssessmentSetting cmdlet as a prerequisite for using this cmdlets.

Examples

Example 1: Converts vulnerability assessment scan results and saves them to local disk

Update-AzSqlServerVulnerabilityAssessmentSetting `
            -ResourceGroupName "ResourceGroup01" `
            -ServerName "Server01" `
            -StorageAccountName "mystorage"

Start-AzSqlDatabaseVulnerabilityAssessmentScan `
            -ResourceGroupName "ResourceGroup01" `
            -ServerName "Server01" `
            -DatabaseName "Database01" `
            -ScanId "myScan"

$convert_scan_results = Convert-AzSqlDatabaseVulnerabilityAssessmentScan `
									-ResourceGroupName "ResourceGroup01" `
									-ServerName "Server01" `
									-DatabaseName "Database01" `
									-ScanId "myScan"
ResourceGroupName		: "ResourceGroup01"
ServerName		        : "Server01"
DatabaseName	    	: "Database01"
ScanId			        : "myScan"
ExportedReportLocation	: "https://myaccount.blob.core.windows.net/vulnerabilityAssessment/Server01/Database01/scan_myScan.xlsx"

$connection_string_to_storage_account = "DefaultEndpointsProtocol=https;AccountName=myaccount...."
$converted_scan_results_download_local_folder = "C:\Downloads\"
$storage_account_context = New-AzStorageContext -ConnectionString $connection_string_to_storage_account
$convert_scan_result_splitted = $convert_scan_results.ExportedReportLocation -split "/"
$container_name = $convert_scan_result_splitted[3]
Get-AzStorageBlobContent -Blob ($a -split $container_name + '/')[1] `
		   -Container $container_name `
		   -Destination $converted_scan_results_download_local_folder `
		   -Context $storage_account_context

Example 2: Converts a vulnerability assessment scan results from a scan record

Get-AzSqlDatabaseVulnerabilityAssessmentScanRecord `
                -ResourceGroupName "ResourceGroup01" `
                -ServerName "Server01" `
                -DatabaseName "Database01" `
                -ScanId "myScan" `
                | Convert-AzSqlDatabaseVulnerabilityAssessmentScan
ResourceGroupName		: "ResourceGroup01"
ServerName		        : "Server01"
DatabaseName	    	: "Database01"
ScanId			        : "myScan"
ExportedReportLocation	: "https://myaccount.blob.core.windows.net/vulnerabilityAssessment/Server01/Database01
                            /scan_myScan.xlsx"

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DatabaseName

SQL Database name.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputObject

The scan record object to use in order to convert a Vulnerability Assessment scan

Parameter properties

Type:VulnerabilityAssessmentScanRecordModel
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceGroupName

The name of the resource group.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ScanId

Specifies the scan ID.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ServerName

SQL Database server name.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

VulnerabilityAssessmentScanRecordModel

Outputs

DatabaseVulnerabilityAssessmentScanExportModel