Skip to content

Commit f9ab9f4

Browse files
Fixing #621 - Exception for 'microsoft.alertsmanagement/smartdetectoralertrules' (#626)
* Fixing #621 - Adding Exception to 'microsoft.alertsmanagement/smartdetectoralertrules' * Adding test for #621 Co-authored-by: James Brundage <@github.com>
1 parent b541958 commit f9ab9f4

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

arm-ttk/testcases/deploymentTemplate/IDs-Should-Be-Derived-From-ResourceIDs.test.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,15 @@ foreach ($id in $ids) {
6363
"sid", # Microsoft.Sql/servers/administrators/activeDirectory
6464
"ruleId", # Microsoft.Network/applicationGatewayWebApplicationFirewallPolicies
6565
"deploymentSpecId" # Microsoft.NetApp/netAppAccounts/volumeGroups
66+
"detector.id" # microsoft.alertsmanagement/smartdetectoralertrules
6667
)
6768

68-
if ($exceptions -contains $myIdFieldName) {
69+
$exceptionRegex =
70+
"(?>" + (@(foreach ($ex in $exceptions) {
71+
$ex.Replace(".", "\.")
72+
}) -join '|') + ")$"
73+
74+
if ("$($id.JSONPath)" -match $exceptionRegex) {
6975
# We're checking resource ids, not tenant IDs
7076
continue
7177
}

unit-tests/IDs-Should-Be-Derived-From-ResourceIDs/Pass/exceptions-that-should-pass.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@
6868
"tenantId": "some data value", // Common Property name
6969
"timezoneId": "some data value", // Microsoft.SQL/managedInstances
7070
"vlanId": "some data value", // Unique Id to establish peering when setting up an ExpressRoute circuit
71-
"workerSizeId": "some data value" // Microsoft.Web/serverFarms (older apiVersions)
71+
"workerSizeId": "some data value", // Microsoft.Web/serverFarms (older apiVersions)
72+
"detector": {
73+
"id": "someDetectorID"
74+
}
7275
},
7376

7477
"tags": {

0 commit comments

Comments
 (0)