From 512cc446b5f8d5c8aa0bf9d2b6f02f810b5422e2 Mon Sep 17 00:00:00 2001 From: sbojjawar-Msft <76016323+sbojjawar-Msft@users.noreply.github.com> Date: Thu, 4 Mar 2021 10:05:30 -0800 Subject: [PATCH] Update Set-AzSqlDatabaseVulnerabilityAssessmentRuleBaseline.md The default powershell array does not parse the values correctly when there is a single array , However it works fine when there are multiple arrays. The workaround would be to not use the default array and use [System.Collections.ArrayList] as mentioned in here https://github.com/Azure/azure-powershell/issues/12092. Please update the documentation , we have customers wondering why this command is not working on single array. I have added the script above as well in Example 1. --- ...tabaseVulnerabilityAssessmentRuleBaseline.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Sql/Sql/help/Set-AzSqlDatabaseVulnerabilityAssessmentRuleBaseline.md b/src/Sql/Sql/help/Set-AzSqlDatabaseVulnerabilityAssessmentRuleBaseline.md index a6ab1b628d39..3986dd88af1d 100644 --- a/src/Sql/Sql/help/Set-AzSqlDatabaseVulnerabilityAssessmentRuleBaseline.md +++ b/src/Sql/Sql/help/Set-AzSqlDatabaseVulnerabilityAssessmentRuleBaseline.md @@ -28,7 +28,22 @@ Note that you need to run *Enable-AzSqlServerAdvancedDataSecurity* and *Update-A ### Example 1: Set a vulnerability assessment rule baseline ```powershell -PS C:\> Set-AzSqlDatabaseVulnerabilityAssessmentRuleBaseline ` +PS C:\> $arrayList = [System.Collections.ArrayList]::new() +$arrayList.Add(@('dbo', 'db_owner', 'SQL_USER', 'INSTANCE')) + +Set-AzSqlDatabaseVulnerabilityAssessmentRuleBaseline ` + -ResourceGroupName "demoresourcegroup" ` + -ServerName "demosqlser" ` + -DatabaseName "SQL_ERConnect" ` + -BaselineResult $arrayList ` + -RuleID 'VA2108' + + +Rule ID Rule Applies To Master Baseline Results +------- ---------------------- ---------------- +VA2108 False {dbo;db_owner;SQL_USER;INSTANCE} + +Set-AzSqlDatabaseVulnerabilityAssessmentRuleBaseline ` -ResourceGroupName "ResourceGroup01" ` -ServerName "Server01" ` -DatabaseName "Database01" `