Skip to content

Commit 3741da7

Browse files
authored
[RecoveryServices.Backup] Added fix for enable protection and updated help for register container cmdlets (#19741)
* updated help text fixed policy parameter in the Enable-AzRecoveryServicesBackupProtection cmdlet added example for container re-registration updated change log * resolved static analysis issues updated breakingChangeIssues.csv
1 parent d745beb commit 3741da7

File tree

6 files changed

+33
-36
lines changed

6 files changed

+33
-36
lines changed

src/RecoveryServices/RecoveryServices.Backup/Cmdlets/Item/EnableAzureRmRecoveryServicesBackupProtection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class EnableAzureRmRecoveryServicesBackupProtection : RSBackupVaultCmdlet
4343
/// <summary>
4444
/// Policy to be associated with this item as part of the protection operation.
4545
/// </summary>
46-
[Parameter(Position = 1, Mandatory = false, HelpMessage = ParamHelpMsgs.Policy.EnableProtectionPolicy)]
46+
[Parameter(Position = 1, Mandatory = true, HelpMessage = ParamHelpMsgs.Policy.EnableProtectionPolicy)]
4747
[ValidateNotNullOrEmpty]
4848
public PolicyBase Policy { get; set; }
4949

src/RecoveryServices/RecoveryServices/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* [Breaking Change] Added fix for Enable-AzRecoveryServicesBackupProtection cmdlet. Resolved the null refrence issue by making policy a mandatory parameter.
2122
* [Breaking Change] Removed status filter from Get-AzRecoveryServicesBackupContainer command
2223
* Added SubTasks Duration for IaasVM job
2324

src/RecoveryServices/RecoveryServices/help/Enable-AzRecoveryServicesBackupProtection.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,34 @@ Enables or resumes backup for an item with a specified Backup protection policy.
1515

1616
### AzureVMComputeEnableProtection (Default)
1717
```
18-
Enable-AzRecoveryServicesBackupProtection [[-Policy] <PolicyBase>] [-Name] <String>
19-
[-ResourceGroupName] <String> [-InclusionDisksList <String[]>] [-ExclusionDisksList <String[]>]
20-
[-ExcludeAllDataDisks] [-VaultId <String>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
21-
[<CommonParameters>]
18+
Enable-AzRecoveryServicesBackupProtection [-Policy] <PolicyBase> [-Name] <String> [-ResourceGroupName] <String>
19+
[-InclusionDisksList <String[]>] [-ExclusionDisksList <String[]>] [-ExcludeAllDataDisks] [-VaultId <String>]
20+
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
2221
```
2322

2423
### AzureVMClassicComputeEnableProtection
2524
```
26-
Enable-AzRecoveryServicesBackupProtection [[-Policy] <PolicyBase>] [-Name] <String> [-ServiceName] <String>
25+
Enable-AzRecoveryServicesBackupProtection [-Policy] <PolicyBase> [-Name] <String> [-ServiceName] <String>
2726
[-InclusionDisksList <String[]>] [-ExclusionDisksList <String[]>] [-ExcludeAllDataDisks] [-VaultId <String>]
2827
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
2928
```
3029

3130
### AzureFileShareEnableProtection
3231
```
33-
Enable-AzRecoveryServicesBackupProtection [[-Policy] <PolicyBase>] [-Name] <String>
32+
Enable-AzRecoveryServicesBackupProtection [-Policy] <PolicyBase> [-Name] <String>
3433
[-StorageAccountName] <String> [-VaultId <String>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
3534
[-Confirm] [<CommonParameters>]
3635
```
3736

3837
### AzureWorkloadEnableProtection
3938
```
40-
Enable-AzRecoveryServicesBackupProtection [[-Policy] <PolicyBase>] [-ProtectableItem] <ProtectableItemBase>
39+
Enable-AzRecoveryServicesBackupProtection [-Policy] <PolicyBase> [-ProtectableItem] <ProtectableItemBase>
4140
[-VaultId <String>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
4241
```
4342

4443
### ModifyProtection
4544
```
46-
Enable-AzRecoveryServicesBackupProtection [[-Policy] <PolicyBase>] [-Item] <ItemBase>
45+
Enable-AzRecoveryServicesBackupProtection [-Policy] <PolicyBase> [-Item] <ItemBase>
4746
[-InclusionDisksList <String[]>] [-ExclusionDisksList <String[]>] [-ResetExclusionSettings]
4847
[-ExcludeAllDataDisks] [-VaultId <String>] [-DefaultProfile <IAzureContextContainer>] [-Token <String>]
4948
[-WhatIf] [-Confirm] [<CommonParameters>]
@@ -75,6 +74,8 @@ The third cmdlet sets the Backup protection policy for the ARM virtual machine n
7574
Enables backup for an item with a specified Backup protection policy or resumes backup for an item that has data retained when backup was stopped.
7675

7776
<!-- Aladdin Generated Example -->
77+
78+
7879
```powershell
7980
Enable-AzRecoveryServicesBackupProtection -Item $Item -Policy $Pol -VaultId $vault
8081
```
@@ -181,7 +182,7 @@ Type: Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.PolicyBase
181182
Parameter Sets: (All)
182183
Aliases:
183184

184-
Required: False
185+
Required: True
185186
Position: 1
186187
Default value: None
187188
Accept pipeline input: False

src/RecoveryServices/RecoveryServices/help/Get-AzRecoveryServicesBackupContainer.md

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Gets Backup containers.
1616

1717
```
1818
Get-AzRecoveryServicesBackupContainer [-ContainerType] <ContainerType> [[-BackupManagementType] <String>]
19-
[[-FriendlyName] <String>] [[-ResourceGroupName] <String>] [[-Status] <ContainerRegistrationStatus>]
20-
[-VaultId <String>] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
19+
[[-FriendlyName] <String>] [[-ResourceGroupName] <String>] [-VaultId <String>]
20+
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
2121
```
2222

2323
## DESCRIPTION
@@ -33,7 +33,7 @@ Set the vault context by using the -VaultId parameter.
3333

3434
```powershell
3535
$vault = Get-AzRecoveryServicesVault -ResourceGroupName "resourceGroup" -Name "vaultName"
36-
Get-AzRecoveryServicesBackupContainer -ContainerType "AzureVM" -Status "Registered" -FriendlyName "V2VM" -VaultId $vault.ID
36+
Get-AzRecoveryServicesBackupContainer -ContainerType "AzureVM" -FriendlyName "V2VM" -VaultId $vault.ID
3737
```
3838

3939
This command gets the container named V2VM of type AzureVM.
@@ -65,7 +65,7 @@ This parameter is used to differentiate Windows machines that are backed up usin
6565
Type: System.String
6666
Parameter Sets: (All)
6767
Aliases:
68-
Accepted values: AzureVM, MAB, AzureWorkload, AzureStorage
68+
Accepted values: AzureVM, AzureStorage, AzureWorkload, MAB
6969

7070
Required: False
7171
Position: 2
@@ -146,26 +146,6 @@ Accept pipeline input: False
146146
Accept wildcard characters: False
147147
```
148148
149-
### -Status
150-
151-
Specifies the container registration status.
152-
The acceptable values for this parameter are:
153-
154-
- Registered
155-
156-
```yaml
157-
Type: Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.ContainerRegistrationStatus
158-
Parameter Sets: (All)
159-
Aliases:
160-
Accepted values: Registered
161-
162-
Required: False
163-
Position: 5
164-
Default value: None
165-
Accept pipeline input: False
166-
Accept wildcard characters: False
167-
```
168-
169149
### -VaultId
170150
171151
ARM ID of the Recovery Services Vault.

src/RecoveryServices/RecoveryServices/help/Register-AzRecoveryServicesBackupContainer.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,22 @@ This command allows Azure Backup to convert the Resource to a Backup Container w
3131

3232
## EXAMPLES
3333

34-
### Example 1
34+
### Example 1 Register a backup container
3535
```powershell
3636
Register-AzRecoveryServicesBackupContainer -ResourceId <AzureVMID> -VaultId <vaultID> -WorkloadType MSSQL -BackupManagementType AzureWorkload
3737
```
3838

3939
The cmdlet registers an azure VM as a container for the workload MSSQL.
4040

41+
### Example 2 Re-register a backup container
42+
```powershell
43+
$vault = Get-AzRecoveryServicesVault -ResourceGroupName "rgName" -Name "vaultName"
44+
$container = Get-AzRecoveryServicesBackupContainer -ContainerType AzureVMAppContainer -VaultId $vault.ID
45+
Register-AzRecoveryServicesBackupContainer -Container $container[-1] -BackupManagementType AzureWorkload -WorkloadType MSSQL -VaultId $vault.ID
46+
```
47+
48+
The first command fetches the recovery services vault. The second command fetches all the backup containers registered with the recovery services vault. The third command triggers a re-register operation for the container $container[-1], to re-register an already registered container we pass -Container parameter.
49+
4150
## PARAMETERS
4251

4352
### -BackupManagementType
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
"AssemblyFileName","ClassName","Target","Severity","ProblemId","Description","Remediation"
22
"Az.RecoveryServices","Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.UpdateAzureRmRecoveryServicesVault","Update-AzRecoveryServicesVault","0","1060","The parameter set 'AzureRSVaultAddMSIdentity' for cmdlet 'Update-AzRecoveryServicesVault' is no longer the default parameter set.","Change the default parameter for cmdlet 'Update-AzRecoveryServicesVault' back to 'AzureRSVaultAddMSIdentity'."
33
"Az.RecoveryServices","Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.GetAzureRmRecoveryServicesBackupContainer","Get-AzRecoveryServicesBackupContainer","0","2000","The cmdlet 'Get-AzRecoveryServicesBackupContainer' no longer supports the parameter 'Status' and no alias was found for the original parameter name.","Add the parameter 'Status' back to the cmdlet 'Get-AzRecoveryServicesBackupContainer', or add an alias to the original parameter name."
4-
"Az.RecoveryServices","Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.GetAzureRmRecoveryServicesBackupContainer","Get-AzRecoveryServicesBackupContainer","0","1050","The parameter set '__AllParameterSets' for cmdlet 'Get-AzRecoveryServicesBackupContainer' has been removed.","Add parameter set '__AllParameterSets' back to cmdlet 'Get-AzRecoveryServicesBackupContainer'."
4+
"Az.RecoveryServices","Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.GetAzureRmRecoveryServicesBackupContainer","Get-AzRecoveryServicesBackupContainer","0","1050","The parameter set '__AllParameterSets' for cmdlet 'Get-AzRecoveryServicesBackupContainer' has been removed.","Add parameter set '__AllParameterSets' back to cmdlet 'Get-AzRecoveryServicesBackupContainer'."
5+
"Az.RecoveryServices","Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.EnableAzureRmRecoveryServicesBackupProtection","Enable-AzRecoveryServicesBackupProtection","0","1050","The parameter set '__AllParameterSets' for cmdlet 'Enable-AzRecoveryServicesBackupProtection' has been removed.","Add parameter set '__AllParameterSets' back to cmdlet 'Enable-AzRecoveryServicesBackupProtection'."
6+
"Az.RecoveryServices","Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.EnableAzureRmRecoveryServicesBackupProtection","Enable-AzRecoveryServicesBackupProtection","0","1050","The parameter set 'AzureVMClassicComputeEnableProtection' for cmdlet 'Enable-AzRecoveryServicesBackupProtection' has been removed.","Add parameter set 'AzureVMClassicComputeEnableProtection' back to cmdlet 'Enable-AzRecoveryServicesBackupProtection'."
7+
"Az.RecoveryServices","Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.EnableAzureRmRecoveryServicesBackupProtection","Enable-AzRecoveryServicesBackupProtection","0","1050","The parameter set 'AzureVMComputeEnableProtection' for cmdlet 'Enable-AzRecoveryServicesBackupProtection' has been removed.","Add parameter set 'AzureVMComputeEnableProtection' back to cmdlet 'Enable-AzRecoveryServicesBackupProtection'."
8+
"Az.RecoveryServices","Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.EnableAzureRmRecoveryServicesBackupProtection","Enable-AzRecoveryServicesBackupProtection","0","1050","The parameter set 'AzureFileShareEnableProtection' for cmdlet 'Enable-AzRecoveryServicesBackupProtection' has been removed.","Add parameter set 'AzureFileShareEnableProtection' back to cmdlet 'Enable-AzRecoveryServicesBackupProtection'."
9+
"Az.RecoveryServices","Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.EnableAzureRmRecoveryServicesBackupProtection","Enable-AzRecoveryServicesBackupProtection","0","1050","The parameter set 'AzureWorkloadEnableProtection' for cmdlet 'Enable-AzRecoveryServicesBackupProtection' has been removed.","Add parameter set 'AzureWorkloadEnableProtection' back to cmdlet 'Enable-AzRecoveryServicesBackupProtection'."
10+
"Az.RecoveryServices","Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.EnableAzureRmRecoveryServicesBackupProtection","Enable-AzRecoveryServicesBackupProtection","0","1050","The parameter set 'ModifyProtection' for cmdlet 'Enable-AzRecoveryServicesBackupProtection' has been removed.","Add parameter set 'ModifyProtection' back to cmdlet 'Enable-AzRecoveryServicesBackupProtection'."

0 commit comments

Comments
 (0)