From 09b2bdf0b72cad5112203932a9299a72aa3b2f61 Mon Sep 17 00:00:00 2001 From: Nicky Griffin <153103937+31Nick@users.noreply.github.com> Date: Fri, 14 Feb 2025 10:01:07 +0000 Subject: [PATCH] feat: New module `avm/ptn/mgmt-groups/subscription-placement` (#3904) ## Description Adding the sub-placement pattern module Closes https://github.com/Azure/Azure-Verified-Modules/issues/1585#issuecomment-2516149681 ## Pipeline Reference | Pipeline | | -------- | | [![avm.ptn.mgmt-groups.subscription-placement](https://github.com/oZakari/bicep-registry-modules/actions/workflows/avm.ptn.mgmt-groups.subscription-placement.yml/badge.svg?branch=sub-placement-development)](https://github.com/oZakari/bicep-registry-modules/actions/workflows/avm.ptn.mgmt-groups.subscription-placement.yml)| ## Type of Change - [ ] Update to CI Environment or utilities (Non-module affecting changes) - [x] Azure Verified Module updates: - [ ] Bugfix containing backwards-compatible bug fixes, and I have NOT bumped the MAJOR or MINOR version in `version.json`: - [ ] Someone has opened a bug report issue, and I have included "Closes #{bug_report_issue_number}" in the PR description. - [ ] The bug was found by the module author, and no one has opened an issue to report it yet. - [ ] Feature update backwards compatible feature updates, and I have bumped the MINOR version in `version.json`. - [ ] Breaking changes and I have bumped the MAJOR version in `version.json`. - [ ] Update to documentation - [ ] @avm-core-team-technical-bicep TODO: Add custom secret 'subscriptionBillingScope', 'rootManagementGroupId' ; to AVM CI ## Checklist - [x] I'm sure there are no other open Pull Requests for the same update/change - [x] I have run `Set-AVMModule` locally to generate the supporting module files. - [x] My corresponding pipelines / checks run clean and green without any errors or warnings --------- Co-authored-by: Zach Trocinski Co-authored-by: Zach Trocinski <30884663+oZakari@users.noreply.github.com> Co-authored-by: Alexander Sehr --- .github/CODEOWNERS | 1 + .github/ISSUE_TEMPLATE/avm_module_issue.yml | 1 + ...ptn.mgmt-groups.subscription-placement.yml | 84 +++++++++ .../subscription-placement/README.md | 170 ++++++++++++++++++ .../subscription-placement/main.bicep | 67 +++++++ .../subscription-placement/main.json | 168 +++++++++++++++++ .../modules/helper.bicep | 19 ++ .../tests/e2e/defaults/dependencies.bicep | 50 ++++++ .../tests/e2e/defaults/main.test.bicep | 52 ++++++ .../subscription-placement/version.json | 7 + 10 files changed, 619 insertions(+) create mode 100644 .github/workflows/avm.ptn.mgmt-groups.subscription-placement.yml create mode 100644 avm/ptn/mgmt-groups/subscription-placement/README.md create mode 100644 avm/ptn/mgmt-groups/subscription-placement/main.bicep create mode 100644 avm/ptn/mgmt-groups/subscription-placement/main.json create mode 100644 avm/ptn/mgmt-groups/subscription-placement/modules/helper.bicep create mode 100644 avm/ptn/mgmt-groups/subscription-placement/tests/e2e/defaults/dependencies.bicep create mode 100644 avm/ptn/mgmt-groups/subscription-placement/tests/e2e/defaults/main.test.bicep create mode 100644 avm/ptn/mgmt-groups/subscription-placement/version.json diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 08a92eb9b6..e2ab1172d0 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -31,6 +31,7 @@ /avm/ptn/dev-ops/cicd-agents-and-runners/ @Azure/avm-ptn-devops-cicdagentsandrunners-module-owners-bicep @Azure/avm-module-reviewers-bicep /avm/ptn/finops-toolkit/finops-hub/ @Azure/avm-ptn-finopstoolkit-finopshub-module-owners-bicep @Azure/avm-module-reviewers-bicep /avm/ptn/lz/sub-vending/ @Azure/avm-ptn-lz-subvending-module-owners-bicep @Azure/avm-module-reviewers-bicep +/avm/ptn/mgmt-groups/subscription-placement/ @Azure/avm-ptn-mgmtgroups-subscriptionplacement-module-owners-bicep @Azure/avm-module-reviewers-bicep /avm/ptn/network/hub-networking/ @Azure/avm-ptn-network-hubnetworking-module-owners-bicep @Azure/avm-module-reviewers-bicep /avm/ptn/network/private-link-private-dns-zones/ @Azure/avm-ptn-network-privatelinkprivatednszones-module-owners-bicep @Azure/avm-module-reviewers-bicep /avm/ptn/policy-insights/remediation/ @Azure/avm-ptn-policyinsights-remediation-module-owners-bicep @Azure/avm-module-reviewers-bicep diff --git a/.github/ISSUE_TEMPLATE/avm_module_issue.yml b/.github/ISSUE_TEMPLATE/avm_module_issue.yml index 2dd1ba254e..871a9782a5 100644 --- a/.github/ISSUE_TEMPLATE/avm_module_issue.yml +++ b/.github/ISSUE_TEMPLATE/avm_module_issue.yml @@ -66,6 +66,7 @@ body: - "avm/ptn/dev-ops/cicd-agents-and-runners" - "avm/ptn/finops-toolkit/finops-hub" - "avm/ptn/lz/sub-vending" + - "avm/ptn/mgmt-groups/subscription-placement" - "avm/ptn/network/hub-networking" - "avm/ptn/network/private-link-private-dns-zones" - "avm/ptn/policy-insights/remediation" diff --git a/.github/workflows/avm.ptn.mgmt-groups.subscription-placement.yml b/.github/workflows/avm.ptn.mgmt-groups.subscription-placement.yml new file mode 100644 index 0000000000..a55eedcb45 --- /dev/null +++ b/.github/workflows/avm.ptn.mgmt-groups.subscription-placement.yml @@ -0,0 +1,84 @@ +name: "avm.ptn.mgmt-groups.subscription-placement" + +on: + workflow_dispatch: + inputs: + staticValidation: + type: boolean + description: "Execute static validation" + required: false + default: true + deploymentValidation: + type: boolean + description: "Execute deployment validation" + required: false + default: true + removeDeployment: + type: boolean + description: "Remove deployed module" + required: false + default: true + push: + branches: + - main + paths: + - ".github/actions/templates/avm-**" + - ".github/workflows/avm.template.module.yml" + - ".github/workflows/avm.ptn.mgmt-groups.subscription-placement.yml" + - "avm/ptn/lz/sub-placement/**" + - "avm/utilities/pipelines/**" + - "!avm/utilities/pipelines/platform/**" + - "!*/**/README.md" + +env: + modulePath: "avm/ptn/mgmt-groups/subscription-placement" + workflowPath: ".github/workflows/avm.ptn.mgmt-groups.subscription-placement.yml" + +concurrency: + group: ${{ github.workflow }} + +jobs: + ########################### + # Initialize pipeline # + ########################### + job_initialize_pipeline: + runs-on: ubuntu-latest + name: "Initialize pipeline" + steps: + - name: "Checkout" + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: "Set input parameters to output variables" + id: get-workflow-param + uses: ./.github/actions/templates/avm-getWorkflowInput + with: + workflowPath: "${{ env.workflowPath}}" + - name: "Get module test file paths" + id: get-module-test-file-paths + uses: ./.github/actions/templates/avm-getModuleTestFiles + with: + modulePath: "${{ env.modulePath }}" + outputs: + workflowInput: ${{ steps.get-workflow-param.outputs.workflowInput }} + moduleTestFilePaths: ${{ steps.get-module-test-file-paths.outputs.moduleTestFilePaths }} + psRuleModuleTestFilePaths: ${{ steps.get-module-test-file-paths.outputs.psRuleModuleTestFilePaths }} + modulePath: "${{ env.modulePath }}" + + ############################## + # Call reusable workflow # + ############################## + call-workflow-passing-data: + name: "Run" + permissions: + id-token: write # For OIDC + contents: write # For release tags + needs: + - job_initialize_pipeline + uses: ./.github/workflows/avm.template.module.yml + with: + workflowInput: "${{ needs.job_initialize_pipeline.outputs.workflowInput }}" + moduleTestFilePaths: "${{ needs.job_initialize_pipeline.outputs.moduleTestFilePaths }}" + psRuleModuleTestFilePaths: "${{ needs.job_initialize_pipeline.outputs.psRuleModuleTestFilePaths }}" + modulePath: "${{ needs.job_initialize_pipeline.outputs.modulePath}}" + secrets: inherit diff --git a/avm/ptn/mgmt-groups/subscription-placement/README.md b/avm/ptn/mgmt-groups/subscription-placement/README.md new file mode 100644 index 0000000000..8f1c07509a --- /dev/null +++ b/avm/ptn/mgmt-groups/subscription-placement/README.md @@ -0,0 +1,170 @@ +# subscription-placement `[MgmtGroups/SubscriptionPlacement]` + +This module allows for placement of subscriptions to management groups + +## Navigation + +- [Resource Types](#Resource-Types) +- [Usage examples](#Usage-examples) +- [Parameters](#Parameters) +- [Outputs](#Outputs) +- [Data Collection](#Data-Collection) + +## Resource Types + +| Resource Type | API Version | +| :-- | :-- | +| `Microsoft.Management/managementGroups/subscriptions` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Management/2023-04-01/managementGroups/subscriptions) | + +## Usage examples + +The following section provides usage examples for the module, which were used to validate and deploy the module successfully. For a full reference, please review the module's test folder in its repository. + +>**Note**: Each example lists all the required parameters first, followed by the rest - each in alphabetical order. + +>**Note**: To reference the module, please use the following syntax `br/public:avm/ptn/mgmt-groups/subscription-placement:`. + +- [Using only defaults.](#example-1-using-only-defaults) + +### Example 1: _Using only defaults._ + +This instance deploys the module with the minimum set of required parameters. + + +
+ +via Bicep module + +```bicep +module subscriptionPlacement 'br/public:avm/ptn/mgmt-groups/subscription-placement:' = { + name: 'subscriptionPlacementDeployment' + params: { + parSubscriptionPlacement: [ + { + managementGroupId: '' + subscriptionIds: [ + '' + ] + } + ] + } +} +``` + +
+

+ +

+ +via JSON parameters file + +```json +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "parSubscriptionPlacement": { + "value": [ + { + "managementGroupId": "", + "subscriptionIds": [ + "" + ] + } + ] + } + } +} +``` + +
+

+ +

+ +via Bicep parameters file + +```bicep-params +using 'br/public:avm/ptn/mgmt-groups/subscription-placement:' + +param parSubscriptionPlacement = [ + { + managementGroupId: '' + subscriptionIds: [ + '' + ] + } +] +``` + +
+

+ +## Parameters + +**Required parameters** + +| Parameter | Type | Description | +| :-- | :-- | :-- | +| [`parSubscriptionPlacement`](#parameter-parsubscriptionplacement) | array | The management group IDs along with the subscriptions to be placed underneath them. | + +**Optional parameters** + +| Parameter | Type | Description | +| :-- | :-- | :-- | +| [`enableTelemetry`](#parameter-enabletelemetry) | bool | Enable/Disable usage telemetry for module. | +| [`location`](#parameter-location) | string | Location for all resources. | + +### Parameter: `parSubscriptionPlacement` + +The management group IDs along with the subscriptions to be placed underneath them. + +- Required: Yes +- Type: array + +**Required parameters** + +| Parameter | Type | Description | +| :-- | :-- | :-- | +| [`managementGroupId`](#parameter-parsubscriptionplacementmanagementgroupid) | string | The ID of the management group. | +| [`subscriptionIds`](#parameter-parsubscriptionplacementsubscriptionids) | array | The list of subscription IDs to be placed underneath the management group. | + +### Parameter: `parSubscriptionPlacement.managementGroupId` + +The ID of the management group. + +- Required: Yes +- Type: string + +### Parameter: `parSubscriptionPlacement.subscriptionIds` + +The list of subscription IDs to be placed underneath the management group. + +- Required: Yes +- Type: array + +### Parameter: `enableTelemetry` + +Enable/Disable usage telemetry for module. + +- Required: No +- Type: bool +- Default: `True` + +### Parameter: `location` + +Location for all resources. + +- Required: No +- Type: string +- Default: `[deployment().location]` + +## Outputs + +| Output | Type | Description | +| :-- | :-- | :-- | +| `subscriptionPlacementSummary` | string | Output of number of management groups that have been configured with subscription placements. | + +## Data Collection + +The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the [repository](https://aka.ms/avm/telemetry). There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at . You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices. diff --git a/avm/ptn/mgmt-groups/subscription-placement/main.bicep b/avm/ptn/mgmt-groups/subscription-placement/main.bicep new file mode 100644 index 0000000000..d80dd04d8f --- /dev/null +++ b/avm/ptn/mgmt-groups/subscription-placement/main.bicep @@ -0,0 +1,67 @@ +targetScope = 'tenant' + +metadata name = 'subscription-placement' +metadata description = 'This module allows for placement of subscriptions to management groups ' + +// ------------------ +// PARAMETERS +// ------------------ + +@description('Required. The management group IDs along with the subscriptions to be placed underneath them.') +param parSubscriptionPlacement subscriptionPlacementType[] + +@description('Optional. Location for all resources.') +param location string = deployment().location + +@description('Optional. Enable/Disable usage telemetry for module.') +param enableTelemetry bool = true + +#disable-next-line no-deployments-resources +resource avmTelemetry 'Microsoft.Resources/deployments@2024-03-01' = if (enableTelemetry) { + name: '46d3xbcp.ptn.mgmtgroup-subplacement.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}' + location: location + properties: { + mode: 'Incremental' + template: { + '$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#' + contentVersion: '1.0.0.0' + resources: [] + outputs: { + telemetry: { + type: 'String' + value: 'For more information, see https://aka.ms/avm/TelemetryInfo' + } + } + } + } +} + +module customSubscriptionPlacement './modules/helper.bicep' = [ + for (subscriptionPlacement, index) in parSubscriptionPlacement: { + name: 'subPlacment-${uniqueString(subscriptionPlacement.managementGroupId)}${index}' + params: { + managementGroupId: subscriptionPlacement.managementGroupId + subscriptionIds: subscriptionPlacement.subscriptionIds + } + } +] + +// =============== // +// Outputs // +// =============== // + +@description('Output of number of management groups that have been configured with subscription placements.') +output subscriptionPlacementSummary string = 'Subscription placements have been configured for ${length(parSubscriptionPlacement)} management groups.' + +// =============== // +// Definitions // +// =============== // + +@export() +@description('The type for a subscription placement.') +type subscriptionPlacementType = { + @description('Required. The ID of the management group.') + managementGroupId: string + @description('Required. The list of subscription IDs to be placed underneath the management group.') + subscriptionIds: string[] +} diff --git a/avm/ptn/mgmt-groups/subscription-placement/main.json b/avm/ptn/mgmt-groups/subscription-placement/main.json new file mode 100644 index 0000000000..bdd798c56b --- /dev/null +++ b/avm/ptn/mgmt-groups/subscription-placement/main.json @@ -0,0 +1,168 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-08-01/tenantDeploymentTemplate.json#", + "languageVersion": "2.0", + "contentVersion": "1.0.0.0", + "metadata": { + "_generator": { + "name": "bicep", + "version": "0.33.13.18514", + "templateHash": "2325138724313533895" + }, + "name": "subscription-placement", + "description": "This module allows for placement of subscriptions to management groups ", + "owner": "Azure/module-maintainers" + }, + "definitions": { + "subscriptionPlacementType": { + "type": "object", + "properties": { + "managementGroupId": { + "type": "string", + "metadata": { + "description": "Required. The ID of the management group." + } + }, + "subscriptionIds": { + "type": "array", + "items": { + "type": "string" + }, + "metadata": { + "description": "Required. The list of subscription IDs to be placed underneath the management group." + } + } + } + } + }, + "parameters": { + "parSubscriptionPlacement": { + "type": "array", + "items": { + "$ref": "#/definitions/subscriptionPlacementType" + }, + "metadata": { + "description": "Required. The management group IDs along with the subscriptions to be placed underneath them." + } + }, + "location": { + "type": "string", + "defaultValue": "[deployment().location]", + "metadata": { + "description": "Optional. Location for all resources." + } + }, + "enableTelemetry": { + "type": "bool", + "defaultValue": true, + "metadata": { + "description": "Optional. Enable/Disable usage telemetry for module." + } + } + }, + "resources": { + "avmTelemetry": { + "condition": "[parameters('enableTelemetry')]", + "type": "Microsoft.Resources/deployments", + "apiVersion": "2024-03-01", + "name": "[format('46d3xbcp.ptn.mgmtgroup-subplacement.{0}.{1}', replace('-..--..-', '.', '-'), substring(uniqueString(deployment().name, parameters('location')), 0, 4))]", + "location": "[parameters('location')]", + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [], + "outputs": { + "telemetry": { + "type": "String", + "value": "For more information, see https://aka.ms/avm/TelemetryInfo" + } + } + } + } + }, + "customSubscriptionPlacement": { + "copy": { + "name": "customSubscriptionPlacement", + "count": "[length(parameters('parSubscriptionPlacement'))]" + }, + "type": "Microsoft.Resources/deployments", + "apiVersion": "2022-09-01", + "name": "[format('subPlacment-{0}{1}', uniqueString(parameters('parSubscriptionPlacement')[copyIndex()].managementGroupId), copyIndex())]", + "location": "[deployment().location]", + "properties": { + "expressionEvaluationOptions": { + "scope": "inner" + }, + "mode": "Incremental", + "parameters": { + "managementGroupId": { + "value": "[parameters('parSubscriptionPlacement')[copyIndex()].managementGroupId]" + }, + "subscriptionIds": { + "value": "[parameters('parSubscriptionPlacement')[copyIndex()].subscriptionIds]" + } + }, + "template": { + "$schema": "https://schema.management.azure.com/schemas/2019-08-01/tenantDeploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "_generator": { + "name": "bicep", + "version": "0.33.13.18514", + "templateHash": "10679020409212079790" + } + }, + "parameters": { + "managementGroupId": { + "type": "string", + "metadata": { + "description": "The ID of the management group." + } + }, + "subscriptionIds": { + "type": "array", + "metadata": { + "description": "The list of subscription IDs." + } + } + }, + "resources": [ + { + "copy": { + "name": "customSubscriptionPlacement", + "count": "[length(parameters('subscriptionIds'))]" + }, + "type": "Microsoft.Management/managementGroups/subscriptions", + "apiVersion": "2023-04-01", + "name": "[format('{0}/{1}', parameters('managementGroupId'), parameters('subscriptionIds')[copyIndex()])]" + } + ], + "outputs": { + "subscriptionPlacements": { + "type": "array", + "metadata": { + "description": "Output of the Management Group and Subscription Resource ID placements." + }, + "copy": { + "count": "[length(parameters('subscriptionIds'))]", + "input": { + "name": "[format('{0}/{1}', parameters('managementGroupId'), parameters('subscriptionIds')[copyIndex()])]" + } + } + } + } + } + } + } + }, + "outputs": { + "subscriptionPlacementSummary": { + "type": "string", + "metadata": { + "description": "Output of number of management groups that have been configured with subscription placements." + }, + "value": "[format('Subscription placements have been configured for {0} management groups.', length(parameters('parSubscriptionPlacement')))]" + } + } +} \ No newline at end of file diff --git a/avm/ptn/mgmt-groups/subscription-placement/modules/helper.bicep b/avm/ptn/mgmt-groups/subscription-placement/modules/helper.bicep new file mode 100644 index 0000000000..32476329c5 --- /dev/null +++ b/avm/ptn/mgmt-groups/subscription-placement/modules/helper.bicep @@ -0,0 +1,19 @@ +targetScope = 'tenant' + +@description('The ID of the management group.') +param managementGroupId string +@description('The list of subscription IDs.') +param subscriptionIds string[] + +resource customSubscriptionPlacement 'Microsoft.Management/managementGroups/subscriptions@2023-04-01' = [ + for (subscription, i) in subscriptionIds: { + name: '${managementGroupId}/${subscription}' + } +] + +@description('Output of the Management Group and Subscription Resource ID placements.') +output subscriptionPlacements array = [ + for (subscription, i) in subscriptionIds: { + name: '${managementGroupId}/${subscription}' + } +] diff --git a/avm/ptn/mgmt-groups/subscription-placement/tests/e2e/defaults/dependencies.bicep b/avm/ptn/mgmt-groups/subscription-placement/tests/e2e/defaults/dependencies.bicep new file mode 100644 index 0000000000..c737a20c3f --- /dev/null +++ b/avm/ptn/mgmt-groups/subscription-placement/tests/e2e/defaults/dependencies.bicep @@ -0,0 +1,50 @@ +targetScope = 'tenant' + +@description('Required. The root management group resource ID where the subscriptions will be placed.') +@secure() +param rootManagementGroupResourceId string + + +@description('Required. The scope of the subscription billing.') +@secure() +param subscriptionBillingScope string + +resource managementGroup 'Microsoft.Management/managementGroups@2023-04-01' = { + name: 'test-mgmt-group' + properties: { + displayName: 'Test Management Group' + details:{ + parent:{ + id: rootManagementGroupResourceId + } + } + } +} + +module subVending 'br/public:avm/ptn/lz/sub-vending:0.2.4' = { + name: 'subVendingDeployment' + scope: managementGroup + params: { + subscriptionAliasEnabled: true + subscriptionAliasName: 'NewSubscription' + subscriptionBillingScope: subscriptionBillingScope + subscriptionDisplayName: 'NewSubscription' + subscriptionTags: { + avmTest: 'true' + } + subscriptionWorkload: 'Production' + resourceProviders: {} + } +} + +@description('Output of the management group resource ID.') +output managementGroupId string = managementGroup.id + +@description('Output of the management group name.') +output managementGroupName string = managementGroup.name + +@description('Output of the subscription vending resource ID.') +output subVendingResourceId string = subVending.outputs.subscriptionResourceId + +@description('Output of the subscription vending subscription ID.') +output subVendingSubscriptionId string = subVending.outputs.subscriptionId diff --git a/avm/ptn/mgmt-groups/subscription-placement/tests/e2e/defaults/main.test.bicep b/avm/ptn/mgmt-groups/subscription-placement/tests/e2e/defaults/main.test.bicep new file mode 100644 index 0000000000..c62243ed5d --- /dev/null +++ b/avm/ptn/mgmt-groups/subscription-placement/tests/e2e/defaults/main.test.bicep @@ -0,0 +1,52 @@ +metadata name = 'Using only defaults.' +metadata description = 'This instance deploys the module with the minimum set of required parameters.' + +targetScope = 'tenant' + +@description('Optional. A token to inject into the name of each resource.') +param namePrefix string = '#_namePrefix_#' + +@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 = 'subplmin' + +@description('Required. The root management group resource ID where the subscriptions will be placed. This value is tenant-specific and must be stored in the CI Key Vault in a secret named \'CI-RootManagementGroupResourceId\'.') +@secure() +param rootManagementGroupResourceId string = '' + +@description('Required. The scope of the subscription billing. This value is tenant-specific and must be stored in the CI Key Vault in a secret named \'CI-SubscriptionBillingScope\'.') +@secure() +param subscriptionBillingScope string = '' + +// =============== // +// Dependencies // +// =============== // + +module dependencies './dependencies.bicep' = { + name: '${uniqueString(deployment().name, namePrefix)}-dependencies-${serviceShort}' + scope: tenant() + params: { + subscriptionBillingScope: subscriptionBillingScope + rootManagementGroupResourceId: rootManagementGroupResourceId + } +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../../main.bicep' = { + name: '${uniqueString(deployment().name, namePrefix)}-test-${serviceShort}' + params: { + parSubscriptionPlacement: [ + { + managementGroupId: dependencies.outputs.managementGroupName + subscriptionIds: [ + dependencies.outputs.subVendingSubscriptionId + ] + } + ] + } +} + +@description('This output retrieves the subscription placement summary from the test deployment outputs.') +output subscriptionPlacementSummary string = testDeployment.outputs.subscriptionPlacementSummary diff --git a/avm/ptn/mgmt-groups/subscription-placement/version.json b/avm/ptn/mgmt-groups/subscription-placement/version.json new file mode 100644 index 0000000000..8def869ede --- /dev/null +++ b/avm/ptn/mgmt-groups/subscription-placement/version.json @@ -0,0 +1,7 @@ +{ + "$schema": "https://aka.ms/bicep-registry-module-version-file-schema#", + "version": "0.1", + "pathFilters": [ + "./main.json" + ] +}