Share via


Import-SqlVulnerabilityAssessmentBaselineSet

Imports a Vulnerability Assessment baseline set from a file.

Syntax

Default (Default)

Import-SqlVulnerabilityAssessmentBaselineSet
    -FolderPath <String>
    [<CommonParameters>]

Description

The Import-VulnerabilityAssessmentBaselineSet cmdlet imports a Vulnerability Assessment baseline set from a file. This cmdlet can be used to import baseline sets created by 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 baseline set and then import it

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"
PS C:\> $importedBaselineSet = Import-SqlVulnerabilityAssessmentBaselineSet -FolderPath ".\baseline.json"

SecurityCheckBaselines
----------------------
{VA2109}

In this example we export a baseline set to a file named 'baseline.json' and then import it to a variable named 'importedBaselineSet'. The variables 'baselineSet' and 'importedBaselineSet' have the same content.

Parameters

-FolderPath

The path of the file which contains the persisted baseline set.

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

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

None

Outputs

System.Object