Import-SqlVulnerabilityAssessmentBaselineSet
Imports a Vulnerability Assessment baseline set from a file.
Import-SqlVulnerabilityAssessmentBaselineSet
-FolderPath <String>
[<CommonParameters>]
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.
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.
The path of the file which contains the persisted baseline set.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
None
System.Object