File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 1919-->
2020
2121## Upcoming Release
22+ * Fixed bug for ` Get-AzDiagnosticSetting ` when metrics or logs are null [ #12272 ]
2223
2324## Version 2.0.1
2425* Fixed input object parameter for ` Set-AzActivityLogAlert `
Original file line number Diff line number Diff line change @@ -62,16 +62,23 @@ public PSServiceDiagnosticSettings(DiagnosticSettingsResource serviceDiagnosticS
6262 this . EventHubName = serviceDiagnosticSettings . EventHubName ;
6363 this . ServiceBusRuleId = serviceDiagnosticSettings . ServiceBusRuleId ;
6464 this . EventHubAuthorizationRuleId = serviceDiagnosticSettings . EventHubAuthorizationRuleId ;
65- this . Metrics = new List < Management . Monitor . Management . Models . MetricSettings > ( ) ;
66- foreach ( MetricSettings metricSettings in serviceDiagnosticSettings . Metrics )
65+
66+ if ( serviceDiagnosticSettings . Metrics != null )
6767 {
68- this . Metrics . Add ( new PSMetricSettings ( metricSettings ) ) ;
68+ this . Metrics = new List < Management . Monitor . Management . Models . MetricSettings > ( ) ;
69+ foreach ( MetricSettings metricSettings in serviceDiagnosticSettings . Metrics )
70+ {
71+ this . Metrics . Add ( new PSMetricSettings ( metricSettings ) ) ;
72+ }
6973 }
7074
71- this . Logs = new List < Management . Monitor . Management . Models . LogSettings > ( ) ;
72- foreach ( LogSettings logSettings in serviceDiagnosticSettings . Logs )
75+ if ( serviceDiagnosticSettings . Logs != null )
7376 {
74- this . Logs . Add ( new PSLogSettings ( logSettings ) ) ;
77+ this . Logs = new List < Management . Monitor . Management . Models . LogSettings > ( ) ;
78+ foreach ( LogSettings logSettings in serviceDiagnosticSettings . Logs )
79+ {
80+ this . Logs . Add ( new PSLogSettings ( logSettings ) ) ;
81+ }
7582 }
7683
7784 this . WorkspaceId = serviceDiagnosticSettings . WorkspaceId ;
You can’t perform that action at this time.
0 commit comments