Skip to content

Commit ce3476c

Browse files
authored
Added support for AlwaysOn soft delete state (#22817)
* Added support for AlwaysOn soft delete state * suppressed false positive example issues
1 parent 05fa715 commit ce3476c

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

src/RecoveryServices/RecoveryServices.Backup/Cmdlets/Vault/SetAzureRmRecoveryServicesVaultProperty.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class SetAzureRmRecoveryServicesVaultProperty : RSBackupVaultCmdletBase
3333

3434
[Parameter(Mandatory = false, ValueFromPipeline = false, ParameterSetName = AzureRSVaultSoftDelteParameterSet)]
3535
[ValidateNotNullOrEmpty]
36-
[ValidateSet("Enable", "Disable")]
36+
[ValidateSet("Enable", "Disable", "AlwaysON")]
3737
public string SoftDeleteFeatureState { get; set; }
3838

3939
[Parameter(Mandatory = false, ValueFromPipeline = false, ParameterSetName = AzureRSVaultSoftDelteParameterSet, HelpMessage = ParamHelpMsgs.ResourceGuard.AuxiliaryAccessToken)]
@@ -80,9 +80,10 @@ public override void ExecuteCmdlet()
8080
{
8181
BackupResourceVaultConfigResource currentConfig = ServiceClientAdapter.GetVaultProperty(vaultName, resourceGroupName);
8282
BackupResourceVaultConfigResource param = new BackupResourceVaultConfigResource();
83-
param.Properties = new BackupResourceVaultConfig();
83+
param.Properties = new BackupResourceVaultConfig();
84+
85+
param.Properties.SoftDeleteFeatureState = (SoftDeleteFeatureState.ToLower() == "alwayson") ? "AlwaysON" : ((SoftDeleteFeatureState != null) ? SoftDeleteFeatureState + "d" : currentConfig.Properties.SoftDeleteFeatureState);
8486

85-
param.Properties.SoftDeleteFeatureState = (SoftDeleteFeatureState != null) ? SoftDeleteFeatureState + "d" : currentConfig.Properties.SoftDeleteFeatureState;
8687
param.Properties.EnhancedSecurityState = (DisableHybridBackupSecurityFeature != null) ? (((bool)DisableHybridBackupSecurityFeature) ? "Disabled" : "Enabled") : currentConfig.Properties.EnhancedSecurityState;
8788

8889
bool isMUAProtected = checkMUAForSoftDelete(currentConfig, param);

src/RecoveryServices/RecoveryServices/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
## Upcoming Release
2121
* Added support for custom RG with suffix while creating or modifying policy for workload type AzureVM.
2222
* Added TLaD warning https://aka.ms/TLaD for Azure Site Recovery and Backup.
23+
* Added support for setting AlwaysON soft delete state for recovery services vault.
2324

2425
## Version 6.5.1
2526
* Added StorageAccountName property to AzureFileShare job.

src/RecoveryServices/RecoveryServices/help/Set-AzRecoveryServicesVaultProperty.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Set-AzRecoveryServicesVaultProperty [-VaultId <String>] [-DefaultProfile <IAzure
2929
```
3030

3131
## DESCRIPTION
32-
The **Set-AzRecoveryServicesVaultProperty** cmdlet updates properties of a Recovery services vault. This cmdlet can be used to enable/disable soft delete or set CMK encryption for a vault with two different parameter sets.
32+
The **Set-AzRecoveryServicesVaultProperty** cmdlet updates properties of a Recovery services vault. This cmdlet can be used to Enable/Disable/AlwaysON soft delete or set CMK encryption for a vault with two different parameter sets.
3333
**SoftDeleteFeatureState** property of a vault can be disabled only if there are no registered containers in the vault. InfrastructurEncryption can only be set the first time a user updates the CMK vault.
3434

3535
## EXAMPLES
@@ -41,7 +41,7 @@ $props = Set-AzRecoveryServicesVaultProperty -VaultId $vault.Id -SoftDeleteFeatu
4141
```
4242

4343
The first command gets a Vault object and then stores it in the $vault variable.
44-
The second command Updates the SoftDeleteFeatureState property of the vault to "Enabled" state.
44+
The second command Updates the SoftDeleteFeatureState property of the vault to "Enabled" state. Allowed values for SoftDeleteFeatureState are Disable, Enable, AlwaysON.
4545

4646
### Example 2: Update CMK encryption of a vault to use SystemAssigned MSIdentity
4747

@@ -155,7 +155,7 @@ Accept wildcard characters: False
155155
```
156156
157157
### -SoftDeleteFeatureState
158-
SoftDeleteFeatureState of the Recovery Services Vault.
158+
SoftDeleteFeatureState of the Recovery Services Vault. Allowed values are Disable, Enable, AlwaysON.
159159
160160
```yaml
161161
Type: System.String
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
"Module","Cmdlet","Example","Line","RuleName","ProblemId","Severity","Description","Extent","Remediation"
22
"Az.RecoveryServices","Set-AzRecoveryServicesBackupProtectionPolicy","1","19","Invalid_Parameter_Name","5011","1","Set-AzRecoveryServicesBackupProtectionPolicy -BackupSnapshotResourceGroup is not a valid parameter name.","-BackupSnapshotResourceGroup","Check validity of the parameter -BackupSnapshotResourceGroup."
33
"Az.RecoveryServices","Set-AzRecoveryServicesBackupProtectionPolicy","1","19","Invalid_Parameter_Name","5011","1","Set-AzRecoveryServicesBackupProtectionPolicy -BackupSnapshotResourceGroupSuffix is not a valid parameter name.","-BackupSnapshotResourceGroupSuffix","Check validity of the parameter -BackupSnapshotResourceGroupSuffix."
4+
"Az.RecoveryServices","Set-AzRecoveryServicesVaultProperty","2","2","Invalid_Cmdlet","5000","1","Get-AzKeyVault is not a valid command name.","Get-AzKeyVault -VaultName 'keyVaultName' -ResourceGroupName 'RGName'","Check the spell of Get-AzKeyVault."
5+
"Az.RecoveryServices","Set-AzRecoveryServicesVaultProperty","2","3","Invalid_Cmdlet","5000","1","Get-AzKeyVaultKey is not a valid command name.","Get-AzKeyVaultKey -VaultName 'keyVaultName' -Name 'keyName'","Check the spell of Get-AzKeyVaultKey."
6+
"Az.RecoveryServices","Set-AzRecoveryServicesVaultProperty","3","2","Invalid_Cmdlet","5000","1","Get-AzKeyVault is not a valid command name.","Get-AzKeyVault -VaultName 'keyVaultName' -ResourceGroupName 'RGName'","Check the spell of Get-AzKeyVault."
7+
"Az.RecoveryServices","Set-AzRecoveryServicesVaultProperty","3","3","Invalid_Cmdlet","5000","1","Get-AzKeyVaultKey is not a valid command name.","Get-AzKeyVaultKey -VaultName 'keyVaultName' -Name 'keyName'","Check the spell of Get-AzKeyVaultKey."

0 commit comments

Comments
 (0)