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

feat: Added KeyVault key & secret outputs #3603

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 29 additions & 40 deletions avm/res/key-vault/vault/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1294,10 +1294,6 @@ module vault 'br/public:avm/res/key-vault/vault:<version>' = {
}
]
location: '<location>'
lock: {
kind: 'CanNotDelete'
name: 'myCustomLockName'
}
networkAcls: {
bypass: 'AzureServices'
defaultAction: 'Deny'
Expand Down Expand Up @@ -1407,12 +1403,6 @@ module vault 'br/public:avm/res/key-vault/vault:<version>' = {
"location": {
"value": "<location>"
},
"lock": {
"value": {
"kind": "CanNotDelete",
"name": "myCustomLockName"
}
},
"networkAcls": {
"value": {
"bypass": "AzureServices",
Expand Down Expand Up @@ -1520,10 +1510,6 @@ param keys = [
}
]
param location = '<location>'
param lock = {
kind: 'CanNotDelete'
name: 'myCustomLockName'
}
param networkAcls = {
bypass: 'AzureServices'
defaultAction: 'Deny'
Expand Down Expand Up @@ -1798,7 +1784,7 @@ The diagnostic settings of the service.
| [`logCategoriesAndGroups`](#parameter-diagnosticsettingslogcategoriesandgroups) | array | The name of logs that will be streamed. "allLogs" includes all possible logs for the resource. Set to `[]` to disable log collection. |
| [`marketplacePartnerResourceId`](#parameter-diagnosticsettingsmarketplacepartnerresourceid) | string | The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs. |
| [`metricCategories`](#parameter-diagnosticsettingsmetriccategories) | array | The name of metrics that will be streamed. "allMetrics" includes all possible metrics for the resource. Set to `[]` to disable metric collection. |
| [`name`](#parameter-diagnosticsettingsname) | string | The name of diagnostic setting. |
| [`name`](#parameter-diagnosticsettingsname) | string | The name of the diagnostic setting. |
| [`storageAccountResourceId`](#parameter-diagnosticsettingsstorageaccountresourceid) | string | Resource ID of the diagnostic storage account. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub. |
| [`workspaceResourceId`](#parameter-diagnosticsettingsworkspaceresourceid) | string | Resource ID of the diagnostic log analytics workspace. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub. |

Expand Down Expand Up @@ -1908,7 +1894,7 @@ Enable or disable the category explicitly. Default is `true`.

### Parameter: `diagnosticSettings.name`

The name of diagnostic setting.
The name of the diagnostic setting.

- Required: No
- Type: string
Expand Down Expand Up @@ -2435,22 +2421,22 @@ Configuration details for private endpoints. For security reasons, it is recomme

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`applicationSecurityGroupResourceIds`](#parameter-privateendpointsapplicationsecuritygroupresourceids) | array | Application security groups in which the private endpoint IP configuration is included. |
| [`applicationSecurityGroupResourceIds`](#parameter-privateendpointsapplicationsecuritygroupresourceids) | array | Application security groups in which the Private Endpoint IP configuration is included. |
| [`customDnsConfigs`](#parameter-privateendpointscustomdnsconfigs) | array | Custom DNS configurations. |
| [`customNetworkInterfaceName`](#parameter-privateendpointscustomnetworkinterfacename) | string | The custom name of the network interface attached to the private endpoint. |
| [`customNetworkInterfaceName`](#parameter-privateendpointscustomnetworkinterfacename) | string | The custom name of the network interface attached to the Private Endpoint. |
| [`enableTelemetry`](#parameter-privateendpointsenabletelemetry) | bool | Enable/Disable usage telemetry for module. |
| [`ipConfigurations`](#parameter-privateendpointsipconfigurations) | array | A list of IP configurations of the private endpoint. This will be used to map to the First Party Service endpoints. |
| [`ipConfigurations`](#parameter-privateendpointsipconfigurations) | array | A list of IP configurations of the Private Endpoint. This will be used to map to the first-party Service endpoints. |
| [`isManualConnection`](#parameter-privateendpointsismanualconnection) | bool | If Manual Private Link Connection is required. |
| [`location`](#parameter-privateendpointslocation) | string | The location to deploy the private endpoint to. |
| [`location`](#parameter-privateendpointslocation) | string | The location to deploy the Private Endpoint to. |
| [`lock`](#parameter-privateendpointslock) | object | Specify the type of lock. |
| [`manualConnectionRequestMessage`](#parameter-privateendpointsmanualconnectionrequestmessage) | string | A message passed to the owner of the remote resource with the manual connection request. |
| [`name`](#parameter-privateendpointsname) | string | The name of the private endpoint. |
| [`privateDnsZoneGroup`](#parameter-privateendpointsprivatednszonegroup) | object | The private DNS zone group to configure for the private endpoint. |
| [`name`](#parameter-privateendpointsname) | string | The name of the Private Endpoint. |
| [`privateDnsZoneGroup`](#parameter-privateendpointsprivatednszonegroup) | object | The private DNS Zone Group to configure for the Private Endpoint. |
| [`privateLinkServiceConnectionName`](#parameter-privateendpointsprivatelinkserviceconnectionname) | string | The name of the private link connection to create. |
| [`resourceGroupName`](#parameter-privateendpointsresourcegroupname) | string | Specify if you want to deploy the Private Endpoint into a different resource group than the main resource. |
| [`resourceGroupName`](#parameter-privateendpointsresourcegroupname) | string | Specify if you want to deploy the Private Endpoint into a different Resource Group than the main resource. |
| [`roleAssignments`](#parameter-privateendpointsroleassignments) | array | Array of role assignments to create. |
| [`service`](#parameter-privateendpointsservice) | string | The subresource to deploy the private endpoint for. For example "vault", "mysqlServer" or "dataFactory". |
| [`tags`](#parameter-privateendpointstags) | object | Tags to be applied on all resources/resource groups in this deployment. |
| [`service`](#parameter-privateendpointsservice) | string | The subresource to deploy the Private Endpoint for. For example "vault" for a Key Vault Private Endpoint. |
| [`tags`](#parameter-privateendpointstags) | object | Tags to be applied on all resources/Resource Groups in this deployment. |

### Parameter: `privateEndpoints.subnetResourceId`

Expand All @@ -2461,7 +2447,7 @@ Resource ID of the subnet where the endpoint needs to be created.

### Parameter: `privateEndpoints.applicationSecurityGroupResourceIds`

Application security groups in which the private endpoint IP configuration is included.
Application security groups in which the Private Endpoint IP configuration is included.

- Required: No
- Type: array
Expand Down Expand Up @@ -2501,7 +2487,7 @@ FQDN that resolves to private endpoint IP address.

### Parameter: `privateEndpoints.customNetworkInterfaceName`

The custom name of the network interface attached to the private endpoint.
The custom name of the network interface attached to the Private Endpoint.

- Required: No
- Type: string
Expand All @@ -2515,7 +2501,7 @@ Enable/Disable usage telemetry for module.

### Parameter: `privateEndpoints.ipConfigurations`

A list of IP configurations of the private endpoint. This will be used to map to the First Party Service endpoints.
A list of IP configurations of the Private Endpoint. This will be used to map to the first-party Service endpoints.

- Required: No
- Type: array
Expand Down Expand Up @@ -2579,7 +2565,7 @@ If Manual Private Link Connection is required.

### Parameter: `privateEndpoints.location`

The location to deploy the private endpoint to.
The location to deploy the Private Endpoint to.

- Required: No
- Type: string
Expand Down Expand Up @@ -2629,14 +2615,14 @@ A message passed to the owner of the remote resource with the manual connection

### Parameter: `privateEndpoints.name`

The name of the private endpoint.
The name of the Private Endpoint.

- Required: No
- Type: string

### Parameter: `privateEndpoints.privateDnsZoneGroup`

The private DNS zone group to configure for the private endpoint.
The private DNS Zone Group to configure for the Private Endpoint.

- Required: No
- Type: object
Expand All @@ -2645,7 +2631,7 @@ The private DNS zone group to configure for the private endpoint.

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`privateDnsZoneGroupConfigs`](#parameter-privateendpointsprivatednszonegroupprivatednszonegroupconfigs) | array | The private DNS zone groups to associate the private endpoint. A DNS zone group can support up to 5 DNS zones. |
| [`privateDnsZoneGroupConfigs`](#parameter-privateendpointsprivatednszonegroupprivatednszonegroupconfigs) | array | The private DNS Zone Groups to associate the Private Endpoint. A DNS Zone Group can support up to 5 DNS zones. |

**Optional parameters**

Expand All @@ -2655,7 +2641,7 @@ The private DNS zone group to configure for the private endpoint.

### Parameter: `privateEndpoints.privateDnsZoneGroup.privateDnsZoneGroupConfigs`

The private DNS zone groups to associate the private endpoint. A DNS zone group can support up to 5 DNS zones.
The private DNS Zone Groups to associate the Private Endpoint. A DNS Zone Group can support up to 5 DNS zones.

- Required: Yes
- Type: array
Expand All @@ -2670,7 +2656,7 @@ The private DNS zone groups to associate the private endpoint. A DNS zone group

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`name`](#parameter-privateendpointsprivatednszonegroupprivatednszonegroupconfigsname) | string | The name of the private DNS zone group config. |
| [`name`](#parameter-privateendpointsprivatednszonegroupprivatednszonegroupconfigsname) | string | The name of the private DNS Zone Group config. |

### Parameter: `privateEndpoints.privateDnsZoneGroup.privateDnsZoneGroupConfigs.privateDnsZoneResourceId`

Expand All @@ -2681,7 +2667,7 @@ The resource id of the private DNS zone.

### Parameter: `privateEndpoints.privateDnsZoneGroup.privateDnsZoneGroupConfigs.name`

The name of the private DNS zone group config.
The name of the private DNS Zone Group config.

- Required: No
- Type: string
Expand All @@ -2702,7 +2688,7 @@ The name of the private link connection to create.

### Parameter: `privateEndpoints.resourceGroupName`

Specify if you want to deploy the Private Endpoint into a different resource group than the main resource.
Specify if you want to deploy the Private Endpoint into a different Resource Group than the main resource.

- Required: No
- Type: string
Expand All @@ -2723,7 +2709,7 @@ Array of role assignments to create.
- `'Owner'`
- `'Private DNS Zone Contributor'`
- `'Reader'`
- `'Role Based Access Control Administrator (Preview)'`
- `'Role Based Access Control Administrator'`

**Required parameters**

Expand Down Expand Up @@ -2817,14 +2803,14 @@ The principal type of the assigned principal ID.

### Parameter: `privateEndpoints.service`

The subresource to deploy the private endpoint for. For example "vault", "mysqlServer" or "dataFactory".
The subresource to deploy the Private Endpoint for. For example "vault" for a Key Vault Private Endpoint.

- Required: No
- Type: string

### Parameter: `privateEndpoints.tags`

Tags to be applied on all resources/resource groups in this deployment.
Tags to be applied on all resources/Resource Groups in this deployment.

- Required: No
- Type: object
Expand Down Expand Up @@ -3187,11 +3173,13 @@ Resource tags.

| Output | Type | Description |
| :-- | :-- | :-- |
| `keys` | array | The properties of the created keys. |
| `location` | string | The location the resource was deployed into. |
| `name` | string | The name of the key vault. |
| `privateEndpoints` | array | The private endpoints of the key vault. |
| `resourceGroupName` | string | The name of the resource group the key vault was created in. |
| `resourceId` | string | The resource ID of the key vault. |
| `secrets` | array | The properties of the created secrets. |
| `uri` | string | The URI of the key vault. |

## Cross-referenced modules
Expand All @@ -3200,7 +3188,8 @@ This section gives you an overview of all local-referenced module files (i.e., o

| Reference | Type |
| :-- | :-- |
| `br/public:avm/res/network/private-endpoint:0.7.1` | Remote reference |
| `br/public:avm/res/network/private-endpoint:0.9.0` | Remote reference |
| `br/public:avm/utl/types/avm-common-types:0.2.1` | Remote reference |

## Data Collection

Expand Down
4 changes: 2 additions & 2 deletions avm/res/key-vault/vault/access-policy/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.30.23.60470",
"templateHash": "15469258025112973480"
"version": "0.31.92.45157",
"templateHash": "2943121976508120416"
},
"name": "Key Vault Access Policies",
"description": "This module deploys a Key Vault Access Policy.",
Expand Down
11 changes: 11 additions & 0 deletions avm/res/key-vault/vault/key/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This module deploys a Key Vault Key.
- [Resource Types](#Resource-Types)
- [Parameters](#Parameters)
- [Outputs](#Outputs)
- [Cross-referenced modules](#Cross-referenced-modules)

## Resource Types

Expand Down Expand Up @@ -275,6 +276,16 @@ Resource tags.

| Output | Type | Description |
| :-- | :-- | :-- |
| `keyUri` | string | The uri of the key. |
| `keyUriWithVersion` | string | The uri with version of the key. |
| `name` | string | The name of the key. |
| `resourceGroupName` | string | The name of the resource group the key was created in. |
| `resourceId` | string | The resource ID of the key. |

## Cross-referenced modules

This section gives you an overview of all local-referenced module files (i.e., other modules that are referenced in this module) and all remote-referenced files (i.e., Bicep modules that are referenced from a Bicep Registry or Template Specs).

| Reference | Type |
| :-- | :-- |
| `br/public:avm/utl/types/avm-common-types:0.2.1` | Remote reference |
47 changes: 13 additions & 34 deletions avm/res/key-vault/vault/key/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ param kty string = 'EC'
@description('Optional. Key release policy.')
param releasePolicy object?

import { roleAssignmentType } from 'br/public:avm/utl/types/avm-common-types:0.2.1'
@description('Optional. Array of role assignments to create.')
param roleAssignments roleAssignmentType
param roleAssignments roleAssignmentType[]?

@description('Optional. Key rotation policy properties object.')
param rotationPolicy object?
Expand Down Expand Up @@ -130,9 +131,11 @@ resource key 'Microsoft.KeyVault/vaults/keys@2022-07-01' = {
keySize: keySize
kty: kty
release_policy: releasePolicy ?? {}
...(empty(rotationPolicy) ? {} : {
rotationPolicy: rotationPolicy
})
...(!empty(rotationPolicy)
? {
rotationPolicy: rotationPolicy
}
: {})
}
}

Expand All @@ -152,6 +155,12 @@ resource key_roleAssignments 'Microsoft.Authorization/roleAssignments@2022-04-01
}
]

@description('The uri of the key.')
output keyUri string = key.properties.keyUri

@description('The uri with version of the key.')
output keyUriWithVersion string = key.properties.keyUriWithVersion

@description('The name of the key.')
output name string = key.name

Expand All @@ -160,33 +169,3 @@ output resourceId string = key.id

@description('The name of the resource group the key was created in.')
output resourceGroupName string = resourceGroup().name

// ================ //
// Definitions //
// ================ //

type roleAssignmentType = {
@description('Optional. The name (as GUID) of the role assignment. If not provided, a GUID will be generated.')
name: string?

@description('Required. The role to assign. You can provide either the display name of the role definition, the role definition GUID, or its fully qualified ID in the following format: \'/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11\'.')
roleDefinitionIdOrName: string

@description('Required. The principal ID of the principal (user/group/identity) to assign the role to.')
principalId: string

@description('Optional. The principal type of the assigned principal ID.')
principalType: ('ServicePrincipal' | 'Group' | 'User' | 'ForeignGroup' | 'Device')?

@description('Optional. The description of the role assignment.')
description: string?

@description('Optional. The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase "foo_storage_container".')
condition: string?

@description('Optional. Version of the condition.')
conditionVersion: '2.0'?

@description('Optional. The Resource Id of the delegated managed identity resource.')
delegatedManagedIdentityResourceId: string?
}[]?
Loading