Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upped aliases API version to non-preview #198

Merged
merged 13 commits into from
Apr 2, 2022
4 changes: 4 additions & 0 deletions infra-as-code/bicep/CRML/subscriptionAlias/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ The module requires the following inputs:
| ----------- | ---- | ----------- | ------------ | ------- | -------- |
parSubscriptionName | string | Name of the subscription to be created. Will also be used as the alias name. Whilst you can use any name you like we recommend it to be: all lowercase, no spaces, alphanumeric and hyphens only. | Yes | `sub-example-001` | None, must be provided. |
parSubscriptionBillingScope | string | The full resource ID of billing scope associated to the EA, MCA or MPA account you wish to create the subscription in. | Yes | EA - `/providers/Microsoft.Billing/BillingAccounts/1234567/enrollmentAccounts/7654321` <br> MCA - `/providers/Microsoft.Billing/billingAccounts/5e98e158-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/billingProfiles/AW4F-xxxx-xxx-xxx/invoiceSections/SH3V-xxxx-xxx-xxx` <br> MPA - `/providers/Microsoft.Billing/billingAccounts/99a13315-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx/customers/2281f543-xxxx-xxxx-xxxx-xxxxxxxxxxxx` | None, must be provided. |
parTags | object | Tags you would like to be applied. | Yes | `{"key": "value"}` | Empty object `{}` |
johnlokerse marked this conversation as resolved.
Show resolved Hide resolved
parManagementGroupId | string | The ID of the management group where the subscription will be placed. Also known as the parent management group.| Yes | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx` | |
johnlokerse marked this conversation as resolved.
Show resolved Hide resolved
parSubscriptionOwnerId | string | The object ID of a responsible user, AAD group or service principal. | Yes | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx` | |
johnlokerse marked this conversation as resolved.
Show resolved Hide resolved
parSubscriptionOfferType | string | The offer type of the EA, MCA or MPA subscription to be created. | No | `DevTest` | `Production` |
parTenantId | string | The ID of the tenant. | No | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx` | `tenant().tenantId` |

## Outputs

Expand Down
26 changes: 23 additions & 3 deletions infra-as-code/bicep/CRML/subscriptionAlias/subscriptionAlias.bicep
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/*
SUMMARY: The Subscription Alias module deploys an EA, MCA or MPA Subscription into the tenants default Management Group
DESCRIPTION: The Subscription Alias module deploys an EA, MCA or MPA Subscription into the tenants default Management Group as per the docs here: https://docs.microsoft.com/azure/cost-management-billing/manage/programmatically-create-subscription
AUTHOR/S: jtracey93
VERSION: 1.0.0
AUTHOR/S: jtracey93, johnlokerse
VERSION: 1.1.0
- Updated version of the API
- Added additional properties: parTags, parManagementGroupId, parSubscriptionOwnerId and subscriptionTenantId
*/

targetScope = 'tenant'
Expand All @@ -13,16 +15,34 @@ param parSubscriptionName string
@description('The full resource ID of billing scope associated to the EA, MCA or MPA account you wish to create the subscription in.')
param parSubscriptionBillingScope string

@description('Tags you would like to be applied.')
param parTags object = {}

@description('The ID of the management group where the subscription will be placed. Also known as the parent management group.')
param parManagementGroupId string
johnlokerse marked this conversation as resolved.
Show resolved Hide resolved

@description('The object ID of a responsible user, AAD group or service principal.')
param parSubscriptionOwnerId string
johnlokerse marked this conversation as resolved.
Show resolved Hide resolved

@allowed([
'DevTest'
'Production'
])
@description('The offer type of the EA, MCA or MPA subscription to be created. Defaults to = Production')
param parSubscriptionOfferType string = 'Production'

resource resSubscription 'Microsoft.Subscription/aliases@2019-10-01-preview' = {
@description('The ID of the tenant. Defaults to = tenant().tenantId')
param parTenantId string = tenant().tenantId

resource resSubscription 'Microsoft.Subscription/aliases@2021-10-01' = {
name: parSubscriptionName
properties: {
additionalProperties: {
tags: parTags
managementGroupId: parManagementGroupId
subscriptionOwnerId: parSubscriptionOwnerId
subscriptionTenantId: parTenantId
}
displayName: parSubscriptionName
billingScope: parSubscriptionBillingScope
workload: parSubscriptionOfferType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,22 @@
"parSubscriptionBillingScope": {
"value": "/providers/Microsoft.Billing/billingAccounts/XXXXXXX/enrollmentAccounts/XXXXXX"
},
"parTags": {
"value": {
"Environment": "POC"
}
},
"parManagementGroupId": {
"value": "mg-example-001"
},
"parSubscriptionOwnerId": {
"value": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx"
},
"parSubscriptionOfferType": {
"value": "Production"
},
"parTenantId": {
"value": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx"
}
}
}