Skip to content

Commit dfa718f

Browse files
Merge pull request #116552 from Gordiancyber/patch-1
Adding comments to powershell (ln 51-66) script Update diagnostics.md
2 parents 35651a6 + c66c8d8 commit dfa718f

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

articles/application-gateway/for-containers/diagnostics.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,21 @@ Activity logging is automatically enabled for every Resource Manager resource. Y
4949
The following PowerShell sample enables all logging to a storage account for Application Gateway for Containers. Replace the resource group name, storage account name, and subscription ID with your own values. The storage account and resource group must be in the same region as your Application Gateway for Containers.
5050

5151
```PowerShell
52-
$storageAccount = Get-AzStorageAccount -ResourceGroupName acctest5097 -Name centraluseuaptclogs
53-
$metric = @()
54-
$log = @()
55-
$metric += New-AzDiagnosticSettingMetricSettingsObject -Enabled $true -Category AllMetrics -RetentionPolicyDay 30 -RetentionPolicyEnabled $true
56-
$log += New-AzDiagnosticSettingLogSettingsObject -Enabled $true -CategoryGroup allLogs -RetentionPolicyDay 30 -RetentionPolicyEnabled $true
57-
New-AzDiagnosticSetting -Name 'AppGWForContainersLogs' -ResourceId "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/acctest5097/providers/Microsoft.ServiceNetworking/trafficControllers/myagfc" -StorageAccountId $storageAccount.Id -Log $log -Metric $metric
52+
# Retrieve the Azure Storage Account information
53+
$storageAccount = Get-AzStorageAccount -ResourceGroupName acctest5097 -Name centraluseuaptclogs
54+
55+
# Initialize arrays to store metric and log settings
56+
$metric = @()
57+
$log = @()
58+
59+
# Configure metric settings
60+
$metric += New-AzDiagnosticSettingMetricSettingsObject -Enabled $true -Category AllMetrics -RetentionPolicyDay 30 -RetentionPolicyEnabled $true
61+
62+
# Configure log settings
63+
$log += New-AzDiagnosticSettingLogSettingsObject -Enabled $true -CategoryGroup allLogs -RetentionPolicyDay 30 -RetentionPolicyEnabled $true
64+
65+
# Create a new diagnostic setting for the specified resource
66+
New-AzDiagnosticSetting -Name 'AppGWForContainersLogs' -ResourceId "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/acctest5097/providers/Microsoft.ServiceNetworking/trafficControllers/myagfc" -StorageAccountId $storageAccount.Id -Log $log -Metric $metric
5867
```
5968

6069
---

0 commit comments

Comments
 (0)