azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Get-AzRecoveryServicesBackupProtectionPolicy

Open PICBrahma opened this issue 2 years ago • 4 comments

Description

Using v5.4 Az.RecoveryServices module

Get-AzRecoveryServicesBackupProtectionPolicy

FullBackupRetentionPolicy.MonthlySchedule.RetentionScheduleType nor FullBackupRetentionPolicy.YearlySchedule.RetentionScheduleType cannot be expressed programmatically with PowerShell even though it has a value.

As in the following;

$VaultPoliciesList.FullBackupRetentionPolicy.MonthlySchedule.RetentionScheduleType

-or

$VaultPoliciesList.FullBackupRetentionPolicy.YearlySchedule.RetentionScheduleType

All other properties seem to return values

Issue script & Debug output

None errors out as null when when called- System.Management.Automation.RuntimeException
Cannot index into a null array.

Environment data

Name                           Value
----                           -----
PSVersion                      7.2.5
PSEdition                      Core
GitCommitId                    7.2.5
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

Using v5.4 Az.RecoveryServices module

Error output

System.Management.Automation.RuntimeException
Cannot index into a null array.

PICBrahma avatar Jun 28 '22 19:06 PICBrahma

$PolicySchedule = Get-AzRecoveryServicesBackupProtectionPolicy -VaultId $Vault.Id | select-object -ExpandProperty FullBackupRetentionPolicy output:

IsDailyScheduleEnabled : True IsWeeklyScheduleEnabled : True IsMonthlyScheduleEnabled : True IsYearlyScheduleEnabled : True DailySchedule : DurationCountInDays: 30, RetentionTimes: {6/28/2022 9:00:00 PM} WeeklySchedule : DurationCountInWeeks: 104, DaysOfTheWeek: {Sunday}, RetentionTimes: {6/28/2022 9:00:00 PM} MonthlySchedule : DurationCountInMonths:60, RetentionScheduleType:Weekly, RetentionTimes: {6/28/2022 9:00:00 PM}, RetentionScheduleDaily:NULL,RetentionScheduleWeekly:DaysOfTheWeek:{Sunday}, WeeksOfTheMonth:{First}, RetentionTimes: {6/28/2022 9:00:00 PM} YearlySchedule : DurationCountInYears:10, RetentionScheduleType:Weekly, RetentionTimes: {6/28/2022 9:00:00 PM}, RetentionScheduleDaily:NULL,RetentionScheduleWeekly:DaysOfTheWeek:{Sunday}, WeeksOfTheMonth:{First}, MonthsOfYear:
{March}, RetentionTimes: {6/28/2022 9:00:00 PM} BackupManagementType :

IsDailyScheduleEnabled : False IsWeeklyScheduleEnabled : True IsMonthlyScheduleEnabled : False IsYearlyScheduleEnabled : False DailySchedule : WeeklySchedule : DurationCountInWeeks: 4, DaysOfTheWeek: {Sunday}, RetentionTimes: {5/6/2019 12:00:00 AM} MonthlySchedule : YearlySchedule : BackupManagementType :

PICBrahma avatar Jun 28 '22 19:06 PICBrahma

Thank you for your feedback. This has been routed to the support team for assistance.

ghost avatar Jun 30 '22 01:06 ghost

Involve CXP team to look into it.

dingmeng-xue avatar Jun 30 '22 01:06 dingmeng-xue

@PICBrahma Are you still experiencing this issue ?

Daya-Patil avatar Jan 29 '24 03:01 Daya-Patil