From f641c8f96b90067b7baa0f40502cab102eca13ba Mon Sep 17 00:00:00 2001 From: MrMCake Date: Tue, 30 Aug 2022 21:26:11 +0200 Subject: [PATCH 01/12] [Modules] Updated Cache/Redis to new dependency approach --- .github/workflows/ms.cache.redis.yml | 3 +- .../redis/.test/default/dependencies.bicep | 28 ++++++ .../redis/.test/default/deploy.test.bicep | 71 +++++++++++++++ .../redis/.test/min.parameters.json | 9 -- .../redis/.test/min/deploy.test.bicep | 37 ++++++++ .../redis/.test/parameters.json | 63 ------------- modules/Microsoft.Cache/redis/readme.md | 88 +++++++++---------- utilities/tools/Set-ModuleReadMe.ps1 | 6 +- 8 files changed, 184 insertions(+), 121 deletions(-) create mode 100644 modules/Microsoft.Cache/redis/.test/default/dependencies.bicep create mode 100644 modules/Microsoft.Cache/redis/.test/default/deploy.test.bicep delete mode 100644 modules/Microsoft.Cache/redis/.test/min.parameters.json create mode 100644 modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep delete mode 100644 modules/Microsoft.Cache/redis/.test/parameters.json diff --git a/.github/workflows/ms.cache.redis.yml b/.github/workflows/ms.cache.redis.yml index 9666ec63c0..b956542d52 100644 --- a/.github/workflows/ms.cache.redis.yml +++ b/.github/workflows/ms.cache.redis.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.Cache/redis/.test/default/dependencies.bicep b/modules/Microsoft.Cache/redis/.test/default/dependencies.bicep new file mode 100644 index 0000000000..91351ab840 --- /dev/null +++ b/modules/Microsoft.Cache/redis/.test/default/dependencies.bicep @@ -0,0 +1,28 @@ +@description('Optional. The location to deploy resources to.') +param location string = resourceGroup().location + +@description('Required. The name of the Virtual Network to create.') +param virtualNetworkName string + +resource virtualNetwork 'Microsoft.Network/virtualNetworks@2022-01-01' = { + name: virtualNetworkName + location: location + properties: { + addressSpace: { + addressPrefixes: [ + '10.0.0.0/24' + ] + } + subnets: [ + { + name: 'defaultSubnet' + properties: { + addressPrefix: '10.0.0.0/24' + } + } + ] + } +} + +@description('The resource ID of the created Virtual Network Subnet.') +output subnetResourceId string = virtualNetwork.properties.subnets[0].id diff --git a/modules/Microsoft.Cache/redis/.test/default/deploy.test.bicep b/modules/Microsoft.Cache/redis/.test/default/deploy.test.bicep new file mode 100644 index 0000000000..9995f12b8b --- /dev/null +++ b/modules/Microsoft.Cache/redis/.test/default/deploy.test.bicep @@ -0,0 +1,71 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for a testing purposes') +@maxLength(90) +param resourceGroupName string = 'ms.cache.redis-${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 = 'crdef' + +// =========== // +// 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: { + virtualNetworkName: 'dep-<>-vnet-${serviceShort}' + } +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + capacity: 2 + diagnosticLogCategoriesToEnable: [ + 'ApplicationGatewayAccessLog' + 'ApplicationGatewayFirewallLog' + ] + diagnosticMetricsToEnable: [ + 'AllMetrics' + ] + diagnosticSettingsName: 'redisdiagnostics' + enableNonSslPort: true + lock: 'CanNotDelete' + minimumTlsVersion: '1.2' + privateEndpoints: [ + { + service: 'redisCache' + subnetResourceId: resourceGroupResources.outputs.subnetResourceId + } + ] + publicNetworkAccess: 'Enabled' + redisVersion: '6' + shardCount: 1 + skuName: 'Premium' + systemAssignedIdentity: true + tags: { + resourceType: 'Redis Cache' + } + } +} diff --git a/modules/Microsoft.Cache/redis/.test/min.parameters.json b/modules/Microsoft.Cache/redis/.test/min.parameters.json deleted file mode 100644 index 273328d0a9..0000000000 --- a/modules/Microsoft.Cache/redis/.test/min.parameters.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>-az-redis-min-001" - } - } -} diff --git a/modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep b/modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep new file mode 100644 index 0000000000..bd8df19735 --- /dev/null +++ b/modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep @@ -0,0 +1,37 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for a testing purposes') +@maxLength(90) +param resourceGroupName string = 'ms.cache.redis-${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 = 'crmin' + +// =========== // +// 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.Cache/redis/.test/parameters.json b/modules/Microsoft.Cache/redis/.test/parameters.json deleted file mode 100644 index 4910c49871..0000000000 --- a/modules/Microsoft.Cache/redis/.test/parameters.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>-az-redis-full-001" - }, - "capacity": { - "value": 2 - }, - "diagnosticLogCategoriesToEnable": { - "value": [ - "ApplicationGatewayAccessLog", - "ApplicationGatewayFirewallLog" - ] - }, - "diagnosticMetricsToEnable": { - "value": [ - "AllMetrics" - ] - }, - "enableNonSslPort": { - "value": true - }, - "lock": { - "value": "CanNotDelete" - }, - "minimumTlsVersion": { - "value": "1.2" - }, - "diagnosticSettingsName": { - "value": "redisdiagnostics" - }, - "publicNetworkAccess": { - "value": "Enabled" - }, - "redisVersion": { - "value": "6" - }, - "skuName": { - "value": "Premium" - }, - "systemAssignedIdentity": { - "value": true - }, - "shardCount": { - "value": 1 - }, - "tags": { - "value": { - "resourceType": "Redis Cache" - } - }, - "privateEndpoints": { - "value": [ - { - "subnetResourceId": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworks/adp-<>-az-vnet-x-001/subnets/<>-az-subnet-x-005-privateEndpoints", - "service": "redisCache" - } - ] - } - } -} diff --git a/modules/Microsoft.Cache/redis/readme.md b/modules/Microsoft.Cache/redis/readme.md index 12eae15675..c8ffcff3c3 100644 --- a/modules/Microsoft.Cache/redis/readme.md +++ b/modules/Microsoft.Cache/redis/readme.md @@ -335,55 +335,18 @@ The following module usage examples are retrieved from the content of the files >**Note**: The name of each example is based on the name of the file from which it is taken. >**Note**: Each example lists all the required parameters first, followed by the rest - each in alphabetical order. -

Example 1: Min

+

Example 1: Default

via Bicep module ```bicep -module redis './Microsoft.Cache/redis/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-redis' - params: { - name: '<>-az-redis-min-001' - } -} -``` - -
-

- -

- -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": "<>-az-redis-min-001" - } - } -} -``` - -
-

- -

Example 2: Parameters

- -
- -via Bicep module - -```bicep -module redis './Microsoft.Cache/redis/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-redis' +module Redis './Microsoft.Cache/Redis/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-crdef' params: { // Required parameters - name: '<>-az-redis-full-001' + name: '<>crdef001' // Non-required parameters capacity: 2 diagnosticLogCategoriesToEnable: [ @@ -400,7 +363,7 @@ module redis './Microsoft.Cache/redis/deploy.bicep' = { privateEndpoints: [ { service: 'redisCache' - subnetResourceId: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworks/adp-<>-az-vnet-x-001/subnets/<>-az-subnet-x-005-privateEndpoints' + subnetResourceId: '' } ] publicNetworkAccess: 'Enabled' @@ -429,7 +392,7 @@ module redis './Microsoft.Cache/redis/deploy.bicep' = { "parameters": { // Required parameters "name": { - "value": "<>-az-redis-full-001" + "value": "<>crdef001" }, // Non-required parameters "capacity": { @@ -462,7 +425,7 @@ module redis './Microsoft.Cache/redis/deploy.bicep' = { "value": [ { "service": "redisCache", - "subnetResourceId": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Network/virtualNetworks/adp-<>-az-vnet-x-001/subnets/<>-az-subnet-x-005-privateEndpoints" + "subnetResourceId": "" } ] }, @@ -492,3 +455,40 @@ module redis './Microsoft.Cache/redis/deploy.bicep' = {

+ +

Example 2: Min

+ +
+ +via Bicep module + +```bicep +module Redis './Microsoft.Cache/Redis/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-crmin' + params: { + name: '<>crmin001' + } +} +``` + +
+

+ +

+ +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": "<>crmin001" + } + } +} +``` + +
+

diff --git a/utilities/tools/Set-ModuleReadMe.ps1 b/utilities/tools/Set-ModuleReadMe.ps1 index a1074fed21..6b922d65e8 100644 --- a/utilities/tools/Set-ModuleReadMe.ps1 +++ b/utilities/tools/Set-ModuleReadMe.ps1 @@ -883,9 +883,10 @@ function Set-DeploymentExamplesSection { '' ) + $TextInfo = (Get-Culture -Name 'en-US').TextInfo $moduleRoot = Split-Path $TemplateFilePath -Parent - $resourceTypeIdentifier = $moduleRoot.Replace('\', '/').Split('/modules/')[1].TrimStart('/') - $resourceType = $resourceTypeIdentifier.Split('/')[1] + $resourceTypeIdentifier = $TextInfo.ToTitleCase($moduleRoot.Replace('\', '/').Split('/modules/')[1].TrimStart('/')) + $resourceType = $TextInfo.ToTitleCase($resourceTypeIdentifier.Split('/')[1]) $testFilePaths = Get-ModuleTestFileList -ModulePath $moduleRoot | ForEach-Object { Join-Path $moduleRoot $_ } $RequiredParametersList = $TemplateFileContent.parameters.Keys | Where-Object { $TemplateFileContent.parameters[$_].Keys -notcontains 'defaultValue' } | Sort-Object @@ -906,7 +907,6 @@ function Set-DeploymentExamplesSection { } else { $exampleTitle = ((Split-Path $testFilePath -LeafBase) -replace '\.', ' ') -replace ' parameters', '' } - $TextInfo = (Get-Culture -Name 'en-US').TextInfo $exampleTitle = $TextInfo.ToTitleCase($exampleTitle) $SectionContent += @( '

Example {0}: {1}

' -f $pathIndex, $exampleTitle From dd6b5eba2ef6b9155341f7d49a80070283025014 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Thu, 1 Sep 2022 10:15:53 +0200 Subject: [PATCH 02/12] Update to latest --- utilities/tools/Set-ModuleReadMe.ps1 | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/utilities/tools/Set-ModuleReadMe.ps1 b/utilities/tools/Set-ModuleReadMe.ps1 index 6b922d65e8..25d22f3fff 100644 --- a/utilities/tools/Set-ModuleReadMe.ps1 +++ b/utilities/tools/Set-ModuleReadMe.ps1 @@ -51,7 +51,7 @@ function Set-ResourceTypesSection { $RelevantResourceTypeObjects = Get-NestedResourceList $TemplateFileContent | Where-Object { $_.type -notin $ResourceTypesToExclude -and $_ - } | Select-Object 'Type', 'ApiVersion' -Unique | Sort-Object Type -Culture en-US + } | Select-Object 'Type', 'ApiVersion' -Unique | Sort-Object Type -Culture 'en-US' foreach ($resourceTypeObject in $RelevantResourceTypeObjects) { $ProviderNamespace, $ResourceType = $resourceTypeObject.Type -split '/', 2 @@ -280,7 +280,7 @@ function Set-OutputsSection { '| Output Name | Type | Description |', '| :-- | :-- | :-- |' ) - foreach ($outputName in ($templateFileContent.outputs.Keys | Sort-Object -Culture en-US)) { + foreach ($outputName in ($templateFileContent.outputs.Keys | Sort-Object -Culture 'en-US')) { $output = $TemplateFileContent.outputs[$outputName] $description = $output.metadata.description.Replace("`r`n", '

').Replace("`n", '

') $SectionContent += ("| ``{0}`` | {1} | {2} |" -f $outputName, $output.type, $description) @@ -290,7 +290,7 @@ function Set-OutputsSection { '| Output Name | Type |', '| :-- | :-- |' ) - foreach ($outputName in ($templateFileContent.outputs.Keys | Sort-Object -Culture en-US)) { + foreach ($outputName in ($templateFileContent.outputs.Keys | Sort-Object -Culture 'en-US')) { $output = $TemplateFileContent.outputs[$outputName] $SectionContent += ("| ``{0}`` | {1} |" -f $outputName, $output.type) } @@ -883,10 +883,16 @@ function Set-DeploymentExamplesSection { '' ) - $TextInfo = (Get-Culture -Name 'en-US').TextInfo $moduleRoot = Split-Path $TemplateFilePath -Parent - $resourceTypeIdentifier = $TextInfo.ToTitleCase($moduleRoot.Replace('\', '/').Split('/modules/')[1].TrimStart('/')) - $resourceType = $TextInfo.ToTitleCase($resourceTypeIdentifier.Split('/')[1]) + $fullIdentifier = $moduleRoot.Replace('\', '/').Split('/modules/')[1].TrimStart('/') + + # Get resource type and make first letter upper case. Requires manual handling as ToTitleCase lowercases everything but the first letter + $providerNamespace = ($fullIdentifier.Split('/')[0] -split '\.' | ForEach-Object { $_.Substring(0, 1).ToUpper() + $_.Substring(1) }) -join '.' + $resourceType = $fullIdentifier.Split('/')[1] + $resourceTypeUpper = $resourceType.Substring(0, 1).ToUpper() + $resourceType.Substring(1) + + $resourceTypeIdentifier = "$providerNamespace/$resourceType" + $testFilePaths = Get-ModuleTestFileList -ModulePath $moduleRoot | ForEach-Object { Join-Path $moduleRoot $_ } $RequiredParametersList = $TemplateFileContent.parameters.Keys | Where-Object { $TemplateFileContent.parameters[$_].Keys -notcontains 'defaultValue' } | Sort-Object @@ -907,7 +913,8 @@ function Set-DeploymentExamplesSection { } else { $exampleTitle = ((Split-Path $testFilePath -LeafBase) -replace '\.', ' ') -replace ' parameters', '' } - $exampleTitle = $TextInfo.ToTitleCase($exampleTitle) + $textInfo = (Get-Culture -Name 'en-US').TextInfo + $exampleTitle = $textInfo.ToTitleCase($exampleTitle) $SectionContent += @( '

Example {0}: {1}

' -f $pathIndex, $exampleTitle ) @@ -1138,7 +1145,7 @@ function Set-DeploymentExamplesSection { '```bicep', $extendedKeyVaultReferences, "module $resourceType './$resourceTypeIdentifier/deploy.bicep' = {" - " name: '`${uniqueString(deployment().name)}-$resourceType'" + " name: '`${uniqueString(deployment().name)}-$resourceTypeUpper'" ' params: {' $bicepExample.TrimEnd(), ' }' From 72bbd226f21983266fb5c18075ae60800edfb8a4 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Thu, 1 Sep 2022 11:32:43 +0200 Subject: [PATCH 03/12] Update to latest --- modules/Microsoft.Cache/redis/readme.md | 41 ++----------------------- 1 file changed, 2 insertions(+), 39 deletions(-) diff --git a/modules/Microsoft.Cache/redis/readme.md b/modules/Microsoft.Cache/redis/readme.md index 7e04b5a187..c8ffcff3c3 100644 --- a/modules/Microsoft.Cache/redis/readme.md +++ b/modules/Microsoft.Cache/redis/readme.md @@ -342,45 +342,8 @@ The following module usage examples are retrieved from the content of the files via Bicep module ```bicep -module redis './Microsoft.Cache/redis/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-Redis' - params: { - name: '<>-az-redis-min-001' - } -} -``` - - -

- -

- -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": "<>-az-redis-min-001" - } - } -} -``` - -
-

- -

Example 2: Parameters

- -
- -via Bicep module - -```bicep -module redis './Microsoft.Cache/redis/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-Redis' +module Redis './Microsoft.Cache/Redis/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-crdef' params: { // Required parameters name: '<>crdef001' From f1373e2513d90dd334ce6474702d0643168dad70 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Thu, 8 Sep 2022 18:55:33 +0200 Subject: [PATCH 04/12] Updated folder default to common. --- .../redis/.test/{default => common}/dependencies.bicep | 0 .../redis/.test/{default => common}/deploy.test.bicep | 0 modules/Microsoft.Cache/redis/readme.md | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename modules/Microsoft.Cache/redis/.test/{default => common}/dependencies.bicep (100%) rename modules/Microsoft.Cache/redis/.test/{default => common}/deploy.test.bicep (100%) diff --git a/modules/Microsoft.Cache/redis/.test/default/dependencies.bicep b/modules/Microsoft.Cache/redis/.test/common/dependencies.bicep similarity index 100% rename from modules/Microsoft.Cache/redis/.test/default/dependencies.bicep rename to modules/Microsoft.Cache/redis/.test/common/dependencies.bicep diff --git a/modules/Microsoft.Cache/redis/.test/default/deploy.test.bicep b/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep similarity index 100% rename from modules/Microsoft.Cache/redis/.test/default/deploy.test.bicep rename to modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep diff --git a/modules/Microsoft.Cache/redis/readme.md b/modules/Microsoft.Cache/redis/readme.md index c66bb7fff6..457da3bf0b 100644 --- a/modules/Microsoft.Cache/redis/readme.md +++ b/modules/Microsoft.Cache/redis/readme.md @@ -335,7 +335,7 @@ The following module usage examples are retrieved from the content of the files >**Note**: The name of each example is based on the name of the file from which it is taken. >**Note**: Each example lists all the required parameters first, followed by the rest - each in alphabetical order. -

Example 1: Default

+

Example 1: Common

From 1753931e849dd5fa45f4e113c4de906e7ced9004 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 9 Sep 2022 12:49:50 +0200 Subject: [PATCH 05/12] Update to latest --- modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep | 4 ++-- modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep b/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep index aa72c26710..157ef7465f 100644 --- a/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep +++ b/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep @@ -10,8 +10,8 @@ param resourceGroupName string = 'ms.cache.redis-${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 = 'crdef' +@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 = 'crcom' // =========== // // Deployments // diff --git a/modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep b/modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep index bd8df19735..b52ccda36a 100644 --- a/modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep +++ b/modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep @@ -10,7 +10,7 @@ param resourceGroupName string = 'ms.cache.redis-${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') +@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 = 'crmin' // =========== // From 69dad035a95998fec80a06eaaf1e4135e9be097c Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 9 Sep 2022 13:02:44 +0200 Subject: [PATCH 06/12] Update to latest --- .../Microsoft.Cache/redis/.test/common/deploy.test.bicep | 6 +++--- modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep b/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep index 157ef7465f..4222dc4406 100644 --- a/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep +++ b/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep @@ -3,14 +3,14 @@ targetScope = 'subscription' // ========== // // Parameters // // ========== // -@description('Optional. The name of the resource group to deploy for a testing purposes') +@description('Optional. The name of the resource group to deploy for a testing purposes.') @maxLength(90) param resourceGroupName string = 'ms.cache.redis-${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 = 'crcom' // =========== // diff --git a/modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep b/modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep index b52ccda36a..4f8e5bc51a 100644 --- a/modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep +++ b/modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep @@ -3,14 +3,14 @@ targetScope = 'subscription' // ========== // // Parameters // // ========== // -@description('Optional. The name of the resource group to deploy for a testing purposes') +@description('Optional. The name of the resource group to deploy for a testing purposes.') @maxLength(90) param resourceGroupName string = 'ms.cache.redis-${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 = 'crmin' // =========== // From df2c9037bed0317fcd0137a1fd305cbf99d9f8eb Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 9 Sep 2022 13:26:08 +0200 Subject: [PATCH 07/12] Update to latest --- modules/Microsoft.Cache/redis/readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/Microsoft.Cache/redis/readme.md b/modules/Microsoft.Cache/redis/readme.md index 1343c70467..b5b8d36f67 100644 --- a/modules/Microsoft.Cache/redis/readme.md +++ b/modules/Microsoft.Cache/redis/readme.md @@ -344,10 +344,10 @@ The following module usage examples are retrieved from the content of the files ```bicep module redis './Microsoft.Cache/redis/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-test-crdef' + name: '${uniqueString(deployment().name)}-test-crcom' params: { // Required parameters - name: '<>crdef001' + name: '<>crcom001' // Non-required parameters capacity: 2 diagnosticLogCategoriesToEnable: [ @@ -398,7 +398,7 @@ module redis './Microsoft.Cache/redis/deploy.bicep' = { "parameters": { // Required parameters "name": { - "value": "<>crdef001" + "value": "<>crcom001" }, // Non-required parameters "capacity": { From 845fad9e5ee7747f3a81babbefb084797058db57 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Sun, 18 Sep 2022 23:21:45 +0200 Subject: [PATCH 08/12] Update to latest --- modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep | 2 +- modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep b/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep index 4222dc4406..60dbfe10ea 100644 --- a/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep +++ b/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep @@ -3,7 +3,7 @@ targetScope = 'subscription' // ========== // // Parameters // // ========== // -@description('Optional. The name of the resource group to deploy for a testing purposes.') +@description('Optional. The name of the resource group to deploy for testing purposes.') @maxLength(90) param resourceGroupName string = 'ms.cache.redis-${serviceShort}-rg' diff --git a/modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep b/modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep index 4f8e5bc51a..c36896ba63 100644 --- a/modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep +++ b/modules/Microsoft.Cache/redis/.test/min/deploy.test.bicep @@ -3,7 +3,7 @@ targetScope = 'subscription' // ========== // // Parameters // // ========== // -@description('Optional. The name of the resource group to deploy for a testing purposes.') +@description('Optional. The name of the resource group to deploy for testing purposes.') @maxLength(90) param resourceGroupName string = 'ms.cache.redis-${serviceShort}-rg' From e056aa03448d64545eb9f6b14a0629f66adb4bd8 Mon Sep 17 00:00:00 2001 From: Alexander Sehr Date: Wed, 12 Oct 2022 11:28:43 +0200 Subject: [PATCH 09/12] Update modules/Microsoft.Cache/redis/.test/common/dependencies.bicep Co-authored-by: Erika Gressi <56914614+eriqua@users.noreply.github.com> --- modules/Microsoft.Cache/redis/.test/common/dependencies.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Microsoft.Cache/redis/.test/common/dependencies.bicep b/modules/Microsoft.Cache/redis/.test/common/dependencies.bicep index 87827eb95c..a0300f449e 100644 --- a/modules/Microsoft.Cache/redis/.test/common/dependencies.bicep +++ b/modules/Microsoft.Cache/redis/.test/common/dependencies.bicep @@ -43,5 +43,5 @@ resource privateDNSZone 'Microsoft.Network/privateDnsZones@2020-06-01' = { @description('The resource ID of the created Virtual Network Subnet.') output subnetResourceId string = virtualNetwork.properties.subnets[0].id -@description('The resource ID of the created Virtual Network Subnet.') +@description('The resource ID of the created Private DNS Zone.') output privateDNSResourceId string = privateDNSZone.id From 1b565a0b76d950a399d2cb8bf3404ca980f744ef Mon Sep 17 00:00:00 2001 From: MrMCake Date: Wed, 12 Oct 2022 11:30:39 +0200 Subject: [PATCH 10/12] Addessed comments --- .../redis/.test/common/deploy.test.bicep | 19 ++++++++++++++++++ modules/Microsoft.Cache/redis/readme.md | 20 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep b/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep index 60dbfe10ea..ec14c4d5bd 100644 --- a/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep +++ b/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep @@ -32,6 +32,20 @@ module resourceGroupResources 'dependencies.bicep' = { } } +// Diagnostics +// =========== +module diagnosticDependencies '../../../../.shared/dependencyConstructs/diagnostic.dependencies.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name, location)}-diagnosticDependencies' + params: { + storageAccountName: 'dep<>diasa${serviceShort}01' + logAnalyticsWorkspaceName: 'dep-<>-law-${serviceShort}' + eventHubNamespaceEventHubName: 'dep-<>-evh-${serviceShort}' + eventHubNamespaceName: 'dep-<>-evhns-${serviceShort}' + location: location + } +} + // ============== // // Test Execution // // ============== // @@ -49,6 +63,11 @@ module testDeployment '../../deploy.bicep' = { diagnosticMetricsToEnable: [ 'AllMetrics' ] + diagnosticLogsRetentionInDays: 7 + diagnosticStorageAccountId: diagnosticDependencies.outputs.storageAccountResourceId + diagnosticWorkspaceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId + diagnosticEventHubAuthorizationRuleId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId + diagnosticEventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName diagnosticSettingsName: 'redisdiagnostics' enableNonSslPort: true lock: 'CanNotDelete' diff --git a/modules/Microsoft.Cache/redis/readme.md b/modules/Microsoft.Cache/redis/readme.md index 08d232741c..f3d628d1ef 100644 --- a/modules/Microsoft.Cache/redis/readme.md +++ b/modules/Microsoft.Cache/redis/readme.md @@ -350,14 +350,19 @@ module redis './Microsoft.Cache/redis/deploy.bicep' = { name: '<>crcom001' // Non-required parameters capacity: 2 + diagnosticEventHubAuthorizationRuleId: '' + diagnosticEventHubName: '' diagnosticLogCategoriesToEnable: [ 'ApplicationGatewayAccessLog' 'ApplicationGatewayFirewallLog' ] + diagnosticLogsRetentionInDays: 7 diagnosticMetricsToEnable: [ 'AllMetrics' ] diagnosticSettingsName: 'redisdiagnostics' + diagnosticStorageAccountId: '' + diagnosticWorkspaceId: '' enableNonSslPort: true lock: 'CanNotDelete' minimumTlsVersion: '1.2' @@ -404,12 +409,21 @@ module redis './Microsoft.Cache/redis/deploy.bicep' = { "capacity": { "value": 2 }, + "diagnosticEventHubAuthorizationRuleId": { + "value": "" + }, + "diagnosticEventHubName": { + "value": "" + }, "diagnosticLogCategoriesToEnable": { "value": [ "ApplicationGatewayAccessLog", "ApplicationGatewayFirewallLog" ] }, + "diagnosticLogsRetentionInDays": { + "value": 7 + }, "diagnosticMetricsToEnable": { "value": [ "AllMetrics" @@ -418,6 +432,12 @@ module redis './Microsoft.Cache/redis/deploy.bicep' = { "diagnosticSettingsName": { "value": "redisdiagnostics" }, + "diagnosticStorageAccountId": { + "value": "" + }, + "diagnosticWorkspaceId": { + "value": "" + }, "enableNonSslPort": { "value": true }, From 6c4a82dcab2e3c9d73b5d735219eca4f11ea705b Mon Sep 17 00:00:00 2001 From: MrMCake Date: Wed, 12 Oct 2022 17:43:52 +0200 Subject: [PATCH 11/12] Addressed comments --- .../redis/.test/common/deploy.test.bicep | 7 ------- modules/Microsoft.Cache/redis/readme.md | 18 ------------------ 2 files changed, 25 deletions(-) diff --git a/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep b/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep index ec14c4d5bd..05ebac680e 100644 --- a/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep +++ b/modules/Microsoft.Cache/redis/.test/common/deploy.test.bicep @@ -56,13 +56,6 @@ module testDeployment '../../deploy.bicep' = { params: { name: '<>${serviceShort}001' capacity: 2 - diagnosticLogCategoriesToEnable: [ - 'ApplicationGatewayAccessLog' - 'ApplicationGatewayFirewallLog' - ] - diagnosticMetricsToEnable: [ - 'AllMetrics' - ] diagnosticLogsRetentionInDays: 7 diagnosticStorageAccountId: diagnosticDependencies.outputs.storageAccountResourceId diagnosticWorkspaceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId diff --git a/modules/Microsoft.Cache/redis/readme.md b/modules/Microsoft.Cache/redis/readme.md index f3d628d1ef..d5562f7773 100644 --- a/modules/Microsoft.Cache/redis/readme.md +++ b/modules/Microsoft.Cache/redis/readme.md @@ -352,14 +352,7 @@ module redis './Microsoft.Cache/redis/deploy.bicep' = { capacity: 2 diagnosticEventHubAuthorizationRuleId: '' diagnosticEventHubName: '' - diagnosticLogCategoriesToEnable: [ - 'ApplicationGatewayAccessLog' - 'ApplicationGatewayFirewallLog' - ] diagnosticLogsRetentionInDays: 7 - diagnosticMetricsToEnable: [ - 'AllMetrics' - ] diagnosticSettingsName: 'redisdiagnostics' diagnosticStorageAccountId: '' diagnosticWorkspaceId: '' @@ -415,20 +408,9 @@ module redis './Microsoft.Cache/redis/deploy.bicep' = { "diagnosticEventHubName": { "value": "" }, - "diagnosticLogCategoriesToEnable": { - "value": [ - "ApplicationGatewayAccessLog", - "ApplicationGatewayFirewallLog" - ] - }, "diagnosticLogsRetentionInDays": { "value": 7 }, - "diagnosticMetricsToEnable": { - "value": [ - "AllMetrics" - ] - }, "diagnosticSettingsName": { "value": "redisdiagnostics" }, From 8e7281f6f42619d75086390ea3a2434bb69717b3 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 21 Oct 2022 17:58:46 +0200 Subject: [PATCH 12/12] Fixed blocking diagnostic settings --- modules/Microsoft.Cache/redis/deploy.bicep | 8 ++------ modules/Microsoft.Cache/redis/readme.md | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/modules/Microsoft.Cache/redis/deploy.bicep b/modules/Microsoft.Cache/redis/deploy.bicep index 2278ab6f12..9daa4d2e36 100644 --- a/modules/Microsoft.Cache/redis/deploy.bicep +++ b/modules/Microsoft.Cache/redis/deploy.bicep @@ -119,14 +119,10 @@ param diagnosticEventHubName string = '' @description('Optional. The name of logs that will be streamed.') @allowed([ - 'ApplicationGatewayAccessLog' - 'ApplicationGatewayPerformanceLog' - 'ApplicationGatewayFirewallLog' + 'ConnectedClientList' ]) param diagnosticLogCategoriesToEnable array = [ - 'ApplicationGatewayAccessLog' - 'ApplicationGatewayPerformanceLog' - 'ApplicationGatewayFirewallLog' + 'ConnectedClientList' ] @description('Optional. The name of metrics that will be streamed.') diff --git a/modules/Microsoft.Cache/redis/readme.md b/modules/Microsoft.Cache/redis/readme.md index d5562f7773..67669e0e7b 100644 --- a/modules/Microsoft.Cache/redis/readme.md +++ b/modules/Microsoft.Cache/redis/readme.md @@ -34,7 +34,7 @@ This module deploys a Redis Cache service. | `capacity` | int | `1` | `[0, 1, 2, 3, 4, 5, 6]` | The size of the Redis cache to deploy. Valid values: for C (Basic/Standard) family (0, 1, 2, 3, 4, 5, 6), for P (Premium) family (1, 2, 3, 4). | | `diagnosticEventHubAuthorizationRuleId` | string | `''` | | Resource ID of the diagnostic event hub authorization rule for the Event Hubs namespace in which the event hub should be created or streamed to. | | `diagnosticEventHubName` | string | `''` | | Name of the diagnostic event hub within the namespace to which logs are streamed. Without this, an event hub is created for each log category. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub. | -| `diagnosticLogCategoriesToEnable` | array | `[ApplicationGatewayAccessLog, ApplicationGatewayFirewallLog, ApplicationGatewayPerformanceLog]` | `[ApplicationGatewayAccessLog, ApplicationGatewayFirewallLog, ApplicationGatewayPerformanceLog]` | The name of logs that will be streamed. | +| `diagnosticLogCategoriesToEnable` | array | `[ConnectedClientList]` | `[ConnectedClientList]` | The name of logs that will be streamed. | | `diagnosticLogsRetentionInDays` | int | `365` | | Specifies the number of days that logs will be kept for; a value of 0 will retain data indefinitely. | | `diagnosticMetricsToEnable` | array | `[AllMetrics]` | `[AllMetrics]` | The name of metrics that will be streamed. | | `diagnosticSettingsName` | string | `[format('{0}-diagnosticSettings', parameters('name'))]` | | The name of the diagnostic setting, if deployed. |