Skip to content

Commit

Permalink
26740 - Feature - Generated Parameter Markdowns for Orchestration (#466)
Browse files Browse the repository at this point in the history
Co-authored-by: Jack Tracey <41163455+jtracey93@users.noreply.github.com>
  • Loading branch information
4pplied and jtracey93 authored Mar 22, 2023
1 parent 7de2697 commit 34c2013
Show file tree
Hide file tree
Showing 16 changed files with 779 additions and 82 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/psdocs-mdtogit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Bicep Build
shell: pwsh
run: |
Get-ChildItem -Recurse -Path infra-as-code/bicep/modules/ -Filter '*.bicep' -Exclude 'callModuleFromACR.example.bicep','orchHubSpoke.bicep' | ForEach-Object {
Get-ChildItem -Recurse -Path infra-as-code/bicep/ -Filter '*.bicep' -Exclude 'callModuleFromACR.example.bicep','orchHubSpoke.bicep' | ForEach-Object {
Write-Information "==> Attempting Bicep Build For File: $_" -InformationAction Continue
$output = bicep build $_.FullName 2>&1
if ($LastExitCode -ne 0)
Expand All @@ -64,8 +64,8 @@ jobs:
- name: Generate ARM markdowns
run: |
Install-Module -Name 'PSDocs.Azure' -Repository PSGallery -force;
# Scan for Azure template file recursively in the infra-as-code/bicep/modules/ directory
Get-AzDocTemplateFile -Path infra-as-code/bicep/modules/ | ForEach-Object {
# Scan for Azure template file recursively in the infra-as-code/bicep/ directory
Get-AzDocTemplateFile -Path infra-as-code/bicep/ | ForEach-Object {
# Generate a standard name of the markdown file. i.e. <name>_<version>.md
$template = Get-Item -Path $_.TemplateFile;
$templateraw = Get-Content -Raw -Path $_.Templatefile;
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
- name: Remove Generated JSONs
shell: pwsh
run: |
Get-ChildItem -Recurse -Path infra-as-code/bicep/modules/ -Filter '*.json' -Exclude 'bicepconfig.json','*.parameters.json','*.parameters.*.json','policy_*' | ForEach-Object {
Get-ChildItem -Recurse -Path infra-as-code/bicep/ -Filter '*.json' -Exclude 'bicepconfig.json','*.parameters.json','*.parameters.*.json','policy_*' | ForEach-Object {
Write-Information "==> Removing generated JSON file $_ from Bicep Build" -InformationAction Continue
Remove-Item -Path $_.FullName
}
Expand Down
9 changes: 1 addition & 8 deletions infra-as-code/bicep/CRML/containerRegistry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@ Module deploys the following resources:

## Parameters

The module requires the following inputs:

| Parameter | Type | Default | Description | Requirement | Example |
| ----------- | ------ | -------------------------------------- | --------------------------------------------------------------- | ---------------------------- | ------------------------------- |
| parAcrName | string | acr${uniqueString(resourceGroup().id)} | Name of Azure Container Registry to deploy | 5-50 char | acr5cix6w3rcizn |
| parACRSku | string | Basic | SKU of Azure Container Registry to deploy to Azure | Basic or Standard or Premium | Basic |
| parLocation | string | resourceGroup().location | Location where Public Azure Container Registry will be deployed | Valid Azure Region | eastus2 |
| parTags | object | none | Tags to be appended to resource | none | {"Environment" : "Development"} |
- [Parameters for Azure Commercial Cloud](generateddocs/containerRegistry.bicep.md)

## Outputs

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# ALZ Bicep CRML - Container Registry Module

Module to create an Azure Container Registry to store private Bicep Modules

## Parameters

Parameter name | Required | Description
-------------- | -------- | -----------
parAcrName | No | Provide a globally unique name of your Azure Container Registry
parLocation | No | Provide a location for the registry.
parAcrSku | No | Provide a tier of your Azure Container Registry.
parTags | No | Tags to be applied to resource when deployed. Default: None

### parAcrName

![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)

Provide a globally unique name of your Azure Container Registry

- Default value: `[format('acr{0}', uniqueString(resourceGroup().id))]`

### parLocation

![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)

Provide a location for the registry.

- Default value: `[resourceGroup().location]`

### parAcrSku

![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)

Provide a tier of your Azure Container Registry.

- Default value: `Basic`

### parTags

![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)

Tags to be applied to resource when deployed. Default: None

## Outputs

Name | Type | Description
---- | ---- | -----------
outLoginServer | string | Output the login server property for later use

## Snippets

### Parameter file

```json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"template": "infra-as-code/bicep/CRML/containerRegistry/containerRegistry.json"
},
"parameters": {
"parAcrName": {
"value": "[format('acr{0}', uniqueString(resourceGroup().id))]"
},
"parLocation": {
"value": "[resourceGroup().location]"
},
"parAcrSku": {
"value": "Basic"
},
"parTags": {
"value": {}
}
}
}
```
4 changes: 0 additions & 4 deletions infra-as-code/bicep/CRML/customerUsageAttribution/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ This module does not deploy any resources

This module does not require any inputs

| Parameter | Type | Default | Description | Requirement | Example |
| --------- | ---- | ------- | ----------- | ----------- | ------- |


## Outputs

The module does not generate any outputs
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Azure template

## Snippets

### Parameter file

```json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"template": "infra-as-code/bicep/CRML/customerUsageAttribution/cuaIdManagementGroup.json"
},
"parameters": {}
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Azure template

## Snippets

### Parameter file

```json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"template": "infra-as-code/bicep/CRML/customerUsageAttribution/cuaIdResourceGroup.json"
},
"parameters": {}
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Azure template

## Snippets

### Parameter file

```json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"template": "infra-as-code/bicep/CRML/customerUsageAttribution/cuaIdSubscription.json"
},
"parameters": {}
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Azure template

## Snippets

### Parameter file

```json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"template": "infra-as-code/bicep/CRML/customerUsageAttribution/cuaIdTenant.json"
},
"parameters": {}
}
```
12 changes: 1 addition & 11 deletions infra-as-code/bicep/CRML/subscriptionAlias/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,7 @@ The Subscription will be created and placed under the Tenant Root Group, unless

## Parameters

The module requires the following inputs:

| Parameter | Type | Description | Required | Example | Default |
| ----------- | ---- | ----------- | ------------ | ------- | -------- |
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. | No | `{"key": "value"}` | Empty object `{}` |
parManagementGroupId | string | The ID of the existing management group where the subscription will be placed. Also known as it's parent management group. | No | `mg-root` | Empty string |
parSubscriptionOwnerId | string | The object ID of a responsible user, AAD group or service principal. | No | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx` | Empty string |
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` |
- [Parameters for Azure Commercial Cloud](generateddocs/subscriptionAlias.bicep.md)

## Outputs

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# ALZ Bicep CRML - Subscription Alias Module

Module to deploy an Azure Subscription into an existing billing scope that can be from an EA, MCA or MPA

## Parameters

Parameter name | Required | Description
-------------- | -------- | -----------
parSubscriptionName | Yes | 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.
parSubscriptionBillingScope | Yes | The full resource ID of billing scope associated to the EA, MCA or MPA account you wish to create the subscription in.
parTags | No | Tags you would like to be applied.
parManagementGroupId | No | The ID of the existing management group where the subscription will be placed. Also known as its parent management group. (Optional)
parSubscriptionOwnerId | No | The object ID of a responsible user, AAD group or service principal. (Optional)
parSubscriptionOfferType | No | The offer type of the EA, MCA or MPA subscription to be created. Defaults to = Production
parTenantId | No | The ID of the tenant. Defaults to = tenant().tenantId

### parSubscriptionName

![Parameter Setting](https://img.shields.io/badge/parameter-required-orange?style=flat-square)

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.

### parSubscriptionBillingScope

![Parameter Setting](https://img.shields.io/badge/parameter-required-orange?style=flat-square)

The full resource ID of billing scope associated to the EA, MCA or MPA account you wish to create the subscription in.

### parTags

![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)

Tags you would like to be applied.

### parManagementGroupId

![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)

The ID of the existing management group where the subscription will be placed. Also known as its parent management group. (Optional)

### parSubscriptionOwnerId

![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)

The object ID of a responsible user, AAD group or service principal. (Optional)

### parSubscriptionOfferType

![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)

The offer type of the EA, MCA or MPA subscription to be created. Defaults to = Production

- Default value: `Production`

- Allowed values: `DevTest`, `Production`

### parTenantId

![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)

The ID of the tenant. Defaults to = tenant().tenantId

- Default value: `[tenant().tenantId]`

## Outputs

Name | Type | Description
---- | ---- | -----------
outSubscriptionName | string |
outSubscriptionId | string |

## Snippets

### Parameter file

```json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"template": "infra-as-code/bicep/CRML/subscriptionAlias/subscriptionAlias.json"
},
"parameters": {
"parSubscriptionName": {
"value": ""
},
"parSubscriptionBillingScope": {
"value": ""
},
"parTags": {
"value": {}
},
"parManagementGroupId": {
"value": ""
},
"parSubscriptionOwnerId": {
"value": ""
},
"parSubscriptionOfferType": {
"value": "Production"
},
"parTenantId": {
"value": "[tenant().tenantId]"
}
}
}
```
Loading

0 comments on commit 34c2013

Please sign in to comment.