Skip to content

Commit

Permalink
Update Backup API version to set additional Vault properties (#121)
Browse files Browse the repository at this point in the history
* Newer APIs with errors in deployment
* Fix redundancy settings with latest API versions
  • Loading branch information
SvenAelterman authored Sep 6, 2024
1 parent 8402d8e commit db711da
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions shared-modules/recovery/recoveryServicesVault.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ resource keyVaultResourceGroup 'Microsoft.Resources/resourceGroups@2024-03-01' e
scope: subscription()
}

resource recoveryServicesVault 'Microsoft.RecoveryServices/vaults@2023-06-01' = {
resource recoveryServicesVault 'Microsoft.RecoveryServices/vaults@2024-04-01' = {
name: vaultName
location: location
tags: tags
Expand All @@ -41,14 +41,14 @@ resource recoveryServicesVault 'Microsoft.RecoveryServices/vaults@2023-06-01' =
monitoringSettings: {
azureMonitorAlertSettings: {
alertsForAllJobFailures: 'Enabled'
// Only supported in later API versions
// alertsForAllFailoverIssues: 'Enabled'
// alertsForAllReplicationIssues: 'Enabled'
// Only supported (and required) in later API versions
alertsForAllFailoverIssues: 'Enabled'
alertsForAllReplicationIssues: 'Enabled'
}
classicAlertSettings: {
alertsForCriticalOperations: 'Disabled'
// Only supported in later API versions
// emailNotificationsForSiteRecovery: 'Disabled'
emailNotificationsForSiteRecovery: 'Disabled'
}
}

Expand Down Expand Up @@ -80,6 +80,11 @@ resource recoveryServicesVault 'Microsoft.RecoveryServices/vaults@2023-06-01' =
infrastructureEncryption: 'Enabled'
}
: null

redundancySettings: {
standardTierStorageRedundancy: storageType
crossRegionRestore: 'Enabled'
}
}
}

Expand All @@ -95,28 +100,15 @@ module keyVaultRoleAssignment '../../module-library/roleAssignments/roleAssignme
}
}

// Enable cross-region restores, which requires geo-redundant storage
resource backupStorageConfig 'Microsoft.RecoveryServices/vaults/backupstorageconfig@2023-06-01' = {
name: 'vaultstorageconfig'
parent: recoveryServicesVault
properties: {
storageModelType: storageType
storageType: storageType
crossRegionRestoreFlag: true
}
}

// Enable soft delete settings
resource backupConfig 'Microsoft.RecoveryServices/vaults/backupconfig@2023-06-01' = {
resource backupConfig 'Microsoft.RecoveryServices/vaults/backupconfig@2024-04-01' = {
name: 'vaultconfig'
location: location
parent: recoveryServicesVault
properties: {
enhancedSecurityState: debugMode ? 'Disabled' : 'Enabled'
isSoftDeleteFeatureStateEditable: true
softDeleteFeatureState: debugMode ? 'Disabled' : 'Enabled'
storageModelType: backupStorageConfig.properties.storageModelType
storageType: backupStorageConfig.properties.storageType
}
}

Expand All @@ -142,7 +134,7 @@ var azureBackupRGNamePrefix = '${splitNamingConvention[0]}${sequenceFormatted}-'
var azureBackupRGNameSuffix = length(splitNamingConvention) > 1 ? splitNamingConvention[1] : ''

// LATER: Parameterize backup policy values
resource enhancedBackupPolicy 'Microsoft.RecoveryServices/vaults/backupPolicies@2023-06-01' = {
resource enhancedBackupPolicy 'Microsoft.RecoveryServices/vaults/backupPolicies@2024-04-01' = {
name: 'EnhancedPolicy-${workloadName}-${sequenceFormatted}'
parent: recoveryServicesVault
properties: {
Expand Down

0 comments on commit db711da

Please sign in to comment.