Share via


Export-SqlVulnerabilityAssessmentBaselineSet

Exports a Vulnerability Assessment baseline set to a file.

Syntax

Default (Default)

Export-SqlVulnerabilityAssessmentBaselineSet
    -BaselineSet <SecurityCheckBaselineSet>
    -FolderPath <String>
    [-Force]
    [<CommonParameters>]

Description

The Export-SqlVulnerabilityAssessmentBaselineSet cmdlet exports a Vulnerability Assessment baseline set to a file. The output file can be used in SQL Server Management Studio (SSMS).

Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.

This cmdlet was removed in v22.3+ of the module.

Examples

Example 1: Export a Vulnerability Assessment baseline set to a file

PS C:\> $scanResult = Invoke-SqlVulnerabilityAssessmentScan -ServerInstance "MyComputer\MainInstance" -Database some_database
PS C:\> $failedResults = @{}
PS C:\> $scanResult.Results.GetEnumerator() | Where {$_.Value.Status -eq "Failed"} | foreach {$failedResults[$_.Key] = $_.Value }
PS C:\> $failedCheckResults = $failedScanResult["VA2109"].QueryResults
PS C:\> $baseline = New-SqlVulnerabilityAssessmentBaseline -SecurityCheckId "VA2109" -ExpectedResult $failedCheckResults
PS C:\> $baselineSet = New-SqlVulnerabilityAssessmentBaselineSet -Baselines $baseline
PS C:\> $baselineSet | Export-SqlVulnerabilityAssessmentBaselineSet -FolderPath ".\baseline.json"

In this example we create a new baseline set with one baseline for security check 'VA2109' and then export it to a file named 'baseline.json'

Parameters

-BaselineSet

The baseline set to export

Parameter properties

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

Parameter sets

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

-FolderPath

Where the exported file will be saved

Parameter properties

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

Parameter sets

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

-Force

Whether to force overwrite of the file if it already exists. If this parameter is not present, you will be prompted before the operation continues.

Parameter properties

Type:SwitchParameter
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: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

Microsoft.SqlServer.VulnerabilityAssessment.SecurityCheckBaselineSet