From 95bd9ae2409228b6f975ac5504b4144d77b280b3 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Wed, 21 Sep 2022 20:21:56 +0200 Subject: [PATCH 1/7] Updated Insights ScheduledQueryRules to new dependencies approach --- .../ms.insights.scheduledqueryrules.yml | 3 +- .../.test/common/dependencies.bicep | 24 +++++ .../.test/common/deploy.test.bicep | 90 +++++++++++++++++++ .../.test/min/deploy.test.bicep | 37 ++++++++ .../scheduledQueryRules/.test/parameters.json | 71 --------------- .../scheduledQueryRules/readme.md | 59 +++++++++--- 6 files changed, 201 insertions(+), 83 deletions(-) create mode 100644 modules/Microsoft.Insights/scheduledQueryRules/.test/common/dependencies.bicep create mode 100644 modules/Microsoft.Insights/scheduledQueryRules/.test/common/deploy.test.bicep create mode 100644 modules/Microsoft.Insights/scheduledQueryRules/.test/min/deploy.test.bicep delete mode 100644 modules/Microsoft.Insights/scheduledQueryRules/.test/parameters.json diff --git a/.github/workflows/ms.insights.scheduledqueryrules.yml b/.github/workflows/ms.insights.scheduledqueryrules.yml index f08f10e600..a539560e17 100644 --- a/.github/workflows/ms.insights.scheduledqueryrules.yml +++ b/.github/workflows/ms.insights.scheduledqueryrules.yml @@ -106,8 +106,7 @@ jobs: - name: 'Using test file [${{ matrix.moduleTestFilePaths }}]' uses: ./.github/actions/templates/validateModuleDeployment with: - templateFilePath: '${{ env.modulePath }}/deploy.bicep' - parameterFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}' + templateFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}' location: '${{ env.location }}' resourceGroupName: '${{ env.resourceGroupName }}' subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}' diff --git a/modules/Microsoft.Insights/scheduledQueryRules/.test/common/dependencies.bicep b/modules/Microsoft.Insights/scheduledQueryRules/.test/common/dependencies.bicep new file mode 100644 index 0000000000..9e9a8f2510 --- /dev/null +++ b/modules/Microsoft.Insights/scheduledQueryRules/.test/common/dependencies.bicep @@ -0,0 +1,24 @@ +@description('Optional. The location to deploy to.') +param location string = resourceGroup().location + +@description('Required. The name of the Managed Identity to create.') +param managedIdentityName string + +@description('Required. The name of the Log Analytics Workspace to create.') +param logAnalyticsWorkspaceName string + +resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = { + name: managedIdentityName + location: location +} + +resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2021-06-01' = { + name: logAnalyticsWorkspaceName + location: location +} + +@description('The principal ID of the created Managed Identity.') +output managedIdentityPrincipalId string = managedIdentity.properties.principalId + +@description('The resource ID of the created Log Analytics Workspace.') +output logAnalyticsWorkspaceResourceId string = logAnalyticsWorkspace.id diff --git a/modules/Microsoft.Insights/scheduledQueryRules/.test/common/deploy.test.bicep b/modules/Microsoft.Insights/scheduledQueryRules/.test/common/deploy.test.bicep new file mode 100644 index 0000000000..4928e2a038 --- /dev/null +++ b/modules/Microsoft.Insights/scheduledQueryRules/.test/common/deploy.test.bicep @@ -0,0 +1,90 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for testing purposes') +@maxLength(90) +param resourceGroupName string = 'ms.insights.scheduledqueryrules-${serviceShort}-rg' + +@description('Optional. The location to deploy resources to') +param location string = deployment().location + +@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints') +param serviceShort string = 'isqrcom' + +// =========== // +// Deployments // +// =========== // + +// General resources +// ================= +resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { + name: resourceGroupName + location: location +} + +module resourceGroupResources 'dependencies.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name, location)}-paramNested' + params: { + managedIdentityName: 'dep-<>-msi-${serviceShort}' + logAnalyticsWorkspaceName: 'dep-<>-law-${serviceShort}' + } +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + alertDescription: 'My sample Alert' + autoMitigate: false + criterias: { + allOf: [ + { + dimensions: [ + { + name: 'Computer' + operator: 'Include' + values: [ + '*' + ] + } + { + name: 'InstanceName' + operator: 'Include' + values: [ + '*' + ] + } + ] + metricMeasureColumn: 'AggregatedValue' + operator: 'GreaterThan' + query: 'Perf | where ObjectName == \'LogicalDisk\' | where CounterName == \'% Free Space\' | where InstanceName <> \'HarddiskVolume1\' and InstanceName <> \'_Total\' | summarize AggregatedValue = min(CounterValue) by Computer InstanceName bin(TimeGenerated5m)' + threshold: 0 + timeAggregation: 'Average' + } + ] + } + evaluationFrequency: 'PT5M' + queryTimeRange: 'PT5M' + roleAssignments: [ + { + principalIds: [ + resourceGroupResources.outputs.managedIdentityPrincipalId + ] + roleDefinitionIdOrName: 'Reader' + } + ] + scopes: [ + resourceGroupResources.outputs.logAnalyticsWorkspaceResourceId + ] + suppressForMinutes: 'PT5M' + windowSize: 'PT5M' + } +} diff --git a/modules/Microsoft.Insights/scheduledQueryRules/.test/min/deploy.test.bicep b/modules/Microsoft.Insights/scheduledQueryRules/.test/min/deploy.test.bicep new file mode 100644 index 0000000000..e9fe1f007d --- /dev/null +++ b/modules/Microsoft.Insights/scheduledQueryRules/.test/min/deploy.test.bicep @@ -0,0 +1,37 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for testing purposes') +@maxLength(90) +param resourceGroupName string = 'ms.insights.scheduledqueryrules-${serviceShort}-rg' + +@description('Optional. The location to deploy resources to') +param location string = deployment().location + +@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints') +param serviceShort string = 'isqrmin' + +// =========== // +// Deployments // +// =========== // + +// General resources +// ================= +resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { + name: resourceGroupName + location: location +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + } +} diff --git a/modules/Microsoft.Insights/scheduledQueryRules/.test/parameters.json b/modules/Microsoft.Insights/scheduledQueryRules/.test/parameters.json deleted file mode 100644 index 85cb87625b..0000000000 --- a/modules/Microsoft.Insights/scheduledQueryRules/.test/parameters.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "myAlert01" - }, - "alertDescription": { - "value": "My sample Alert" - }, - "scopes": { - "value": [ - "/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001" - ] - }, - "evaluationFrequency": { - "value": "PT5M" - }, - "windowSize": { - "value": "PT5M" - }, - "suppressForMinutes": { - "value": "PT5M" - }, - "queryTimeRange": { - "value": "PT5M" - }, - "autoMitigate": { - "value": false - }, - "criterias": { - "value": { - "allOf": [ - { - "query": "Perf | where ObjectName == \"LogicalDisk\" | where CounterName == \"% Free Space\" | where InstanceName <> \"HarddiskVolume1\" and InstanceName <> \"_Total\" | summarize AggregatedValue = min(CounterValue) by Computer, InstanceName, bin(TimeGenerated,5m)", - "timeAggregation": "Average", - "metricMeasureColumn": "AggregatedValue", - "dimensions": [ - { - "name": "Computer", - "operator": "Include", - "values": [ - "*" - ] - }, - { - "name": "InstanceName", - "operator": "Include", - "values": [ - "*" - ] - } - ], - "operator": "GreaterThan", - "threshold": 0 - } - ] - } - }, - "roleAssignments": { - "value": [ - { - "roleDefinitionIdOrName": "Reader", - "principalIds": [ - "<>" - ] - } - ] - } - } -} diff --git a/modules/Microsoft.Insights/scheduledQueryRules/readme.md b/modules/Microsoft.Insights/scheduledQueryRules/readme.md index e61facec11..75751b7416 100644 --- a/modules/Microsoft.Insights/scheduledQueryRules/readme.md +++ b/modules/Microsoft.Insights/scheduledQueryRules/readme.md @@ -20,12 +20,14 @@ This module deploys a scheduled query rule. ## Parameters **Required parameters** + | Parameter Name | Type | Description | | :-- | :-- | :-- | | `name` | string | The name of the Alert. | | `scopes` | array | The list of resource IDs that this scheduled query rule is scoped to. | **Optional parameters** + | Parameter Name | Type | Default Value | Allowed Values | Description | | :-- | :-- | :-- | :-- | :-- | | `actions` | array | `[]` | | Actions to invoke when the alert fires. | @@ -167,7 +169,7 @@ The following module usage examples are retrieved from the content of the files >**Note**: Each example lists all the required parameters first, followed by the rest - each in alphabetical order. -

Example 1: Parameters

+

Example 1: Common

@@ -175,10 +177,10 @@ The following module usage examples are retrieved from the content of the files ```bicep module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-ScheduledQueryRules' + name: '${uniqueString(deployment().name)}-test-isqrcom' params: { // Required parameters - name: 'myAlert01' + name: '<>isqrcom001' // Non-required parameters alertDescription: 'My sample Alert' autoMitigate: false @@ -203,7 +205,7 @@ module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bice ] metricMeasureColumn: 'AggregatedValue' operator: 'GreaterThan' - query: 'Perf | where ObjectName == \'LogicalDisk\' | where CounterName == \'% Free Space\' | where InstanceName <> \'HarddiskVolume1\' and InstanceName <> \'_Total\' | summarize AggregatedValue = min(CounterValue) by Computer InstanceName bin(TimeGenerated5m)' + query: '' threshold: 0 timeAggregation: 'Average' } @@ -214,13 +216,13 @@ module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bice roleAssignments: [ { principalIds: [ - '<>' + '' ] roleDefinitionIdOrName: 'Reader' } ] scopes: [ - '/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001' + '' ] suppressForMinutes: 'PT5M' windowSize: 'PT5M' @@ -242,7 +244,7 @@ module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bice "parameters": { // Required parameters "name": { - "value": "myAlert01" + "value": "<>isqrcom001" }, // Non-required parameters "alertDescription": { @@ -273,7 +275,7 @@ module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bice ], "metricMeasureColumn": "AggregatedValue", "operator": "GreaterThan", - "query": "Perf | where ObjectName == \"LogicalDisk\" | where CounterName == \"% Free Space\" | where InstanceName <> \"HarddiskVolume1\" and InstanceName <> \"_Total\" | summarize AggregatedValue = min(CounterValue) by Computer, InstanceName, bin(TimeGenerated,5m)", + "query": "", "threshold": 0, "timeAggregation": "Average" } @@ -290,7 +292,7 @@ module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bice "value": [ { "principalIds": [ - "<>" + "" ], "roleDefinitionIdOrName": "Reader" } @@ -298,7 +300,7 @@ module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bice }, "scopes": { "value": [ - "/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001" + "" ] }, "suppressForMinutes": { @@ -313,3 +315,40 @@ module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bice

+ +

Example 2: Min

+ +
+ +via Bicep module + +```bicep +module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-isqrmin' + params: { + name: '<>isqrmin001' + } +} +``` + +
+

+ +

+ +via JSON Parameter file + +```json +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "name": { + "value": "<>isqrmin001" + } + } +} +``` + +
+

From 3d3a71ccd3488c37ac68f0a4578a3fdd9209b9de Mon Sep 17 00:00:00 2001 From: MrMCake Date: Wed, 21 Sep 2022 20:43:21 +0200 Subject: [PATCH 2/7] Small ReadMe fix to account for emtpy lines --- utilities/pipelines/staticValidation/module.tests.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/utilities/pipelines/staticValidation/module.tests.ps1 b/utilities/pipelines/staticValidation/module.tests.ps1 index 5148281387..b005759b0d 100644 --- a/utilities/pipelines/staticValidation/module.tests.ps1 +++ b/utilities/pipelines/staticValidation/module.tests.ps1 @@ -342,7 +342,13 @@ Describe 'Readme tests' -Tag Readme { $expectedColumnsInOrder += @('Description') $readMeCategoryIndex = $readMeContent | Select-String -Pattern "^\*\*$paramCategory parameters\*\*$" | ForEach-Object { $_.LineNumber } - $readmeCategoryColumns = ($readMeContent[$readMeCategoryIndex] -split '\|') | ForEach-Object { $_.Trim() } | Where-Object { -not [String]::IsNullOrEmpty($_) } + + $tableStartIndex = $readMeCategoryIndex + while ($readMeContent[$tableStartIndex] -notlike '*|*' -and -not ($tableStartIndex -ge $readMeContent.count)) { + $tableStartIndex++ + } + + $readmeCategoryColumns = ($readMeContent[$tableStartIndex] -split '\|') | ForEach-Object { $_.Trim() } | Where-Object { -not [String]::IsNullOrEmpty($_) } $readmeCategoryColumns | Should -Be $expectedColumnsInOrder } From 05907246bc208c3ed238f56623046fd4ab7ef3b1 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Wed, 21 Sep 2022 21:41:35 +0200 Subject: [PATCH 3/7] Updated ScheduledQueryRules --- .../.test/min/deploy.test.bicep | 37 ------------- .../scheduledQueryRules/deploy.bicep | 5 +- .../scheduledQueryRules/readme.md | 55 +++---------------- 3 files changed, 11 insertions(+), 86 deletions(-) delete mode 100644 modules/Microsoft.Insights/scheduledQueryRules/.test/min/deploy.test.bicep diff --git a/modules/Microsoft.Insights/scheduledQueryRules/.test/min/deploy.test.bicep b/modules/Microsoft.Insights/scheduledQueryRules/.test/min/deploy.test.bicep deleted file mode 100644 index e9fe1f007d..0000000000 --- a/modules/Microsoft.Insights/scheduledQueryRules/.test/min/deploy.test.bicep +++ /dev/null @@ -1,37 +0,0 @@ -targetScope = 'subscription' - -// ========== // -// Parameters // -// ========== // -@description('Optional. The name of the resource group to deploy for testing purposes') -@maxLength(90) -param resourceGroupName string = 'ms.insights.scheduledqueryrules-${serviceShort}-rg' - -@description('Optional. The location to deploy resources to') -param location string = deployment().location - -@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints') -param serviceShort string = 'isqrmin' - -// =========== // -// Deployments // -// =========== // - -// General resources -// ================= -resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { - name: resourceGroupName - location: location -} - -// ============== // -// Test Execution // -// ============== // - -module testDeployment '../../deploy.bicep' = { - scope: resourceGroup - name: '${uniqueString(deployment().name)}-test-${serviceShort}' - params: { - name: '<>${serviceShort}001' - } -} diff --git a/modules/Microsoft.Insights/scheduledQueryRules/deploy.bicep b/modules/Microsoft.Insights/scheduledQueryRules/deploy.bicep index 325eaa0b07..8ba8d173fa 100644 --- a/modules/Microsoft.Insights/scheduledQueryRules/deploy.bicep +++ b/modules/Microsoft.Insights/scheduledQueryRules/deploy.bicep @@ -33,7 +33,7 @@ param targetResourceTypes array = [] param roleAssignments array = [] @description('Required. The list of resource IDs that this scheduled query rule is scoped to.') -param scopes array = [] +param scopes array @description('Optional. Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only for rules of the kind LogAlert.') @allowed([ @@ -54,7 +54,7 @@ param windowSize string = '' @description('Optional. Actions to invoke when the alert fires.') param actions array = [] -@description('Optional. The rule criteria that defines the conditions of the scheduled query rule.') +@description('Required. The rule criteria that defines the conditions of the scheduled query rule.') param criterias object = {} @description('Optional. Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired. If set, autoMitigate must be disabled.Relevant only for rules of the kind LogAlert.') @@ -90,7 +90,6 @@ resource queryRule 'Microsoft.Insights/scheduledQueryRules@2021-02-01-preview' = } autoMitigate: (kind == 'LogAlert') ? autoMitigate : null criteria: criterias - description: alertDescription displayName: name enabled: enabled diff --git a/modules/Microsoft.Insights/scheduledQueryRules/readme.md b/modules/Microsoft.Insights/scheduledQueryRules/readme.md index 75751b7416..853c2fcc87 100644 --- a/modules/Microsoft.Insights/scheduledQueryRules/readme.md +++ b/modules/Microsoft.Insights/scheduledQueryRules/readme.md @@ -23,6 +23,7 @@ This module deploys a scheduled query rule. | Parameter Name | Type | Description | | :-- | :-- | :-- | +| `criterias` | object | The rule criteria that defines the conditions of the scheduled query rule. | | `name` | string | The name of the Alert. | | `scopes` | array | The list of resource IDs that this scheduled query rule is scoped to. | @@ -33,7 +34,6 @@ This module deploys a scheduled query rule. | `actions` | array | `[]` | | Actions to invoke when the alert fires. | | `alertDescription` | string | `''` | | The description of the scheduled query rule. | | `autoMitigate` | bool | `True` | | The flag that indicates whether the alert should be automatically resolved or not. Relevant only for rules of the kind LogAlert. | -| `criterias` | object | `{object}` | | The rule criteria that defines the conditions of the scheduled query rule. | | `enabled` | bool | `True` | | The flag which indicates whether this scheduled query rule is enabled. | | `enableDefaultTelemetry` | bool | `True` | | Enable telemetry via the Customer Usage Attribution ID (GUID). | | `evaluationFrequency` | string | `''` | | How often the scheduled query rule is evaluated represented in ISO 8601 duration format. Relevant and required only for rules of the kind LogAlert. | @@ -181,6 +181,9 @@ module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bice params: { // Required parameters name: '<>isqrcom001' + scopes: [ + '' + ] // Non-required parameters alertDescription: 'My sample Alert' autoMitigate: false @@ -221,9 +224,6 @@ module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bice roleDefinitionIdOrName: 'Reader' } ] - scopes: [ - '' - ] suppressForMinutes: 'PT5M' windowSize: 'PT5M' } @@ -246,6 +246,11 @@ module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bice "name": { "value": "<>isqrcom001" }, + "scopes": { + "value": [ + "" + ] + }, // Non-required parameters "alertDescription": { "value": "My sample Alert" @@ -298,11 +303,6 @@ module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bice } ] }, - "scopes": { - "value": [ - "" - ] - }, "suppressForMinutes": { "value": "PT5M" }, @@ -315,40 +315,3 @@ module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bice

- -

Example 2: Min

- -
- -via Bicep module - -```bicep -module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-test-isqrmin' - params: { - name: '<>isqrmin001' - } -} -``` - -
-

- -

- -via JSON Parameter file - -```json -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>isqrmin001" - } - } -} -``` - -
-

From 9b922186e175102b2eb32cbfec083aa24f2c549a Mon Sep 17 00:00:00 2001 From: MrMCake Date: Wed, 21 Sep 2022 21:45:38 +0200 Subject: [PATCH 4/7] Update to latest --- .../scheduledQueryRules/deploy.bicep | 2 +- .../scheduledQueryRules/readme.md | 44 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/modules/Microsoft.Insights/scheduledQueryRules/deploy.bicep b/modules/Microsoft.Insights/scheduledQueryRules/deploy.bicep index 8ba8d173fa..d706cccf5a 100644 --- a/modules/Microsoft.Insights/scheduledQueryRules/deploy.bicep +++ b/modules/Microsoft.Insights/scheduledQueryRules/deploy.bicep @@ -55,7 +55,7 @@ param windowSize string = '' param actions array = [] @description('Required. The rule criteria that defines the conditions of the scheduled query rule.') -param criterias object = {} +param criterias object @description('Optional. Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired. If set, autoMitigate must be disabled.Relevant only for rules of the kind LogAlert.') param suppressForMinutes string = '' diff --git a/modules/Microsoft.Insights/scheduledQueryRules/readme.md b/modules/Microsoft.Insights/scheduledQueryRules/readme.md index 853c2fcc87..cf99cbfb9a 100644 --- a/modules/Microsoft.Insights/scheduledQueryRules/readme.md +++ b/modules/Microsoft.Insights/scheduledQueryRules/readme.md @@ -180,13 +180,6 @@ module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bice name: '${uniqueString(deployment().name)}-test-isqrcom' params: { // Required parameters - name: '<>isqrcom001' - scopes: [ - '' - ] - // Non-required parameters - alertDescription: 'My sample Alert' - autoMitigate: false criterias: { allOf: [ { @@ -214,6 +207,13 @@ module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bice } ] } + name: '<>isqrcom001' + scopes: [ + '' + ] + // Non-required parameters + alertDescription: 'My sample Alert' + autoMitigate: false evaluationFrequency: 'PT5M' queryTimeRange: 'PT5M' roleAssignments: [ @@ -243,21 +243,6 @@ module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bice "contentVersion": "1.0.0.0", "parameters": { // Required parameters - "name": { - "value": "<>isqrcom001" - }, - "scopes": { - "value": [ - "" - ] - }, - // Non-required parameters - "alertDescription": { - "value": "My sample Alert" - }, - "autoMitigate": { - "value": false - }, "criterias": { "value": { "allOf": [ @@ -287,6 +272,21 @@ module scheduledQueryRules './Microsoft.Insights/scheduledQueryRules/deploy.bice ] } }, + "name": { + "value": "<>isqrcom001" + }, + "scopes": { + "value": [ + "" + ] + }, + // Non-required parameters + "alertDescription": { + "value": "My sample Alert" + }, + "autoMitigate": { + "value": false + }, "evaluationFrequency": { "value": "PT5M" }, From 263a78a3f250c40e6debf33225c6ceaf5a15f8a5 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Wed, 21 Sep 2022 22:52:59 +0200 Subject: [PATCH 5/7] Update to latest --- .../scheduledQueryRules/.test/common/deploy.test.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Microsoft.Insights/scheduledQueryRules/.test/common/deploy.test.bicep b/modules/Microsoft.Insights/scheduledQueryRules/.test/common/deploy.test.bicep index 4928e2a038..c1a475cfd4 100644 --- a/modules/Microsoft.Insights/scheduledQueryRules/.test/common/deploy.test.bicep +++ b/modules/Microsoft.Insights/scheduledQueryRules/.test/common/deploy.test.bicep @@ -65,7 +65,7 @@ module testDeployment '../../deploy.bicep' = { ] metricMeasureColumn: 'AggregatedValue' operator: 'GreaterThan' - query: 'Perf | where ObjectName == \'LogicalDisk\' | where CounterName == \'% Free Space\' | where InstanceName <> \'HarddiskVolume1\' and InstanceName <> \'_Total\' | summarize AggregatedValue = min(CounterValue) by Computer InstanceName bin(TimeGenerated5m)' + query: 'Perf | where ObjectName == "LogicalDisk" | where CounterName == "% Free Space" | where InstanceName <> "HarddiskVolume1" and InstanceName <> "_Total" | summarize AggregatedValue = min(CounterValue) by Computer, InstanceName, bin(TimeGenerated,5m)' threshold: 0 timeAggregation: 'Average' } From 8ec5a3a616322196777661e0ed8e4981612fc5ad Mon Sep 17 00:00:00 2001 From: MrMCake Date: Wed, 5 Oct 2022 14:55:30 +0200 Subject: [PATCH 6/7] Update to latest --- .../scheduledQueryRules/.test/common/deploy.test.bicep | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/Microsoft.Insights/scheduledQueryRules/.test/common/deploy.test.bicep b/modules/Microsoft.Insights/scheduledQueryRules/.test/common/deploy.test.bicep index c1a475cfd4..7a42c660c9 100644 --- a/modules/Microsoft.Insights/scheduledQueryRules/.test/common/deploy.test.bicep +++ b/modules/Microsoft.Insights/scheduledQueryRules/.test/common/deploy.test.bicep @@ -3,14 +3,14 @@ targetScope = 'subscription' // ========== // // Parameters // // ========== // -@description('Optional. The name of the resource group to deploy for testing purposes') +@description('Optional. The name of the resource group to deploy for testing purposes.') @maxLength(90) param resourceGroupName string = 'ms.insights.scheduledqueryrules-${serviceShort}-rg' -@description('Optional. The location to deploy resources to') +@description('Optional. The location to deploy resources to.') param location string = deployment().location -@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints') +@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints.') param serviceShort string = 'isqrcom' // =========== // From 965fd08c718ad3074a76c987fc2709d415af5f22 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Thu, 6 Oct 2022 07:56:51 +0200 Subject: [PATCH 7/7] Update to latest --- utilities/pipelines/staticValidation/module.tests.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/utilities/pipelines/staticValidation/module.tests.ps1 b/utilities/pipelines/staticValidation/module.tests.ps1 index b005759b0d..d6fa0761f0 100644 --- a/utilities/pipelines/staticValidation/module.tests.ps1 +++ b/utilities/pipelines/staticValidation/module.tests.ps1 @@ -349,7 +349,6 @@ Describe 'Readme tests' -Tag Readme { } $readmeCategoryColumns = ($readMeContent[$tableStartIndex] -split '\|') | ForEach-Object { $_.Trim() } | Where-Object { -not [String]::IsNullOrEmpty($_) } - $readmeCategoryColumns | Should -Be $expectedColumnsInOrder } }