Skip to content

Commit ab30df3

Browse files
[Monitor] Fix issue 20207, Used for case-insensitive URI matching (#20423)
* Fix issue 20207, Used for case-insensitive URI matching * Fix issue 20207, Used for case-insensitive URI matching * update changelog Co-authored-by: Jin Lei <[email protected]>
1 parent e511b9b commit ab30df3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Monitor/Monitor/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-->
2020

2121
## Upcoming Release
22+
* Fixed bug for `Remove-AzDataCollectionRuleAssociation` [#20207]
2223
* Added support for test notifications cmdlets
2324
* `Test-AzActionGroup`
2425
* Fixed start time parameter description of `Get-AzActivityLog` [#20409]

src/Monitor/Monitor/DataCollectionRules/RemoveAzureRmDataCollectionRuleAssociationCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
using System;
1616
using System.Management.Automation;
17+
using System.Text.RegularExpressions;
1718

1819
using Microsoft.Azure.Commands.Insights.OutputClasses;
1920
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
@@ -83,12 +84,12 @@ protected override void ProcessRecordInternal()
8384
break;
8485
case ByInputObject:
8586
var dcra = new ResourceIdentifier(InputObject.Id);
86-
TargetResourceId = InputObject.Id.Replace("/providers/Microsoft.Insights/dataCollectionRuleAssociations/" + dcra.ResourceName, "");
87+
TargetResourceId = Regex.Replace(InputObject.Id, "/providers/Microsoft.Insights/dataCollectionRuleAssociations/" + dcra.ResourceName, "", RegexOptions.IgnoreCase);
8788
AssociationName = InputObject.Name;
8889
break;
8990
case ByResourceId:
9091
var dcraById = new ResourceIdentifier(AssociationId);
91-
TargetResourceId = AssociationId.Replace("/providers/Microsoft.Insights/dataCollectionRuleAssociations/" + dcraById.ResourceName, "");
92+
TargetResourceId = Regex.Replace(AssociationId, "/providers/Microsoft.Insights/dataCollectionRuleAssociations/" + dcraById.ResourceName, "", RegexOptions.IgnoreCase);
9293
AssociationName = dcraById.ResourceName;
9394
break;
9495
default:

0 commit comments

Comments
 (0)