From 40781cf16eb3bcb293280252203450a189644bc0 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 9 Sep 2022 14:53:35 +0200 Subject: [PATCH 1/9] Updated Cosmos DB to new dependencies approach --- .../ms.documentdb.databaseaccounts.yml | 3 +- .../.test/gremlindb.parameters.json | 101 ------- .../.test/gremlindb/dependencies.bicep | 14 + .../.test/gremlindb/deploy.test.bicep | 129 +++++++++ .../.test/mongodb.parameters.json | 240 ---------------- .../.test/mongodb/dependencies.bicep | 14 + .../.test/mongodb/deploy.test.bicep | 270 ++++++++++++++++++ .../.test/plain.parameters.json | 51 ---- .../.test/plain/dependencies.bicep | 14 + .../.test/plain/deploy.test.bicep | 85 ++++++ .../.test/sqldb.parameters.json | 76 ----- .../.test/sqldb/dependencies.bicep | 16 ++ .../.test/sqldb/deploy.test.bicep | 106 +++++++ .../databaseAccounts/readme.md | 120 ++++---- 14 files changed, 709 insertions(+), 530 deletions(-) delete mode 100644 modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb.parameters.json create mode 100644 modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/dependencies.bicep create mode 100644 modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep delete mode 100644 modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb.parameters.json create mode 100644 modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/dependencies.bicep create mode 100644 modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/deploy.test.bicep delete mode 100644 modules/Microsoft.DocumentDB/databaseAccounts/.test/plain.parameters.json create mode 100644 modules/Microsoft.DocumentDB/databaseAccounts/.test/plain/dependencies.bicep create mode 100644 modules/Microsoft.DocumentDB/databaseAccounts/.test/plain/deploy.test.bicep delete mode 100644 modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb.parameters.json create mode 100644 modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/dependencies.bicep create mode 100644 modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/deploy.test.bicep diff --git a/.github/workflows/ms.documentdb.databaseaccounts.yml b/.github/workflows/ms.documentdb.databaseaccounts.yml index 1aa0a5d9d6..d64ade8b8a 100644 --- a/.github/workflows/ms.documentdb.databaseaccounts.yml +++ b/.github/workflows/ms.documentdb.databaseaccounts.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.DocumentDB/databaseAccounts/.test/gremlindb.parameters.json b/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb.parameters.json deleted file mode 100644 index ec025620b5..0000000000 --- a/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb.parameters.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>-az-cdb-gremlindb-001" - }, - "location": { - "value": "West Europe" - }, - "locations": { - "value": [ - { - "locationName": "West Europe", - "failoverPriority": 0, - "isZoneRedundant": false - }, - { - "locationName": "North Europe", - "failoverPriority": 1, - "isZoneRedundant": false - } - ] - }, - "capabilitiesToAdd": { - "value": [ - "EnableGremlin" - ] - }, - "roleAssignments": { - "value": [ - { - "roleDefinitionIdOrName": "Reader", - "principalIds": [ - "<>" - ] - } - ] - }, - "gremlinDatabases": { - "value": [ - { - "name": "<>-az-gdb-x-001", - "graphs": [ - { - "name": "car_collection", - "automaticIndexing": true, - "partitionKeyPaths": [ - "/car_id" - ] - }, - { - "name": "truck_collection", - "automaticIndexing": true, - "partitionKeyPaths": [ - "/truck_id" - ] - } - ] - }, - { - "name": "<>-az-gdb-x-002", - "collections": [ - { - "name": "bike_collection", - "automaticIndexing": true, - "partitionKeyPaths": [ - "/bike_id" - ] - }, - { - "name": "bicycle_collection", - "automaticIndexing": true, - "partitionKeyPaths": [ - "/bicycle_id" - ] - } - ] - } - ] - }, - "diagnosticLogsRetentionInDays": { - "value": 7 - }, - "diagnosticStorageAccountId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<>azsax001" - }, - "diagnosticWorkspaceId": { - "value": "/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001" - }, - "diagnosticEventHubAuthorizationRuleId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey" - }, - "diagnosticEventHubName": { - "value": "adp-<>-az-evh-x-001" - }, - "systemAssignedIdentity": { - "value": true - } - } -} diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/dependencies.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/dependencies.bicep new file mode 100644 index 0000000000..7371d4437b --- /dev/null +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/dependencies.bicep @@ -0,0 +1,14 @@ +@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 + +resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = { + name: managedIdentityName + location: location +} + +@description('The principal ID of the created Managed Identity.') +output managedIdentityPrincipalId string = managedIdentity.properties.principalId + diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep new file mode 100644 index 0000000000..abef5f27b5 --- /dev/null +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep @@ -0,0 +1,129 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for a testing purposes') +@maxLength(90) +param resourceGroupName string = 'ms.documentdb.databaseaccounts-${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 = 'dddagrm' + +// =========== // +// 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}' + } +} + +// 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 // +// ============== // + +module testDeployment '../../deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + locations: [ + { + failoverPriority: 0 + isZoneRedundant: false + locationName: 'West Europe' + } + { + failoverPriority: 1 + isZoneRedundant: false + locationName: 'North Europe' + } + ] + capabilitiesToAdd: [ + 'EnableGremlin' + ] + diagnosticStorageAccountId: diagnosticDependencies.outputs.storageAccountResourceId + diagnosticWorkspaceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId + diagnosticEventHubAuthorizationRuleId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId + diagnosticEventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName + diagnosticLogsRetentionInDays: 7 + gremlinDatabases: [ + { + graphs: [ + { + automaticIndexing: true + name: 'car_collection' + partitionKeyPaths: [ + '/car_id' + ] + } + { + automaticIndexing: true + name: 'truck_collection' + partitionKeyPaths: [ + '/truck_id' + ] + } + ] + name: '<>-az-gdb-x-001' + } + { + collections: [ + { + automaticIndexing: true + name: 'bike_collection' + partitionKeyPaths: [ + '/bike_id' + ] + } + { + automaticIndexing: true + name: 'bicycle_collection' + partitionKeyPaths: [ + '/bicycle_id' + ] + } + ] + name: '<>-az-gdb-x-002' + } + ] + location: location + roleAssignments: [ + { + principalIds: [ + resourceGroupResources.outputs.managedIdentityPrincipalId + ] + roleDefinitionIdOrName: 'Reader' + } + ] + systemAssignedIdentity: true + } +} diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb.parameters.json b/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb.parameters.json deleted file mode 100644 index c9c6465b30..0000000000 --- a/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb.parameters.json +++ /dev/null @@ -1,240 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>-az-cdb-mongodb-001" - }, - "location": { - "value": "West Europe" - }, - "locations": { - "value": [ - { - "locationName": "West Europe", - "failoverPriority": 0, - "isZoneRedundant": false - }, - { - "locationName": "North Europe", - "failoverPriority": 1, - "isZoneRedundant": false - } - ] - }, - "roleAssignments": { - "value": [ - { - "roleDefinitionIdOrName": "Reader", - "principalIds": [ - "<>" - ] - } - ] - }, - "mongodbDatabases": { - "value": [ - { - "name": "<>-az-mdb-x-001", - "collections": [ - { - "name": "car_collection", - "indexes": [ - { - "key": { - "keys": [ - "_id" - ] - } - }, - { - "key": { - "keys": [ - "$**" - ] - } - }, - { - "key": { - "keys": [ - "car_id", - "car_model" - ] - }, - "options": { - "unique": true - } - }, - { - "key": { - "keys": [ - "_ts" - ] - }, - "options": { - "expireAfterSeconds": 2629746 - } - } - ], - "shardKey": { - "car_id": "Hash" - } - }, - { - "name": "truck_collection", - "indexes": [ - { - "key": { - "keys": [ - "_id" - ] - } - }, - { - "key": { - "keys": [ - "$**" - ] - } - }, - { - "key": { - "keys": [ - "truck_id", - "truck_model" - ] - }, - "options": { - "unique": true - } - }, - { - "key": { - "keys": [ - "_ts" - ] - }, - "options": { - "expireAfterSeconds": 2629746 - } - } - ], - "shardKey": { - "truck_id": "Hash" - } - } - ] - }, - { - "name": "<>-az-mdb-x-002", - "collections": [ - { - "name": "bike_collection", - "indexes": [ - { - "key": { - "keys": [ - "_id" - ] - } - }, - { - "key": { - "keys": [ - "$**" - ] - } - }, - { - "key": { - "keys": [ - "bike_id", - "bike_model" - ] - }, - "options": { - "unique": true - } - }, - { - "key": { - "keys": [ - "_ts" - ] - }, - "options": { - "expireAfterSeconds": 2629746 - } - } - ], - "shardKey": { - "bike_id": "Hash" - } - }, - { - "name": "bicycle_collection", - "indexes": [ - { - "key": { - "keys": [ - "_id" - ] - } - }, - { - "key": { - "keys": [ - "$**" - ] - } - }, - { - "key": { - "keys": [ - "bicycle_id", - "bicycle_model" - ] - }, - "options": { - "unique": true - } - }, - { - "key": { - "keys": [ - "_ts" - ] - }, - "options": { - "expireAfterSeconds": 2629746 - } - } - ], - "shardKey": { - "bicycle_id": "Hash" - } - } - ] - } - ] - }, - "diagnosticLogsRetentionInDays": { - "value": 7 - }, - "diagnosticStorageAccountId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<>azsax001" - }, - "diagnosticWorkspaceId": { - "value": "/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001" - }, - "diagnosticEventHubAuthorizationRuleId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey" - }, - "diagnosticEventHubName": { - "value": "adp-<>-az-evh-x-001" - }, - "systemAssignedIdentity": { - "value": true - } - } -} diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/dependencies.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/dependencies.bicep new file mode 100644 index 0000000000..7371d4437b --- /dev/null +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/dependencies.bicep @@ -0,0 +1,14 @@ +@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 + +resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = { + name: managedIdentityName + location: location +} + +@description('The principal ID of the created Managed Identity.') +output managedIdentityPrincipalId string = managedIdentity.properties.principalId + diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/deploy.test.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/deploy.test.bicep new file mode 100644 index 0000000000..5caee2346a --- /dev/null +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/deploy.test.bicep @@ -0,0 +1,270 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for a testing purposes') +@maxLength(90) +param resourceGroupName string = 'ms.documentdb.databaseaccounts-${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 = 'dddamng' + +// =========== // +// 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}' + } +} + +// 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 // +// ============== // + +module testDeployment '../../deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + locations: [ + { + failoverPriority: 0 + isZoneRedundant: false + locationName: 'West Europe' + } + { + failoverPriority: 1 + isZoneRedundant: false + locationName: 'North Europe' + } + ] + diagnosticStorageAccountId: diagnosticDependencies.outputs.storageAccountResourceId + diagnosticWorkspaceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId + diagnosticEventHubAuthorizationRuleId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId + diagnosticEventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName + diagnosticLogsRetentionInDays: 7 + location: location + mongodbDatabases: [ + { + collections: [ + { + indexes: [ + { + key: { + keys: [ + '_id' + ] + } + } + { + key: { + keys: [ + '$**' + ] + } + } + { + key: { + keys: [ + 'car_id' + 'car_model' + ] + } + options: { + unique: true + } + } + { + key: { + keys: [ + '_ts' + ] + } + options: { + expireAfterSeconds: 2629746 + } + } + ] + name: 'car_collection' + shardKey: { + car_id: 'Hash' + } + } + { + indexes: [ + { + key: { + keys: [ + '_id' + ] + } + } + { + key: { + keys: [ + '$**' + ] + } + } + { + key: { + keys: [ + 'truck_id' + 'truck_model' + ] + } + options: { + unique: true + } + } + { + key: { + keys: [ + '_ts' + ] + } + options: { + expireAfterSeconds: 2629746 + } + } + ] + name: 'truck_collection' + shardKey: { + truck_id: 'Hash' + } + } + ] + name: '<>-az-mdb-x-001' + } + { + collections: [ + { + indexes: [ + { + key: { + keys: [ + '_id' + ] + } + } + { + key: { + keys: [ + '$**' + ] + } + } + { + key: { + keys: [ + 'bike_id' + 'bike_model' + ] + } + options: { + unique: true + } + } + { + key: { + keys: [ + '_ts' + ] + } + options: { + expireAfterSeconds: 2629746 + } + } + ] + name: 'bike_collection' + shardKey: { + bike_id: 'Hash' + } + } + { + indexes: [ + { + key: { + keys: [ + '_id' + ] + } + } + { + key: { + keys: [ + '$**' + ] + } + } + { + key: { + keys: [ + 'bicycle_id' + 'bicycle_model' + ] + } + options: { + unique: true + } + } + { + key: { + keys: [ + '_ts' + ] + } + options: { + expireAfterSeconds: 2629746 + } + } + ] + name: 'bicycle_collection' + shardKey: { + bicycle_id: 'Hash' + } + } + ] + name: '<>-az-mdb-x-002' + } + ] + roleAssignments: [ + { + principalIds: [ + resourceGroupResources.outputs.managedIdentityPrincipalId + ] + roleDefinitionIdOrName: 'Reader' + } + ] + systemAssignedIdentity: true + } +} diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/plain.parameters.json b/modules/Microsoft.DocumentDB/databaseAccounts/.test/plain.parameters.json deleted file mode 100644 index 564968cf20..0000000000 --- a/modules/Microsoft.DocumentDB/databaseAccounts/.test/plain.parameters.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>-az-cdb-plain-001" - }, - "lock": { - "value": "CanNotDelete" - }, - "locations": { - "value": [ - { - "locationName": "West Europe", - "failoverPriority": 0, - "isZoneRedundant": false - }, - { - "locationName": "North Europe", - "failoverPriority": 1, - "isZoneRedundant": false - } - ] - }, - "roleAssignments": { - "value": [ - { - "roleDefinitionIdOrName": "Reader", - "principalIds": [ - "<>" - ] - } - ] - }, - "diagnosticLogsRetentionInDays": { - "value": 7 - }, - "diagnosticStorageAccountId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<>azsax001" - }, - "diagnosticWorkspaceId": { - "value": "/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001" - }, - "diagnosticEventHubAuthorizationRuleId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey" - }, - "diagnosticEventHubName": { - "value": "adp-<>-az-evh-x-001" - } - } -} diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/plain/dependencies.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/plain/dependencies.bicep new file mode 100644 index 0000000000..7371d4437b --- /dev/null +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/plain/dependencies.bicep @@ -0,0 +1,14 @@ +@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 + +resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = { + name: managedIdentityName + location: location +} + +@description('The principal ID of the created Managed Identity.') +output managedIdentityPrincipalId string = managedIdentity.properties.principalId + diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/plain/deploy.test.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/plain/deploy.test.bicep new file mode 100644 index 0000000000..62190b2b60 --- /dev/null +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/plain/deploy.test.bicep @@ -0,0 +1,85 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for a testing purposes') +@maxLength(90) +param resourceGroupName string = 'ms.documentdb.databaseaccounts-${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 = 'dddapln' + +// =========== // +// 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}' + } +} + +// 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 // +// ============== // + +module testDeployment '../../deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + locations: [ + { + failoverPriority: 0 + isZoneRedundant: false + locationName: 'West Europe' + } + { + failoverPriority: 1 + isZoneRedundant: false + locationName: 'North Europe' + } + ] + diagnosticStorageAccountId: diagnosticDependencies.outputs.storageAccountResourceId + diagnosticWorkspaceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId + diagnosticEventHubAuthorizationRuleId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId + diagnosticEventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName + diagnosticLogsRetentionInDays: 7 + lock: 'CanNotDelete' + roleAssignments: [ + { + principalIds: [ + resourceGroupResources.outputs.managedIdentityPrincipalId + ] + roleDefinitionIdOrName: 'Reader' + } + ] + } +} diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb.parameters.json b/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb.parameters.json deleted file mode 100644 index 11f83861d1..0000000000 --- a/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb.parameters.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>-az-cdb-sqldb-001" - }, - "location": { - "value": "West Europe" - }, - "locations": { - "value": [ - { - "locationName": "West Europe", - "failoverPriority": 0, - "isZoneRedundant": false - }, - { - "locationName": "North Europe", - "failoverPriority": 1, - "isZoneRedundant": false - } - ] - }, - "roleAssignments": { - "value": [ - { - "roleDefinitionIdOrName": "Reader", - "principalIds": [ - "<>" - ] - } - ] - }, - "sqlDatabases": { - "value": [ - { - "name": "<>-az-sql-x-001", - "containers": [ - { - "name": "container-001", - "paths": [ - "/myPartitionKey" - ], - "kind": "Hash" - } - ] - }, - { - "name": "<>-az-sql-x-002", - "containers": [] - } - ] - }, - "diagnosticLogsRetentionInDays": { - "value": 7 - }, - "diagnosticStorageAccountId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<>azsax001" - }, - "diagnosticWorkspaceId": { - "value": "/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001" - }, - "diagnosticEventHubAuthorizationRuleId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey" - }, - "diagnosticEventHubName": { - "value": "adp-<>-az-evh-x-001" - }, - "userAssignedIdentities": { - "value": { - "/subscriptions/<>/resourcegroups/validation-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/adp-<>-az-msi-x-001": {} - } - } - } -} diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/dependencies.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/dependencies.bicep new file mode 100644 index 0000000000..0f0755a6f4 --- /dev/null +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/dependencies.bicep @@ -0,0 +1,16 @@ +@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 + +resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = { + name: managedIdentityName + location: location +} + +@description('The principal ID of the created Managed Identity.') +output managedIdentityPrincipalId string = managedIdentity.properties.principalId + +@description('The resource ID of the created Managed Identity.') +output managedIdentityResourceId string = managedIdentity.id diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/deploy.test.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/deploy.test.bicep new file mode 100644 index 0000000000..37b4c69f32 --- /dev/null +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/deploy.test.bicep @@ -0,0 +1,106 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for a testing purposes') +@maxLength(90) +param resourceGroupName string = 'ms.documentdb.databaseaccounts-${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 = 'dddasql' + +// =========== // +// 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}' + } +} + +// 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 // +// ============== // + +module testDeployment '../../deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + locations: [ + { + failoverPriority: 0 + isZoneRedundant: false + locationName: 'West Europe' + } + { + failoverPriority: 1 + isZoneRedundant: false + locationName: 'North Europe' + } + ] + diagnosticStorageAccountId: diagnosticDependencies.outputs.storageAccountResourceId + diagnosticWorkspaceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId + diagnosticEventHubAuthorizationRuleId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId + diagnosticEventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName + diagnosticLogsRetentionInDays: 7 + location: location + roleAssignments: [ + { + principalIds: [ + resourceGroupResources.outputs.managedIdentityPrincipalId + ] + roleDefinitionIdOrName: 'Reader' + } + ] + sqlDatabases: [ + { + containers: [ + { + kind: 'Hash' + name: 'container-001' + paths: [ + '/myPartitionKey' + ] + } + ] + name: '<>-az-sql-x-001' + } + { + containers: [] + name: '<>-az-sql-x-002' + } + ] + userAssignedIdentities: { + '${resourceGroupResources.outputs.managedIdentityResourceId}': {} + } + } +} diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/readme.md b/modules/Microsoft.DocumentDB/databaseAccounts/readme.md index b9cb5c9f2c..6483e20972 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/readme.md +++ b/modules/Microsoft.DocumentDB/databaseAccounts/readme.md @@ -550,7 +550,7 @@ The following module usage examples are retrieved from the content of the files ```bicep module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-DatabaseAccounts' + name: '${uniqueString(deployment().name)}-test-dddagrm' params: { // Required parameters locations: [ @@ -565,16 +565,16 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = locationName: 'North Europe' } ] - name: '<>-az-cdb-gremlindb-001' + name: '<>dddagrm001' // Non-required parameters capabilitiesToAdd: [ 'EnableGremlin' ] - diagnosticEventHubAuthorizationRuleId: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey' - diagnosticEventHubName: 'adp-<>-az-evh-x-001' + diagnosticEventHubAuthorizationRuleId: '' + diagnosticEventHubName: '' diagnosticLogsRetentionInDays: 7 - diagnosticStorageAccountId: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<>azsax001' - diagnosticWorkspaceId: '/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001' + diagnosticStorageAccountId: '' + diagnosticWorkspaceId: '' gremlinDatabases: [ { graphs: [ @@ -615,11 +615,11 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = name: '<>-az-gdb-x-002' } ] - location: 'West Europe' + location: '' roleAssignments: [ { principalIds: [ - '<>' + '' ] roleDefinitionIdOrName: 'Reader' } @@ -657,7 +657,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = ] }, "name": { - "value": "<>-az-cdb-gremlindb-001" + "value": "<>dddagrm001" }, // Non-required parameters "capabilitiesToAdd": { @@ -666,19 +666,19 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = ] }, "diagnosticEventHubAuthorizationRuleId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey" + "value": "" }, "diagnosticEventHubName": { - "value": "adp-<>-az-evh-x-001" + "value": "" }, "diagnosticLogsRetentionInDays": { "value": 7 }, "diagnosticStorageAccountId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<>azsax001" + "value": "" }, "diagnosticWorkspaceId": { - "value": "/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001" + "value": "" }, "gremlinDatabases": { "value": [ @@ -723,13 +723,13 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = ] }, "location": { - "value": "West Europe" + "value": "" }, "roleAssignments": { "value": [ { "principalIds": [ - "<>" + "" ], "roleDefinitionIdOrName": "Reader" } @@ -753,7 +753,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = ```bicep module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-DatabaseAccounts' + name: '${uniqueString(deployment().name)}-test-dddamng' params: { // Required parameters locations: [ @@ -768,14 +768,14 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = locationName: 'North Europe' } ] - name: '<>-az-cdb-mongodb-001' + name: '<>dddamng001' // Non-required parameters - diagnosticEventHubAuthorizationRuleId: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey' - diagnosticEventHubName: 'adp-<>-az-evh-x-001' + diagnosticEventHubAuthorizationRuleId: '' + diagnosticEventHubName: '' diagnosticLogsRetentionInDays: 7 - diagnosticStorageAccountId: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<>azsax001' - diagnosticWorkspaceId: '/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001' - location: 'West Europe' + diagnosticStorageAccountId: '' + diagnosticWorkspaceId: '' + location: '' mongodbDatabases: [ { collections: [ @@ -963,7 +963,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = roleAssignments: [ { principalIds: [ - '<>' + '' ] roleDefinitionIdOrName: 'Reader' } @@ -1001,26 +1001,26 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = ] }, "name": { - "value": "<>-az-cdb-mongodb-001" + "value": "<>dddamng001" }, // Non-required parameters "diagnosticEventHubAuthorizationRuleId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey" + "value": "" }, "diagnosticEventHubName": { - "value": "adp-<>-az-evh-x-001" + "value": "" }, "diagnosticLogsRetentionInDays": { "value": 7 }, "diagnosticStorageAccountId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<>azsax001" + "value": "" }, "diagnosticWorkspaceId": { - "value": "/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001" + "value": "" }, "location": { - "value": "West Europe" + "value": "" }, "mongodbDatabases": { "value": [ @@ -1212,7 +1212,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = "value": [ { "principalIds": [ - "<>" + "" ], "roleDefinitionIdOrName": "Reader" } @@ -1236,7 +1236,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = ```bicep module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-DatabaseAccounts' + name: '${uniqueString(deployment().name)}-test-dddapln' params: { // Required parameters locations: [ @@ -1251,18 +1251,18 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = locationName: 'North Europe' } ] - name: '<>-az-cdb-plain-001' + name: '<>dddapln001' // Non-required parameters - diagnosticEventHubAuthorizationRuleId: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey' - diagnosticEventHubName: 'adp-<>-az-evh-x-001' + diagnosticEventHubAuthorizationRuleId: '' + diagnosticEventHubName: '' diagnosticLogsRetentionInDays: 7 - diagnosticStorageAccountId: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<>azsax001' - diagnosticWorkspaceId: '/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001' + diagnosticStorageAccountId: '' + diagnosticWorkspaceId: '' lock: 'CanNotDelete' roleAssignments: [ { principalIds: [ - '<>' + '' ] roleDefinitionIdOrName: 'Reader' } @@ -1299,23 +1299,23 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = ] }, "name": { - "value": "<>-az-cdb-plain-001" + "value": "<>dddapln001" }, // Non-required parameters "diagnosticEventHubAuthorizationRuleId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey" + "value": "" }, "diagnosticEventHubName": { - "value": "adp-<>-az-evh-x-001" + "value": "" }, "diagnosticLogsRetentionInDays": { "value": 7 }, "diagnosticStorageAccountId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<>azsax001" + "value": "" }, "diagnosticWorkspaceId": { - "value": "/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001" + "value": "" }, "lock": { "value": "CanNotDelete" @@ -1324,7 +1324,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = "value": [ { "principalIds": [ - "<>" + "" ], "roleDefinitionIdOrName": "Reader" } @@ -1345,7 +1345,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = ```bicep module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-DatabaseAccounts' + name: '${uniqueString(deployment().name)}-test-dddasql' params: { // Required parameters locations: [ @@ -1360,18 +1360,18 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = locationName: 'North Europe' } ] - name: '<>-az-cdb-sqldb-001' + name: '<>dddasql001' // Non-required parameters - diagnosticEventHubAuthorizationRuleId: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey' - diagnosticEventHubName: 'adp-<>-az-evh-x-001' + diagnosticEventHubAuthorizationRuleId: '' + diagnosticEventHubName: '' diagnosticLogsRetentionInDays: 7 - diagnosticStorageAccountId: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<>azsax001' - diagnosticWorkspaceId: '/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001' - location: 'West Europe' + diagnosticStorageAccountId: '' + diagnosticWorkspaceId: '' + location: '' roleAssignments: [ { principalIds: [ - '<>' + '' ] roleDefinitionIdOrName: 'Reader' } @@ -1395,7 +1395,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = } ] userAssignedIdentities: { - '/subscriptions/<>/resourcegroups/validation-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/adp-<>-az-msi-x-001': {} + '': {} } } } @@ -1429,32 +1429,32 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = ] }, "name": { - "value": "<>-az-cdb-sqldb-001" + "value": "<>dddasql001" }, // Non-required parameters "diagnosticEventHubAuthorizationRuleId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey" + "value": "" }, "diagnosticEventHubName": { - "value": "adp-<>-az-evh-x-001" + "value": "" }, "diagnosticLogsRetentionInDays": { "value": 7 }, "diagnosticStorageAccountId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<>azsax001" + "value": "" }, "diagnosticWorkspaceId": { - "value": "/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001" + "value": "" }, "location": { - "value": "West Europe" + "value": "" }, "roleAssignments": { "value": [ { "principalIds": [ - "<>" + "" ], "roleDefinitionIdOrName": "Reader" } @@ -1482,7 +1482,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = }, "userAssignedIdentities": { "value": { - "/subscriptions/<>/resourcegroups/validation-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/adp-<>-az-msi-x-001": {} + "": {} } } } From b2616b1b07780b23b98e210c15449512a802311d Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 9 Sep 2022 15:50:36 +0200 Subject: [PATCH 2/9] Small renaming --- .../.test/gremlindb/deploy.test.bicep | 4 ++-- .../.test/mongodb/deploy.test.bicep | 4 ++-- .../.test/sqldb/deploy.test.bicep | 4 ++-- .../databaseAccounts/readme.md | 24 +++++++++---------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep index abef5f27b5..ff9266c8f3 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep @@ -93,7 +93,7 @@ module testDeployment '../../deploy.bicep' = { ] } ] - name: '<>-az-gdb-x-001' + name: '<>-gdb-${serviceShort}-001' } { collections: [ @@ -112,7 +112,7 @@ module testDeployment '../../deploy.bicep' = { ] } ] - name: '<>-az-gdb-x-002' + name: '<>-gdb-${serviceShort}-002' } ] location: location diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/deploy.test.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/deploy.test.bicep index 5caee2346a..d11f703f54 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/deploy.test.bicep +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/deploy.test.bicep @@ -163,7 +163,7 @@ module testDeployment '../../deploy.bicep' = { } } ] - name: '<>-az-mdb-x-001' + name: '<>-mdb-${serviceShort}-001' } { collections: [ @@ -254,7 +254,7 @@ module testDeployment '../../deploy.bicep' = { } } ] - name: '<>-az-mdb-x-002' + name: '<>-mdb-${serviceShort}-002' } ] roleAssignments: [ diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/deploy.test.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/deploy.test.bicep index 37b4c69f32..0eef89286e 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/deploy.test.bicep +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/deploy.test.bicep @@ -92,11 +92,11 @@ module testDeployment '../../deploy.bicep' = { ] } ] - name: '<>-az-sql-x-001' + name: '<>-sql-${serviceShort}-001' } { containers: [] - name: '<>-az-sql-x-002' + name: '<>-sql-${serviceShort}-002' } ] userAssignedIdentities: { diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/readme.md b/modules/Microsoft.DocumentDB/databaseAccounts/readme.md index 6483e20972..6e6d7862ec 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/readme.md +++ b/modules/Microsoft.DocumentDB/databaseAccounts/readme.md @@ -593,7 +593,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = ] } ] - name: '<>-az-gdb-x-001' + name: '<>-gdb-dddagrm-001' } { collections: [ @@ -612,7 +612,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = ] } ] - name: '<>-az-gdb-x-002' + name: '<>-gdb-dddagrm-002' } ] location: '' @@ -699,7 +699,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = ] } ], - "name": "<>-az-gdb-x-001" + "name": "<>-gdb-dddagrm-001" }, { "collections": [ @@ -718,7 +718,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = ] } ], - "name": "<>-az-gdb-x-002" + "name": "<>-gdb-dddagrm-002" } ] }, @@ -866,7 +866,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = } } ] - name: '<>-az-mdb-x-001' + name: '<>-mdb-dddamng-001' } { collections: [ @@ -957,7 +957,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = } } ] - name: '<>-az-mdb-x-002' + name: '<>-mdb-dddamng-002' } ] roleAssignments: [ @@ -1113,7 +1113,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = } } ], - "name": "<>-az-mdb-x-001" + "name": "<>-mdb-dddamng-001" }, { "collections": [ @@ -1204,7 +1204,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = } } ], - "name": "<>-az-mdb-x-002" + "name": "<>-mdb-dddamng-002" } ] }, @@ -1387,11 +1387,11 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = ] } ] - name: '<>-az-sql-x-001' + name: '<>-sql-dddasql-001' } { containers: [] - name: '<>-az-sql-x-002' + name: '<>-sql-dddasql-002' } ] userAssignedIdentities: { @@ -1472,11 +1472,11 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = ] } ], - "name": "<>-az-sql-x-001" + "name": "<>-sql-dddasql-001" }, { "containers": [], - "name": "<>-az-sql-x-002" + "name": "<>-sql-dddasql-002" } ] }, From f95b72b6fc7a43b37afccd68cdd10ae07ff69060 Mon Sep 17 00:00:00 2001 From: Alexander Sehr Date: Sun, 18 Sep 2022 23:52:39 +0200 Subject: [PATCH 3/9] Update modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep --- .../databaseAccounts/.test/gremlindb/deploy.test.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep index ff9266c8f3..93fd420e1e 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/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.documentdb.databaseaccounts-${serviceShort}-rg' From 5ef7e16f34a80d671e7b67a90cb4d2a834d1776a Mon Sep 17 00:00:00 2001 From: Alexander Sehr Date: Sun, 18 Sep 2022 23:53:02 +0200 Subject: [PATCH 4/9] Update modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/deploy.test.bicep --- .../databaseAccounts/.test/mongodb/deploy.test.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/deploy.test.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/deploy.test.bicep index d11f703f54..735d384778 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/deploy.test.bicep +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/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.documentdb.databaseaccounts-${serviceShort}-rg' From a4c210d4ac0c5004b46d470cf6820494109446a7 Mon Sep 17 00:00:00 2001 From: Alexander Sehr Date: Sun, 18 Sep 2022 23:53:24 +0200 Subject: [PATCH 5/9] Update modules/Microsoft.DocumentDB/databaseAccounts/.test/plain/deploy.test.bicep --- .../databaseAccounts/.test/plain/deploy.test.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/plain/deploy.test.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/plain/deploy.test.bicep index 62190b2b60..594ea6780b 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/.test/plain/deploy.test.bicep +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/plain/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.documentdb.databaseaccounts-${serviceShort}-rg' From fe6975e3a2ce7a8aa0b824e3535bb469f43a78e0 Mon Sep 17 00:00:00 2001 From: Alexander Sehr Date: Sun, 18 Sep 2022 23:53:50 +0200 Subject: [PATCH 6/9] Apply suggestions from code review --- .../databaseAccounts/.test/sqldb/deploy.test.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/deploy.test.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/deploy.test.bicep index 0eef89286e..a3b537aef5 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/deploy.test.bicep +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/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.documentdb.databaseaccounts-${serviceShort}-rg' From 2dbf7bab92bc95e55f6ea1280a532e0d5f13a6b3 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Wed, 5 Oct 2022 19:00:24 +0200 Subject: [PATCH 7/9] Update to latest --- .../databaseAccounts/.test/gremlindb/deploy.test.bicep | 6 +++--- .../databaseAccounts/.test/mongodb/deploy.test.bicep | 6 +++--- .../databaseAccounts/.test/plain/deploy.test.bicep | 6 +++--- .../databaseAccounts/.test/sqldb/deploy.test.bicep | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep index 93fd420e1e..6b8bb0eb0b 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/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.documentdb.databaseaccounts-${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 = 'dddagrm' // =========== // diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/deploy.test.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/deploy.test.bicep index 735d384778..0e421431ca 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/deploy.test.bicep +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/mongodb/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.documentdb.databaseaccounts-${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 = 'dddamng' // =========== // diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/plain/deploy.test.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/plain/deploy.test.bicep index 594ea6780b..6232658a32 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/.test/plain/deploy.test.bicep +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/plain/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.documentdb.databaseaccounts-${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 = 'dddapln' // =========== // diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/deploy.test.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/deploy.test.bicep index a3b537aef5..ba969485eb 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/deploy.test.bicep +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/sqldb/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.documentdb.databaseaccounts-${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 = 'dddasql' // =========== // From 9d946da109f9640474b35f1a3327394abca7dcf2 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 14 Oct 2022 10:12:56 +0200 Subject: [PATCH 8/9] Update to latest --- modules/Microsoft.DocumentDB/databaseAccounts/readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/readme.md b/modules/Microsoft.DocumentDB/databaseAccounts/readme.md index 6e6d7862ec..8e44937084 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/readme.md +++ b/modules/Microsoft.DocumentDB/databaseAccounts/readme.md @@ -28,12 +28,14 @@ This module deploys a DocumentDB database account and its child resources. ## Parameters **Required parameters** + | Parameter Name | Type | Description | | :-- | :-- | :-- | | `locations` | array | Locations enabled for the Cosmos DB account. | | `name` | string | Name of the Database Account. | **Optional parameters** + | Parameter Name | Type | Default Value | Allowed Values | Description | | :-- | :-- | :-- | :-- | :-- | | `automaticFailover` | bool | `True` | | Enable automatic failover for regions. | From e7cd65d3e281a7bee94ce81ca057882e800e14c3 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 14 Oct 2022 11:13:32 +0200 Subject: [PATCH 9/9] Resolved conflict --- .../databaseAccounts/.test/gremlindb/deploy.test.bicep | 2 +- modules/Microsoft.DocumentDB/databaseAccounts/readme.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep b/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep index 6b8bb0eb0b..9906daef08 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep +++ b/modules/Microsoft.DocumentDB/databaseAccounts/.test/gremlindb/deploy.test.bicep @@ -54,7 +54,7 @@ module testDeployment '../../deploy.bicep' = { scope: resourceGroup name: '${uniqueString(deployment().name)}-test-${serviceShort}' params: { - name: '<>${serviceShort}001' + name: '<>${serviceShort}002' locations: [ { failoverPriority: 0 diff --git a/modules/Microsoft.DocumentDB/databaseAccounts/readme.md b/modules/Microsoft.DocumentDB/databaseAccounts/readme.md index ebfd4ac323..4948be56e8 100644 --- a/modules/Microsoft.DocumentDB/databaseAccounts/readme.md +++ b/modules/Microsoft.DocumentDB/databaseAccounts/readme.md @@ -567,7 +567,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = locationName: 'North Europe' } ] - name: '<>dddagrm001' + name: '<>dddagrm002' // Non-required parameters capabilitiesToAdd: [ 'EnableGremlin' @@ -659,7 +659,7 @@ module databaseAccounts './Microsoft.DocumentDB/databaseAccounts/deploy.bicep' = ] }, "name": { - "value": "<>dddagrm001" + "value": "<>dddagrm002" }, // Non-required parameters "capabilitiesToAdd": {