From 55ae2841257a36e4c75c3a6c9dbc1580129134d8 Mon Sep 17 00:00:00 2001 From: AlexanderSehr Date: Sun, 20 Nov 2022 17:41:06 +0100 Subject: [PATCH 1/3] Updated PowerBI Dedicated - capacities to new dependencies approach --- .../ms.powerbidedicated.capacities.yml | 3 +- .../.test/common/dependencies.bicep | 14 +++ .../capacities/.test/common/deploy.test.bicep | 63 ++++++++++++ .../capacities/.test/min.parameters.json | 17 ---- .../capacities/.test/min/dependencies.bicep | 14 +++ .../capacities/.test/min/deploy.test.bicep | 49 +++++++++ .../capacities/readme.md | 99 +++++++++++++++++-- 7 files changed, 234 insertions(+), 25 deletions(-) create mode 100644 modules/Microsoft.PowerBIDedicated/capacities/.test/common/dependencies.bicep create mode 100644 modules/Microsoft.PowerBIDedicated/capacities/.test/common/deploy.test.bicep delete mode 100644 modules/Microsoft.PowerBIDedicated/capacities/.test/min.parameters.json create mode 100644 modules/Microsoft.PowerBIDedicated/capacities/.test/min/dependencies.bicep create mode 100644 modules/Microsoft.PowerBIDedicated/capacities/.test/min/deploy.test.bicep diff --git a/.github/workflows/ms.powerbidedicated.capacities.yml b/.github/workflows/ms.powerbidedicated.capacities.yml index 51abde8731..5f17232953 100644 --- a/.github/workflows/ms.powerbidedicated.capacities.yml +++ b/.github/workflows/ms.powerbidedicated.capacities.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.PowerBIDedicated/capacities/.test/common/dependencies.bicep b/modules/Microsoft.PowerBIDedicated/capacities/.test/common/dependencies.bicep new file mode 100644 index 0000000000..7371d4437b --- /dev/null +++ b/modules/Microsoft.PowerBIDedicated/capacities/.test/common/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.PowerBIDedicated/capacities/.test/common/deploy.test.bicep b/modules/Microsoft.PowerBIDedicated/capacities/.test/common/deploy.test.bicep new file mode 100644 index 0000000000..87d70d85e3 --- /dev/null +++ b/modules/Microsoft.PowerBIDedicated/capacities/.test/common/deploy.test.bicep @@ -0,0 +1,63 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for testing purposes.') +@maxLength(90) +param resourceGroupName string = 'ms.powerbidedicated.capacities-${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 = 'pbdcapcom' + +// =========== // +// 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}' + } +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + skuCapacity: 1 + lock: 'CanNotDelete' + members: [ + resourceGroupResources.outputs.managedIdentityPrincipalId + ] + roleAssignments: [ + { + roleDefinitionIdOrName: 'Reader' + principalIds: [ + resourceGroupResources.outputs.managedIdentityPrincipalId + ] + principalType: 'ServicePrincipal' + } + ] + tags: { + Environment: 'Non-Prod' + Role: 'DeploymentValidation' + } + } +} diff --git a/modules/Microsoft.PowerBIDedicated/capacities/.test/min.parameters.json b/modules/Microsoft.PowerBIDedicated/capacities/.test/min.parameters.json deleted file mode 100644 index a7852b57b0..0000000000 --- a/modules/Microsoft.PowerBIDedicated/capacities/.test/min.parameters.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>azpbid001" - }, - "skuCapacity": { - "value": 1 - }, - "members": { - "value": [ - "<>" - ] - } - } -} diff --git a/modules/Microsoft.PowerBIDedicated/capacities/.test/min/dependencies.bicep b/modules/Microsoft.PowerBIDedicated/capacities/.test/min/dependencies.bicep new file mode 100644 index 0000000000..7371d4437b --- /dev/null +++ b/modules/Microsoft.PowerBIDedicated/capacities/.test/min/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.PowerBIDedicated/capacities/.test/min/deploy.test.bicep b/modules/Microsoft.PowerBIDedicated/capacities/.test/min/deploy.test.bicep new file mode 100644 index 0000000000..1840c061a8 --- /dev/null +++ b/modules/Microsoft.PowerBIDedicated/capacities/.test/min/deploy.test.bicep @@ -0,0 +1,49 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for testing purposes.') +@maxLength(90) +param resourceGroupName string = 'ms.powerbidedicated.capacities-${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 = 'pbdcapmin' + +// =========== // +// 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}' + } +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + skuCapacity: 1 + members: [ + resourceGroupResources.outputs.managedIdentityPrincipalId + ] + } +} diff --git a/modules/Microsoft.PowerBIDedicated/capacities/readme.md b/modules/Microsoft.PowerBIDedicated/capacities/readme.md index aa876c8529..161fac92c6 100644 --- a/modules/Microsoft.PowerBIDedicated/capacities/readme.md +++ b/modules/Microsoft.PowerBIDedicated/capacities/readme.md @@ -161,7 +161,7 @@ The following module usage examples are retrieved from the content of the files >**Note**: Each example lists all the required parameters first, followed by the rest - each in alphabetical order. -

Example 1: Min

+

Example 1: Common

@@ -169,13 +169,100 @@ The following module usage examples are retrieved from the content of the files ```bicep module capacities './Microsoft.PowerBIDedicated/capacities/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-Capacities' + name: '${uniqueString(deployment().name)}-test-pbdcapcom' params: { // Required parameters members: [ - '<>' + '' ] - name: '<>azpbid001' + name: '<>pbdcapcom001' + skuCapacity: 1 + // Non-required parameters + lock: 'CanNotDelete' + roleAssignments: [ + { + principalIds: [ + '' + ] + principalType: 'ServicePrincipal' + roleDefinitionIdOrName: 'Reader' + } + ] + tags: { + Environment: 'Non-Prod' + Role: 'DeploymentValidation' + } + } +} +``` + +
+

+ +

+ +via JSON Parameter file + +```json +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + // Required parameters + "members": { + "value": [ + "" + ] + }, + "name": { + "value": "<>pbdcapcom001" + }, + "skuCapacity": { + "value": 1 + }, + // Non-required parameters + "lock": { + "value": "CanNotDelete" + }, + "roleAssignments": { + "value": [ + { + "principalIds": [ + "" + ], + "principalType": "ServicePrincipal", + "roleDefinitionIdOrName": "Reader" + } + ] + }, + "tags": { + "value": { + "Environment": "Non-Prod", + "Role": "DeploymentValidation" + } + } + } +} +``` + +
+

+ +

Example 2: Min

+ +
+ +via Bicep module + +```bicep +module capacities './Microsoft.PowerBIDedicated/capacities/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-pbdcapmin' + params: { + // Required parameters + members: [ + '' + ] + name: '<>pbdcapmin001' skuCapacity: 1 } } @@ -196,11 +283,11 @@ module capacities './Microsoft.PowerBIDedicated/capacities/deploy.bicep' = { // Required parameters "members": { "value": [ - "<>" + "" ] }, "name": { - "value": "<>azpbid001" + "value": "<>pbdcapmin001" }, "skuCapacity": { "value": 1 From 6a9b55d9c684a39bd5aec466ed6876910607f80a Mon Sep 17 00:00:00 2001 From: AlexanderSehr Date: Sun, 20 Nov 2022 17:50:27 +0100 Subject: [PATCH 2/3] Update to latest --- SUPPORT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SUPPORT.md b/SUPPORT.md index 5f8e13652a..857294125b 100644 --- a/SUPPORT.md +++ b/SUPPORT.md @@ -2,7 +2,7 @@ ## Microsoft Support Policy -If issues are encountered when deploying these Bicep modules users will be able to engage Microsoft support via their usual channels. Please provide corelation IDs where possible when contacting support to be able to investigate the issue effectively and in a timely fashion. For instructions on how to get deployments and correlation ID, please follow this link [here](https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/deployment-history?tabs=azure-portal#get-deployments-and-correlation-id). +If issues are encountered when deploying these Bicep modules users will be able to engage Microsoft support via their usual channels. Please provide correlation IDs where possible when contacting support to be able to investigate the issue effectively and in a timely fashion. For instructions on how to get deployments and correlation ID, please follow this link [here](https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/deployment-history?tabs=azure-portal#get-deployments-and-correlation-id). Following list of issues are within the scope of Microsoft support: From cb3e3a524c5a85500a73543acd65c807c7b43b06 Mon Sep 17 00:00:00 2001 From: AlexanderSehr Date: Sun, 20 Nov 2022 17:50:40 +0100 Subject: [PATCH 3/3] Update to latest --- SUPPORT.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SUPPORT.md b/SUPPORT.md index 857294125b..e7fec2f4f8 100644 --- a/SUPPORT.md +++ b/SUPPORT.md @@ -22,7 +22,7 @@ Project maintainers will aim to respond to new issues on a best effort basis. This project uses GitHub Issues to track bugs and feature requests. Please search the existing issues before filing new issues to avoid duplicates. For new issues, file your bug or feature request as a new Issue. -For help and questions about using this project, please submit a Github issue with corresponding [Issue Labels found here](https://github.com/Azure/ResourceModules/labels). +For help and questions about using this project, please submit a GitHub issue with corresponding [Issue Labels found here](https://github.com/Azure/ResourceModules/labels). @@ -32,5 +32,5 @@ For help and questions about using this project, please submit a Github issue wi [GitHubIssues]: [Contributing]: CONTRIBUTING.md [AzureIcon]: docs/media/MicrosoftAzure-32px.png -[PowershellIcon]: docs/media/MicrosoftPowerShellCore-32px.png +[PowerShellIcon]: docs/media/MicrosoftPowerShellCore-32px.png [BashIcon]: docs/media/Bash_Logo_black_and_white_icon_only-32px.svg.png