Skip to content

Commit 9f7cd3b

Browse files
authored
Merge pull request #123235 from ry0y4n/patch-3
Unnecessary Initialization of Log Array
2 parents ae1904d + 712004e commit 9f7cd3b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

articles/azure-monitor/essentials/create-diagnostic-settings.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,10 @@ Use the [New-AzDiagnosticSetting](/powershell/module/az.monitor/new-azdiagnostic
9090
The following example PowerShell cmdlet creates a diagnostic setting for all logs, or for audit logs, and metrics for a key vault by using Log Analytics Workspace.
9191

9292
```powershell
93-
$KV= Get-AzKeyVault -ResourceGroupName <resource group name> -VaultName <key vault name>
94-
$Law= Get-AzOperationalInsightsWorkspace -ResourceGroupName <resource group name> -Name <workspace name> #LAW name is case sensitive
93+
$KV = Get-AzKeyVault -ResourceGroupName <resource group name> -VaultName <key vault name>
94+
$Law = Get-AzOperationalInsightsWorkspace -ResourceGroupName <resource group name> -Name <workspace name> # LAW name is case sensitive
9595
96-
$metric = @()
97-
$log = @()
98-
$metric += New-AzDiagnosticSettingMetricSettingsObject -Enabled $true -Category AllMetrics
96+
$metric = New-AzDiagnosticSettingMetricSettingsObject -Enabled $true -Category AllMetrics
9997
# For all available logs, use:
10098
$log = New-AzDiagnosticSettingLogSettingsObject -Enabled $true -CategoryGroup allLogs
10199
# or, for audit logs, use:

0 commit comments

Comments
 (0)