Skip to content

Commit

Permalink
feat: lz (sub) vending v1.4.1 release - Change Template Metadata an…
Browse files Browse the repository at this point in the history
…d add optional params for MCA Multi Tenant Scenario (#410)

## Description

lz (sub) vending `v1.4.1` release - Change Template Metadata and add
optional params for MCA Multi Tenant Scenario

## Downstream Artifcats

- Release: https://github.com/Azure/bicep-lz-vending/releases/tag/v1.4.1
- PR: Azure/bicep-lz-vending#42
- Tests:
https://github.com/Azure/bicep-lz-vending/actions/runs/5199625378/jobs/9377275161

cc: @StephenWeatherford and @shenglol 

## Updating an existing module

<!--Run through the checklist if your PR updates an existing module.-->

- [ ] This is a bug fix:
- [ ] 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.
- [x] I have run `brm validate` locally to verify the module files.
- [x] I have run deployment tests locally to ensure the module is
deployable.
- [x] I have read the [Updating an existing
module](https://github.com/Azure/bicep-registry-modules/blob/main/CONTRIBUTING.md#updating-an-existing-module)
section in the contributing guide and updated the `version.json` file
properly:
- [ ] The PR contains backwards compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`.
- [x] The PR contains backwards compatible feature updates, and I have
bumped the MINOR version in `version.json`.
- [ ] The PR contains breaking changes, and I have bumped the MAJOR
version in `version.json`.
- [x] I have updated the examples in README with the latest module
version number.
  • Loading branch information
jtracey93 authored Jun 13, 2023
1 parent cf69986 commit ef4b606
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 88 deletions.
20 changes: 12 additions & 8 deletions modules/lz/sub-vending/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ We would like feedback on what's missing in the module. Please raise an [issue](
| `subscriptionAliasName` | `string` | No | The name of the Subscription Alias, that will be created by this module.<br /><br />The string must be comprised of `a-z`, `A-Z`, `0-9`, `-`, `_` and ` ` (space). The maximum length is 63 characters.<br /><br />> **Not required when providing an existing Subscription ID via the parameter `existingSubscriptionId`**<br /><br />- Default value: `''` *(empty string)* |
| `subscriptionBillingScope` | `string` | No | The Billing Scope for the new Subscription alias, that will be created by this module.<br /><br />A valid Billing Scope starts with `/providers/Microsoft.Billing/billingAccounts/` and is case sensitive.<br /><br />> See below [example in parameter file](#example-json-parameter-file) for an example<br /><br />> **Not required when providing an existing Subscription ID via the parameter `existingSubscriptionId`**<br /><br />- Default value: `''` *(empty string)* |
| `subscriptionWorkload` | `string` | No | The workload type can be either `Production` or `DevTest` and is case sensitive.<br /><br />> **Not required when providing an existing Subscription ID via the parameter `existingSubscriptionId`**<br /><br />- Default value: `Production` |
| `subscriptionTenantId` | `string` | No | The Azure Active Directory Tenant ID (GUID) to which the Subscription should be attached to.<br /><br />> **Leave blank unless following this scenario only [Programmatically create MCA subscriptions across Azure Active Directory tenants](https://learn.microsoft.com/azure/cost-management-billing/manage/programmatically-create-subscription-microsoft-customer-agreement-across-tenants).**<br /><br />- Default value: `''` *(empty string)* |
| `subscriptionOwnerId` | `string` | No | The Azure Active Directory principals object ID (GUID) to whom should be the Subscription Owner.<br /><br />> **Leave blank unless following this scenario only [Programmatically create MCA subscriptions across Azure Active Directory tenants](https://learn.microsoft.com/azure/cost-management-billing/manage/programmatically-create-subscription-microsoft-customer-agreement-across-tenants).**<br /><br />- Default value: `''` *(empty string)* |
| `existingSubscriptionId` | `string` | No | An existing subscription ID. Use this when you do not want the module to create a new subscription. But do want to manage the management group membership. A subscription ID should be provided in the example format `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`.<br /><br />- Default value: `''` *(empty string)* |
| `subscriptionManagementGroupAssociationEnabled` | `bool` | No | Whether to move the Subscription to the specified Management Group supplied in the parameter `subscriptionManagementGroupId`.<br /><br />- Default value: `true` |
| `subscriptionManagementGroupId` | `string` | No | The destination Management Group ID for the new Subscription that will be created by this module (or the existing one provided in the parameter `existingSubscriptionId`).<br /><br />**IMPORTANT:** Do not supply the display name of the Management Group. The Management Group ID forms part of the Azure Resource ID. e.g., `/providers/Microsoft.Management/managementGroups/{managementGroupId}`.<br /><br />> See below [example in parameter file](#example-json-parameter-file) for an example<br /><br />- Default value: `''` *(empty string)* |
Expand Down Expand Up @@ -63,10 +65,12 @@ We would like feedback on what's missing in the module. Please raise an [issue](

## Outputs

| Name | Type | Description |
| :--------------------- | :----: | :-------------------------------------------------------------- |
| subscriptionId | string | The Subscription ID that has been created or provided. |
| subscriptionResourceId | string | The Subscription Resource ID that has been created or provided. |
| Name | Type | Description |
| :--------------------------------- | :------: | :--------------------------------------------------------------------------------------- |
| `subscriptionId` | `string` | The Subscription ID that has been created or provided. |
| `subscriptionResourceId` | `string` | The Subscription Resource ID that has been created or provided. |
| `subscriptionAcceptOwnershipState` | `string` | The Subscription Owner State. Only used when creating MCA Subscriptions across tenants |
| `subscriptionAcceptOwnershipUrl` | `string` | The Subscription Ownership URL. Only used when creating MCA Subscriptions across tenants |

## Examples

Expand All @@ -77,7 +81,7 @@ We would like feedback on what's missing in the module. Please raise an [issue](
```bicep
targetScope = 'managementGroup'
module sub001 'br/public:lz/sub-vending:1.3.1' = {
module sub001 'br/public:lz/sub-vending:1.4.1' = {
name: 'sub001'
params: {
subscriptionAliasEnabled: true
Expand All @@ -102,7 +106,7 @@ targetScope = 'managementGroup'
@description('Specifies the location for resources.')
param location string = 'uksouth'
module sub002 'br/public:lz/sub-vending:1.3.1' = {
module sub002 'br/public:lz/sub-vending:1.4.1' = {
name: 'sub002'
params: {
subscriptionAliasEnabled: true
Expand Down Expand Up @@ -135,7 +139,7 @@ targetScope = 'managementGroup'
@description('Specifies the location for resources.')
param location string = 'uksouth'
module sub003 'br/public:lz/sub-vending:1.3.1' = {
module sub003 'br/public:lz/sub-vending:1.4.1' = {
name: 'sub003'
params: {
subscriptionAliasEnabled: true
Expand Down Expand Up @@ -170,7 +174,7 @@ targetScope = 'managementGroup'
@description('Specifies the location for resources.')
param location string = 'uksouth'
module sub003 'br/public:lz/sub-vending:1.3.1' = {
module sub003 'br/public:lz/sub-vending:1.4.1' = {
name: 'sub004'
params: {
subscriptionAliasEnabled: true
Expand Down
38 changes: 36 additions & 2 deletions modules/lz/sub-vending/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ targetScope = 'managementGroup'

// METADATA - Used by PSDocs

metadata name = '`main.bicep` Parameters'
metadata name = 'Bicep Landing Zone (Subscription) Vending Module'

metadata description = '''These are the input parameters for the Bicep module: [`main.bicep`](./main.bicep)
metadata description = 'This module is designed to accelerate deployment of landing zones (aka Subscriptions) within an Azure AD Tenant.'

metadata details = '''These are the input parameters for the Bicep module: [`main.bicep`](./main.bicep)
This is the orchestration module that is used and called by a consumer of the module to deploy a Landing Zone Subscription and its associated resources, based on the parameter input values that are provided to it at deployment time.
Expand Down Expand Up @@ -82,6 +84,30 @@ param subscriptionBillingScope string = ''
''')
param subscriptionWorkload string = 'Production'

@metadata({
example: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
})
@maxLength(36)
@sys.description('''The Azure Active Directory Tenant ID (GUID) to which the Subscription should be attached to.
> **Leave blank unless following this scenario only [Programmatically create MCA subscriptions across Azure Active Directory tenants](https://learn.microsoft.com/azure/cost-management-billing/manage/programmatically-create-subscription-microsoft-customer-agreement-across-tenants).**
- Default value: `''` *(empty string)*
''')
param subscriptionTenantId string = ''

@metadata({
example: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
})
@maxLength(36)
@sys.description('''The Azure Active Directory principals object ID (GUID) to whom should be the Subscription Owner.
> **Leave blank unless following this scenario only [Programmatically create MCA subscriptions across Azure Active Directory tenants](https://learn.microsoft.com/azure/cost-management-billing/manage/programmatically-create-subscription-microsoft-customer-agreement-across-tenants).**
- Default value: `''` *(empty string)*
''')
param subscriptionOwnerId string = ''

@metadata({
example: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
})
Expand Down Expand Up @@ -429,6 +455,8 @@ module createSubscription 'src/self/Microsoft.Subscription/aliases/deploy.bicep'
subscriptionAliasName: subscriptionAliasName
subscriptionDisplayName: subscriptionDisplayName
subscriptionWorkload: subscriptionWorkload
subscriptionTenantId: subscriptionTenantId
subscriptionOwnerId: subscriptionOwnerId
}
}

Expand Down Expand Up @@ -469,3 +497,9 @@ output subscriptionId string = (subscriptionAliasEnabled && empty(existingSubscr

@sys.description('The Subscription Resource ID that has been created or provided.')
output subscriptionResourceId string = (subscriptionAliasEnabled && empty(existingSubscriptionId)) ? createSubscription.outputs.subscriptionResourceId : contains(existingSubscriptionIDEmptyCheck, 'No Subscription ID Provided') ? existingSubscriptionIDEmptyCheck : '/subscriptions/${existingSubscriptionId}'

@sys.description('The Subscription Owner State. Only used when creating MCA Subscriptions across tenants')
output subscriptionAcceptOwnershipState string = (subscriptionAliasEnabled && empty(existingSubscriptionId) && !empty(subscriptionTenantId) && !empty(subscriptionOwnerId)) ? createSubscription.outputs.subscriptionAcceptOwnershipState : 'N/A'

@sys.description('The Subscription Ownership URL. Only used when creating MCA Subscriptions across tenants')
output subscriptionAcceptOwnershipUrl string = (subscriptionAliasEnabled && empty(existingSubscriptionId) && !empty(subscriptionTenantId) && !empty(subscriptionOwnerId)) ? createSubscription.outputs.subscriptionAcceptOwnershipUrl : 'N/A'
Loading

0 comments on commit ef4b606

Please sign in to comment.