forked from Azure/bicep-registry-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Automation account credentials - New feature (Azure#2183)
## Description Fixes Azure#1443 ## Pipeline Reference | Pipeline | | -------- | | [![avm.res.automation.automation-account](https://github.com/elanzel/bicep-registry-modules/actions/workflows/avm.res.automation.automation-account.yml/badge.svg?branch=feature%2Faut_credentials)](https://github.com/elanzel/bicep-registry-modules/actions/workflows/avm.res.automation.automation-account.yml) | ## Type of Change - [ ] Update to CI Environment or utlities (Non-module effecting 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`: - [x] 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 ## 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
- Loading branch information
Showing
14 changed files
with
664 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
avm/res/automation/automation-account/credential/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Automation Account Credential `[Microsoft.Automation/automationAccounts/credentials]` | ||
|
||
This module deploys Azure Automation Account Credential. | ||
|
||
## Navigation | ||
|
||
- [Resource Types](#Resource-Types) | ||
- [Parameters](#Parameters) | ||
- [Outputs](#Outputs) | ||
- [Cross-referenced modules](#Cross-referenced-modules) | ||
- [Data Collection](#Data-Collection) | ||
|
||
## Resource Types | ||
|
||
| Resource Type | API Version | | ||
| :-- | :-- | | ||
| `Microsoft.Automation/automationAccounts/credentials` | [2023-11-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Automation/2023-11-01/automationAccounts/credentials) | | ||
|
||
## Parameters | ||
|
||
**Required parameters** | ||
|
||
| Parameter | Type | Description | | ||
| :-- | :-- | :-- | | ||
| [`credentials`](#parameter-credentials) | array | The credential definition. | | ||
|
||
**Conditional parameters** | ||
|
||
| Parameter | Type | Description | | ||
| :-- | :-- | :-- | | ||
| [`automationAccountName`](#parameter-automationaccountname) | string | The name of the parent Automation Account. Required if the template is used in a standalone deployment. | | ||
|
||
### Parameter: `credentials` | ||
|
||
The credential definition. | ||
|
||
- Required: Yes | ||
- Type: array | ||
|
||
**Required parameters** | ||
|
||
| Parameter | Type | Description | | ||
| :-- | :-- | :-- | | ||
| [`name`](#parameter-credentialsname) | string | Name of the Automation Account credential. | | ||
| [`password`](#parameter-credentialspassword) | securestring | Password of the credential. | | ||
| [`userName`](#parameter-credentialsusername) | string | The user name associated to the credential. | | ||
|
||
**Optional parameters** | ||
|
||
| Parameter | Type | Description | | ||
| :-- | :-- | :-- | | ||
| [`description`](#parameter-credentialsdescription) | string | Description of the credential. | | ||
|
||
### Parameter: `credentials.name` | ||
|
||
Name of the Automation Account credential. | ||
|
||
- Required: Yes | ||
- Type: string | ||
|
||
### Parameter: `credentials.password` | ||
|
||
Password of the credential. | ||
|
||
- Required: Yes | ||
- Type: securestring | ||
|
||
### Parameter: `credentials.userName` | ||
|
||
The user name associated to the credential. | ||
|
||
- Required: Yes | ||
- Type: string | ||
|
||
### Parameter: `credentials.description` | ||
|
||
Description of the credential. | ||
|
||
- Required: No | ||
- Type: string | ||
|
||
### Parameter: `automationAccountName` | ||
|
||
The name of the parent Automation Account. Required if the template is used in a standalone deployment. | ||
|
||
- Required: Yes | ||
- Type: string | ||
|
||
|
||
## Outputs | ||
|
||
| Output | Type | Description | | ||
| :-- | :-- | :-- | | ||
| `name` | array | The names of the credentials associated to the automation account. | | ||
| `resourceGroupName` | string | The resource group of the deployed credential. | | ||
| `resourceId` | array | The resource IDs of the credentials associated to the automation account. | | ||
|
||
## Cross-referenced modules | ||
|
||
_None_ | ||
|
||
## 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 <https://go.microsoft.com/fwlink/?LinkID=824704>. 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. |
56 changes: 56 additions & 0 deletions
56
avm/res/automation/automation-account/credential/main.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
metadata name = 'Automation Account Credential' | ||
metadata description = 'This module deploys Azure Automation Account Credential.' | ||
metadata owner = 'Azure/module-maintainers' | ||
|
||
@description('Conditional. The name of the parent Automation Account. Required if the template is used in a standalone deployment.') | ||
param automationAccountName string | ||
|
||
@description('Required. The credential definition.') | ||
param credentials credentialType | ||
|
||
resource automationAccount 'Microsoft.Automation/automationAccounts@2022-08-08' existing = { | ||
name: automationAccountName | ||
} | ||
|
||
resource automationAccount_credential 'Microsoft.Automation/automationAccounts/credentials@2023-11-01' = [ | ||
for credential in credentials: { | ||
name: credential.name | ||
parent: automationAccount | ||
properties: { | ||
password: credential.password | ||
userName: credential.userName | ||
description: credential.?description ?? '' | ||
} | ||
} | ||
] | ||
|
||
@description('The resource IDs of the credentials associated to the automation account.') | ||
#disable-next-line outputs-should-not-contain-secrets // Does not return the secret, but just the ID | ||
output resourceId array = [for index in range(0, length(credentials)): automationAccount_credential[index].id] | ||
|
||
@description('The names of the credentials associated to the automation account.') | ||
#disable-next-line outputs-should-not-contain-secrets // Does not return the secret, but just the name | ||
output name array = [for index in range(0, length(credentials)): automationAccount_credential[index].name] | ||
|
||
@description('The resource group of the deployed credential.') | ||
output resourceGroupName string = resourceGroup().name | ||
|
||
// ================ // | ||
// Definitions // | ||
// ================ // | ||
|
||
@export() | ||
type credentialType = { | ||
@description('Required. Name of the Automation Account credential.') | ||
name: string | ||
|
||
@description('Required. The user name associated to the credential.') | ||
userName: string | ||
|
||
@description('Required. Password of the credential.') | ||
@secure() | ||
password: string | ||
|
||
@description('Optional. Description of the credential.') | ||
description: string? | ||
}[] |
121 changes: 121 additions & 0 deletions
121
avm/res/automation/automation-account/credential/main.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"languageVersion": "2.0", | ||
"contentVersion": "1.0.0.0", | ||
"metadata": { | ||
"_generator": { | ||
"name": "bicep", | ||
"version": "0.28.1.47646", | ||
"templateHash": "17311442241252857733" | ||
}, | ||
"name": "Automation Account Credential", | ||
"description": "This module deploys Azure Automation Account Credential.", | ||
"owner": "Azure/module-maintainers" | ||
}, | ||
"definitions": { | ||
"credentialType": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"metadata": { | ||
"description": "Required. Name of the Automation Account credential." | ||
} | ||
}, | ||
"userName": { | ||
"type": "string", | ||
"metadata": { | ||
"description": "Required. The user name associated to the credential." | ||
} | ||
}, | ||
"password": { | ||
"type": "securestring", | ||
"metadata": { | ||
"description": "Required. Password of the credential." | ||
} | ||
}, | ||
"description": { | ||
"type": "string", | ||
"nullable": true, | ||
"metadata": { | ||
"description": "Optional. Description of the credential." | ||
} | ||
} | ||
} | ||
}, | ||
"metadata": { | ||
"__bicep_export!": true | ||
} | ||
} | ||
}, | ||
"parameters": { | ||
"automationAccountName": { | ||
"type": "string", | ||
"metadata": { | ||
"description": "Conditional. The name of the parent Automation Account. Required if the template is used in a standalone deployment." | ||
} | ||
}, | ||
"credentials": { | ||
"$ref": "#/definitions/credentialType", | ||
"metadata": { | ||
"description": "Required. The credential definition." | ||
} | ||
} | ||
}, | ||
"resources": { | ||
"automationAccount": { | ||
"existing": true, | ||
"type": "Microsoft.Automation/automationAccounts", | ||
"apiVersion": "2022-08-08", | ||
"name": "[parameters('automationAccountName')]" | ||
}, | ||
"automationAccount_credential": { | ||
"copy": { | ||
"name": "automationAccount_credential", | ||
"count": "[length(parameters('credentials'))]" | ||
}, | ||
"type": "Microsoft.Automation/automationAccounts/credentials", | ||
"apiVersion": "2023-11-01", | ||
"name": "[format('{0}/{1}', parameters('automationAccountName'), parameters('credentials')[copyIndex()].name)]", | ||
"properties": { | ||
"password": "[parameters('credentials')[copyIndex()].password]", | ||
"userName": "[parameters('credentials')[copyIndex()].userName]", | ||
"description": "[coalesce(tryGet(parameters('credentials')[copyIndex()], 'description'), '')]" | ||
}, | ||
"dependsOn": [ | ||
"automationAccount" | ||
] | ||
} | ||
}, | ||
"outputs": { | ||
"resourceId": { | ||
"type": "array", | ||
"metadata": { | ||
"description": "The resource IDs of the credentials associated to the automation account." | ||
}, | ||
"copy": { | ||
"count": "[length(range(0, length(parameters('credentials'))))]", | ||
"input": "[resourceId('Microsoft.Automation/automationAccounts/credentials', parameters('automationAccountName'), parameters('credentials')[range(0, length(parameters('credentials')))[copyIndex()]].name)]" | ||
} | ||
}, | ||
"name": { | ||
"type": "array", | ||
"metadata": { | ||
"description": "The names of the credentials associated to the automation account." | ||
}, | ||
"copy": { | ||
"count": "[length(range(0, length(parameters('credentials'))))]", | ||
"input": "[parameters('credentials')[range(0, length(parameters('credentials')))[copyIndex()]].name]" | ||
} | ||
}, | ||
"resourceGroupName": { | ||
"type": "string", | ||
"metadata": { | ||
"description": "The resource group of the deployed credential." | ||
}, | ||
"value": "[resourceGroup().name]" | ||
} | ||
} | ||
} |
Oops, something went wrong.