Skip to content

Commit

Permalink
feat: Updated App-Configuration-Store CMK Implementation (#3729)
Browse files Browse the repository at this point in the history
## Description

- Updated App-Configuration-Store CMK Implementation
- Implemented AVM-Common-Types

Linked to 
- Update CMK implementations as per
#2842 (comment)
- Docs Update: Azure/Azure-Verified-Modules#1683
- UDT update: #3724

## Pipeline Reference

<!-- Insert your Pipeline Status Badge below -->

| Pipeline |
| -------- |
|
[![avm.res.app-configuration.configuration-store](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.app-configuration.configuration-store.yml/badge.svg?branch=users%2Falsehr%2FcmkUpdateAppConfig)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.app-configuration.configuration-store.yml)
|

## Type of Change

<!-- Use the checkboxes [x] on the options that are relevant. -->

- [ ] Update to CI Environment or utilities (Non-module affecting
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`:
- [ ] 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

---------

Co-authored-by: JFolberth <[email protected]>
  • Loading branch information
AlexanderSehr and JFolberth authored Dec 12, 2024
1 parent fb77b43 commit 7312694
Show file tree
Hide file tree
Showing 10 changed files with 708 additions and 668 deletions.
156 changes: 117 additions & 39 deletions avm/res/app-configuration/configuration-store/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This module deploys an App Configuration Store Key Value.

| Resource Type | API Version |
| :-- | :-- |
| `Microsoft.AppConfiguration/configurationStores/keyValues` | [2023-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.AppConfiguration/2023-03-01/configurationStores/keyValues) |
| `Microsoft.AppConfiguration/configurationStores/keyValues` | [2024-05-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.AppConfiguration/2024-05-01/configurationStores/keyValues) |

## Parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ param contentType string?
@description('Optional. Tags of the resource.')
param tags object?

resource appConfiguration 'Microsoft.AppConfiguration/configurationStores@2023-03-01' existing = {
resource appConfiguration 'Microsoft.AppConfiguration/configurationStores@2024-05-01' existing = {
name: appConfigurationName
}

resource keyValues 'Microsoft.AppConfiguration/configurationStores/keyValues@2023-03-01' = {
resource keyValues 'Microsoft.AppConfiguration/configurationStores/keyValues@2024-05-01' = {
name: name
parent: appConfiguration
properties: {
Expand Down
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": "7176115037834080970"
"version": "0.32.4.45862",
"templateHash": "1257304987024829675"
},
"name": "App Configuration Stores Key Values",
"description": "This module deploys an App Configuration Store Key Value.",
Expand Down Expand Up @@ -50,21 +50,18 @@
"appConfiguration": {
"existing": true,
"type": "Microsoft.AppConfiguration/configurationStores",
"apiVersion": "2023-03-01",
"apiVersion": "2024-05-01",
"name": "[parameters('appConfigurationName')]"
},
"keyValues": {
"type": "Microsoft.AppConfiguration/configurationStores/keyValues",
"apiVersion": "2023-03-01",
"apiVersion": "2024-05-01",
"name": "[format('{0}/{1}', parameters('appConfigurationName'), parameters('name'))]",
"properties": {
"contentType": "[parameters('contentType')]",
"tags": "[parameters('tags')]",
"value": "[parameters('value')]"
},
"dependsOn": [
"appConfiguration"
]
}
}
},
"outputs": {
Expand Down
226 changes: 36 additions & 190 deletions avm/res/app-configuration/configuration-store/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ param name string
@description('Optional. Location for all Resources.')
param location string = resourceGroup().location

import { managedIdentityAllType } from 'br/public:avm/utl/types/avm-common-types:0.4.0'
@description('Optional. The managed identity definition for this resource.')
param managedIdentities managedIdentitiesType
param managedIdentities managedIdentityAllType?

@allowed([
'Free'
Expand Down Expand Up @@ -43,32 +44,40 @@ param publicNetworkAccess string?
@maxValue(7)
param softDeleteRetentionInDays int = 1

import { customerManagedKeyWithAutoRotateType } from 'br/public:avm/utl/types/avm-common-types:0.4.0'
@description('Optional. The customer managed key definition.')
param customerManagedKey customerManagedKeyType
param customerManagedKey customerManagedKeyWithAutoRotateType?

@description('Optional. All Key / Values to create. Requires local authentication to be enabled.')
param keyValues array?

@description('Optional. All Replicas to create.')
param replicaLocations array?

import { diagnosticSettingFullType } from 'br/public:avm/utl/types/avm-common-types:0.4.0'
@description('Optional. The diagnostic settings of the service.')
param diagnosticSettings diagnosticSettingType
param diagnosticSettings diagnosticSettingFullType[]?

import { lockType } from 'br/public:avm/utl/types/avm-common-types:0.4.0'
@description('Optional. The lock settings of the service.')
param lock lockType
param lock lockType?

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

@description('Optional. Tags of the resource.')
param tags object?

@description('Optional. Property specifying the configuration of data plane proxy for Azure Resource Manager (ARM).')
param dataPlaneProxy dataPlaneProxyType?

@description('Optional. Enable/Disable usage telemetry for module.')
param enableTelemetry bool = true

import { privateEndpointSingleServiceType } from 'br/public:avm/utl/types/avm-common-types:0.4.0'
@description('Optional. Configuration details for private endpoints. For security reasons, it is recommended to use private endpoints whenever possible.')
param privateEndpoints privateEndpointType
param privateEndpoints privateEndpointSingleServiceType[]?

var formattedUserAssignedIdentities = reduce(
map((managedIdentities.?userAssignedResourceIds ?? []), (id) => { '${id}': {} }),
Expand Down Expand Up @@ -165,7 +174,7 @@ resource cMKUserAssignedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentiti
)
}

resource configurationStore 'Microsoft.AppConfiguration/configurationStores@2023-03-01' = {
resource configurationStore 'Microsoft.AppConfiguration/configurationStores@2024-05-01' = {
name: name
location: location
tags: tags
Expand All @@ -180,10 +189,12 @@ resource configurationStore 'Microsoft.AppConfiguration/configurationStores@2023
encryption: !empty(customerManagedKey)
? {
keyVaultProperties: {
keyIdentifier: !empty(customerManagedKey.?keyVersion ?? '')
keyIdentifier: !empty(customerManagedKey.?keyVersion)
? '${cMKKeyVault::cMKKey.properties.keyUri}/${customerManagedKey!.keyVersion}'
: cMKKeyVault::cMKKey.properties.keyUriWithVersion
identityClientId: !empty(customerManagedKey.?userAssignedIdentityResourceId ?? '')
: (customerManagedKey.?autoRotationEnabled ?? true)
? cMKKeyVault::cMKKey.properties.keyUri
: cMKKeyVault::cMKKey.properties.keyUriWithVersion
identityClientId: !empty(customerManagedKey.?userAssignedIdentityResourceId)
? cMKUserAssignedIdentity.properties.clientId
: null
}
Expand All @@ -193,6 +204,12 @@ resource configurationStore 'Microsoft.AppConfiguration/configurationStores@2023
? any(publicNetworkAccess)
: (!empty(privateEndpoints) ? 'Disabled' : 'Enabled')
softDeleteRetentionInDays: sku == 'Free' ? 0 : softDeleteRetentionInDays
dataPlaneProxy: !empty(dataPlaneProxy)
? {
authenticationMode: dataPlaneProxy.?authenticationMode ?? 'Pass-through'
privateLinkDelegation: dataPlaneProxy!.privateLinkDelegation
}
: null
}
}

Expand Down Expand Up @@ -342,7 +359,7 @@ output resourceId string = configurationStore.id
output resourceGroupName string = resourceGroup().name

@description('The principal ID of the system assigned identity.')
output systemAssignedMIPrincipalId string = configurationStore.?identity.?principalId ?? ''
output systemAssignedMIPrincipalId string? = configurationStore.?identity.?principalId

@description('The location the resource was deployed into.')
output location string = configurationStore.location
Expand All @@ -365,183 +382,12 @@ output privateEndpoints array = [
// Definitions //
// =============== //

type managedIdentitiesType = {
@description('Optional. Enables system assigned managed identity on the resource.')
systemAssigned: bool?

@description('Optional. The resource ID(s) to assign to the resource.')
userAssignedResourceIds: string[]?
}?

type lockType = {
@description('Optional. Specify the name of lock.')
name: string?

@description('Optional. Specify the type of lock.')
kind: ('CanNotDelete' | 'ReadOnly' | 'None')?
}?

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?
}[]?

type privateEndpointType = {
@description('Optional. The name of the private endpoint.')
name: string?

@description('Optional. The location to deploy the private endpoint to.')
location: string?

@description('Optional. The name of the private link connection to create.')
privateLinkServiceConnectionName: string?

@description('Optional. The subresource to deploy the private endpoint for. For example "vault", "mysqlServer" or "dataFactory".')
service: string?

@description('Required. Resource ID of the subnet where the endpoint needs to be created.')
subnetResourceId: string

@description('Optional. The private DNS zone group to configure for the private endpoint.')
privateDnsZoneGroup: {
@description('Optional. The name of the Private DNS Zone Group.')
name: string?

@description('Required. The private DNS zone groups to associate the private endpoint. A DNS zone group can support up to 5 DNS zones.')
privateDnsZoneGroupConfigs: {
@description('Optional. The name of the private DNS zone group config.')
name: string?

@description('Required. The resource id of the private DNS zone.')
privateDnsZoneResourceId: string
}[]
}?

@description('Optional. If Manual Private Link Connection is required.')
isManualConnection: bool?

@description('Optional. A message passed to the owner of the remote resource with the manual connection request.')
@maxLength(140)
manualConnectionRequestMessage: string?

@description('Optional. Custom DNS configurations.')
customDnsConfigs: {
@description('Optional. FQDN that resolves to private endpoint IP address.')
fqdn: string?

@description('Required. A list of private IP addresses of the private endpoint.')
ipAddresses: string[]
}[]?
@export()
@description('The type for the data plane proxy.')
type dataPlaneProxyType = {
@description('Optional. The data plane proxy authentication mode. This property manages the authentication mode of request to the data plane resources. \'Pass-through\' is recommended.')
authenticationMode: ('Local' | 'Pass-through')?

@description('Optional. A list of IP configurations of the private endpoint. This will be used to map to the First Party Service endpoints.')
ipConfigurations: {
@description('Required. The name of the resource that is unique within a resource group.')
name: string

@description('Required. Properties of private endpoint IP configurations.')
properties: {
@description('Required. The ID of a group obtained from the remote resource that this private endpoint should connect to.')
groupId: string

@description('Required. The member name of a group obtained from the remote resource that this private endpoint should connect to.')
memberName: string

@description('Required. A private IP address obtained from the private endpoint\'s subnet.')
privateIPAddress: string
}
}[]?

@description('Optional. Application security groups in which the private endpoint IP configuration is included.')
applicationSecurityGroupResourceIds: string[]?

@description('Optional. The custom name of the network interface attached to the private endpoint.')
customNetworkInterfaceName: string?

@description('Optional. Specify the type of lock.')
lock: lockType

@description('Optional. Array of role assignments to create.')
roleAssignments: roleAssignmentType

@description('Optional. Tags to be applied on all resources/resource groups in this deployment.')
tags: object?

@description('Optional. Enable/Disable usage telemetry for module.')
enableTelemetry: bool?

@description('Optional. Specify if you want to deploy the Private Endpoint into a different resource group than the main resource.')
resourceGroupName: string?
}[]?

type diagnosticSettingType = {
@description('Optional. The name of diagnostic setting.')
name: string?

@description('Optional. The name of logs that will be streamed. "allLogs" includes all possible logs for the resource. Set to \'\' to disable log collection.')
logCategoriesAndGroups: {
@description('Optional. Name of a Diagnostic Log category for a resource type this setting is applied to. Set the specific logs to collect here.')
category: string?

@description('Optional. Name of a Diagnostic Log category group for a resource type this setting is applied to. Set to \'AllLogs\' to collect all logs.')
categoryGroup: string?
}[]?

@description('Optional. The name of logs that will be streamed. "allLogs" includes all possible logs for the resource. Set to \'\' to disable log collection.')
metricCategories: {
@description('Required. Name of a Diagnostic Metric category for a resource type this setting is applied to. Set to \'AllMetrics\' to collect all metrics.')
category: string
}[]?

@description('Optional. A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type.')
logAnalyticsDestinationType: ('Dedicated' | 'AzureDiagnostics')?

@description('Optional. 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.')
workspaceResourceId: string?

@description('Optional. 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.')
storageAccountResourceId: string?

@description('Optional. Resource ID of the diagnostic event hub authorization rule for the Event Hubs namespace in which the event hub should be created or streamed to.')
eventHubAuthorizationRuleResourceId: string?

@description('Optional. Name of the diagnostic event hub within the namespace to which logs are streamed. Without this, an event hub is created for each log category. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub.')
eventHubName: string?

@description('Optional. The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs.')
marketplacePartnerResourceId: string?
}[]?

type customerManagedKeyType = {
@description('Required. The resource ID of a key vault to reference a customer managed key for encryption from.')
keyVaultResourceId: string

@description('Required. The name of the customer managed key to use for encryption.')
keyName: string

@description('Optional. The version of the customer managed key to reference for encryption. If not provided, using \'latest\'.')
keyVersion: string?

@description('Optional. User assigned identity to use when fetching the customer managed key. Required if no system assigned identity is available for use.')
userAssignedIdentityResourceId: string?
}?
@description('Required. The data plane proxy private link delegation. This property manages if a request from delegated Azure Resource Manager (ARM) private link is allowed when the data plane resource requires private link.')
privateLinkDelegation: 'Disabled' | 'Enabled'
}
Loading

0 comments on commit 7312694

Please sign in to comment.