From 025e20ae3ab5262ca477947a893c6babe67e6f7c Mon Sep 17 00:00:00 2001 From: MrMCake Date: Sat, 3 Sep 2022 13:23:32 +0200 Subject: [PATCH 1/6] Updated databricks --- .../workflows/ms.databricks.workspaces.yml | 3 +- .../.test/default/dependencies.bicep | 14 ++++ .../.test/default/deploy.test.bicep | 73 +++++++++++++++++++ .../workspaces/.test/parameters.json | 37 ---------- .../Microsoft.Databricks/workspaces/readme.md | 28 +++---- 5 files changed, 102 insertions(+), 53 deletions(-) create mode 100644 modules/Microsoft.Databricks/workspaces/.test/default/dependencies.bicep create mode 100644 modules/Microsoft.Databricks/workspaces/.test/default/deploy.test.bicep delete mode 100644 modules/Microsoft.Databricks/workspaces/.test/parameters.json diff --git a/.github/workflows/ms.databricks.workspaces.yml b/.github/workflows/ms.databricks.workspaces.yml index 58d06e2dac..ce87d4c918 100644 --- a/.github/workflows/ms.databricks.workspaces.yml +++ b/.github/workflows/ms.databricks.workspaces.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.Databricks/workspaces/.test/default/dependencies.bicep b/modules/Microsoft.Databricks/workspaces/.test/default/dependencies.bicep new file mode 100644 index 0000000000..7371d4437b --- /dev/null +++ b/modules/Microsoft.Databricks/workspaces/.test/default/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.Databricks/workspaces/.test/default/deploy.test.bicep b/modules/Microsoft.Databricks/workspaces/.test/default/deploy.test.bicep new file mode 100644 index 0000000000..8324e5af08 --- /dev/null +++ b/modules/Microsoft.Databricks/workspaces/.test/default/deploy.test.bicep @@ -0,0 +1,73 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for a testing purposes') +@maxLength(90) +param resourceGroupName string = 'ms.databricks.workspaces-${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 = 'dwdef' + +// =========== // +// 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' + 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.Databricks/workspaces/.test/parameters.json b/modules/Microsoft.Databricks/workspaces/.test/parameters.json deleted file mode 100644 index dc327499f5..0000000000 --- a/modules/Microsoft.Databricks/workspaces/.test/parameters.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>-az-adb-x-001" - }, - "lock": { - "value": "CanNotDelete" - }, - "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.Databricks/workspaces/readme.md b/modules/Microsoft.Databricks/workspaces/readme.md index 4f3d2386dd..b6f746914f 100644 --- a/modules/Microsoft.Databricks/workspaces/readme.md +++ b/modules/Microsoft.Databricks/workspaces/readme.md @@ -228,7 +228,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: Parameters

+

Example 1: Default

@@ -236,21 +236,21 @@ The following module usage examples are retrieved from the content of the files ```bicep module workspaces './Microsoft.Databricks/workspaces/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-Workspaces' + name: '${uniqueString(deployment().name)}-test-dwdef' params: { // Required parameters - name: '<>-az-adb-x-001' + name: '<>dwdef001' // 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' } @@ -273,23 +273,23 @@ module workspaces './Microsoft.Databricks/workspaces/deploy.bicep' = { "parameters": { // Required parameters "name": { - "value": "<>-az-adb-x-001" + "value": "<>dwdef001" }, // 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" @@ -298,7 +298,7 @@ module workspaces './Microsoft.Databricks/workspaces/deploy.bicep' = { "value": [ { "principalIds": [ - "<>" + "" ], "roleDefinitionIdOrName": "Reader" } From ed003e98f38f130a3bb4ca4c38effc2adc86e0b3 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Thu, 8 Sep 2022 19:21:55 +0200 Subject: [PATCH 2/6] Updated folder default to common. --- .../workspaces/.test/{default => common}/dependencies.bicep | 0 .../workspaces/.test/{default => common}/deploy.test.bicep | 0 modules/Microsoft.Databricks/workspaces/readme.md | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename modules/Microsoft.Databricks/workspaces/.test/{default => common}/dependencies.bicep (100%) rename modules/Microsoft.Databricks/workspaces/.test/{default => common}/deploy.test.bicep (100%) diff --git a/modules/Microsoft.Databricks/workspaces/.test/default/dependencies.bicep b/modules/Microsoft.Databricks/workspaces/.test/common/dependencies.bicep similarity index 100% rename from modules/Microsoft.Databricks/workspaces/.test/default/dependencies.bicep rename to modules/Microsoft.Databricks/workspaces/.test/common/dependencies.bicep diff --git a/modules/Microsoft.Databricks/workspaces/.test/default/deploy.test.bicep b/modules/Microsoft.Databricks/workspaces/.test/common/deploy.test.bicep similarity index 100% rename from modules/Microsoft.Databricks/workspaces/.test/default/deploy.test.bicep rename to modules/Microsoft.Databricks/workspaces/.test/common/deploy.test.bicep diff --git a/modules/Microsoft.Databricks/workspaces/readme.md b/modules/Microsoft.Databricks/workspaces/readme.md index b6f746914f..d2d95fb8ac 100644 --- a/modules/Microsoft.Databricks/workspaces/readme.md +++ b/modules/Microsoft.Databricks/workspaces/readme.md @@ -228,7 +228,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 32191f55bbf96dd5bd913398d1bcd59d4a2115d1 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 9 Sep 2022 12:52:59 +0200 Subject: [PATCH 3/6] Update to latest --- .../workspaces/.test/common/deploy.test.bicep | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/Microsoft.Databricks/workspaces/.test/common/deploy.test.bicep b/modules/Microsoft.Databricks/workspaces/.test/common/deploy.test.bicep index 8324e5af08..923fee287c 100644 --- a/modules/Microsoft.Databricks/workspaces/.test/common/deploy.test.bicep +++ b/modules/Microsoft.Databricks/workspaces/.test/common/deploy.test.bicep @@ -10,8 +10,8 @@ param resourceGroupName string = 'ms.databricks.workspaces-${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 = 'dwdef' +@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 = 'dwcom' // =========== // // Deployments // From 1e8c073ece268f5c7edcfb2c4ceb083d941751a0 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 9 Sep 2022 13:06:18 +0200 Subject: [PATCH 4/6] Update to latest --- .../workspaces/.test/common/deploy.test.bicep | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/Microsoft.Databricks/workspaces/.test/common/deploy.test.bicep b/modules/Microsoft.Databricks/workspaces/.test/common/deploy.test.bicep index 923fee287c..db86afb0c7 100644 --- a/modules/Microsoft.Databricks/workspaces/.test/common/deploy.test.bicep +++ b/modules/Microsoft.Databricks/workspaces/.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.databricks.workspaces-${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 = 'dwcom' // =========== // From 640e76f508ae95d87e6f29860cb8419355e191d6 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 9 Sep 2022 14:19:32 +0200 Subject: [PATCH 5/6] Update to latest --- modules/Microsoft.Databricks/workspaces/readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/Microsoft.Databricks/workspaces/readme.md b/modules/Microsoft.Databricks/workspaces/readme.md index 472727dfc2..4e14f42b3a 100644 --- a/modules/Microsoft.Databricks/workspaces/readme.md +++ b/modules/Microsoft.Databricks/workspaces/readme.md @@ -237,10 +237,10 @@ The following module usage examples are retrieved from the content of the files ```bicep module workspaces './Microsoft.Databricks/workspaces/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-test-dwdef' + name: '${uniqueString(deployment().name)}-test-dwcom' params: { // Required parameters - name: '<>dwdef001' + name: '<>dwcom001' // Non-required parameters diagnosticEventHubAuthorizationRuleId: '' diagnosticEventHubName: '' @@ -274,7 +274,7 @@ module workspaces './Microsoft.Databricks/workspaces/deploy.bicep' = { "parameters": { // Required parameters "name": { - "value": "<>dwdef001" + "value": "<>dwcom001" }, // Non-required parameters "diagnosticEventHubAuthorizationRuleId": { From 9313191a6836c65abbc2093fb3c3aa1dfe6eaa7e Mon Sep 17 00:00:00 2001 From: Alexander Sehr Date: Mon, 19 Sep 2022 08:19:37 +0200 Subject: [PATCH 6/6] Update modules/Microsoft.Databricks/workspaces/.test/common/deploy.test.bicep --- .../workspaces/.test/common/deploy.test.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Microsoft.Databricks/workspaces/.test/common/deploy.test.bicep b/modules/Microsoft.Databricks/workspaces/.test/common/deploy.test.bicep index db86afb0c7..35e3d4dbcb 100644 --- a/modules/Microsoft.Databricks/workspaces/.test/common/deploy.test.bicep +++ b/modules/Microsoft.Databricks/workspaces/.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.databricks.workspaces-${serviceShort}-rg'