Export-SqlVulnerabilityAssessmentBaselineSet
Exports a Vulnerability Assessment baseline set to a file.
Syntax
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
Type: | SecurityCheckBaselineSet |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-FolderPath
Where the exported file will be saved
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | 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.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
Microsoft.SqlServer.VulnerabilityAssessment.SecurityCheckBaselineSet