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

Restore-AzureRmRecoveryServicesBackupItem : 'parentResourcePath' cannot be null.

Open miyazawa opened this issue 9 years ago • 8 comments

Cmdlet(s)

Restore-AzureRmRecoveryServicesBackupItem

PowerShell Version

5.1.14409.1012

Module Version

AzureRM.Backup 3.3.1

OS Version

10.0.14409.1012

Description

PS C:\Users\****> $vaultName = "********"
PS C:\Users\****> $contName = "********"
PS C:\Users\****> Get-AzureRmRecoveryServicesVault -Name $vaultName | Set-AzureRmRecoveryServicesVaultContext
PS C:\Users\****>
PS C:\Users\****> $namedContainer = Get-AzureRmRecoveryServicesBackupContainer  -ContainerType "AzureVM" –Status "Registered" -FriendlyName $contName
PS C:\Users\****> $backupitem = Get-AzureRmRecoveryServicesBackupItem –Container $namedContainer  –WorkloadType "AzureVM"
PS C:\Users\****> $startDate = (Get-Date).AddDays(-7)
PS C:\Users\****> $endDate = Get-Date
PS C:\Users\***> $rp = Get-AzureRmRecoveryServicesBackupRecoveryPoint -Item $backupitem -StartDate $startdate.ToUniversalTime() -EndDate $enddate.ToUniversalTime()
PS C:\Users\****> $storageAccountName = "********"
PS C:\Users\****> $storageAccountRG = "********"
PS C:\Users\****> $restorejob = Restore-AzureRmRecoveryServicesBackupItem -RecoveryPoint $rp[0] -StorageAccountName $storageAccountName -StorageAccountResourceGroupName $storageAccountRG
Restore-AzureRmRecoveryServicesBackupItem : 'parentResourcePath' cannot be null.
At line:1 char:15
+ ... estorejob = Restore-AzureRmRecoveryServicesBackupItem -RecoveryPoint  ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Restore-AzureRm...vicesBackupItem], ValidationException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.RestoreAzureRmRecoveryServicesB
   ackupItem

PS C:\Users\****>

Debug Output

PS C:\Users\****> $restorejob = Restore-AzureRmRecoveryServicesBackupItem -RecoveryPoint $rp[0] -StorageAccountName $storageAccountName -StorageAccountResourceGroupName $storageAccountRG -Debug
DEBUG: 15:22:15 - RestoreAzureRmRecoveryServicesBackupItem begin processing with ParameterSet '__AllParameterSets'.

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"): a
DEBUG: 15:22:17 - using account id '********@example.com'...
DEBUG: InsideRestore. going to create ResourceManager Client
DEBUG: [Common.Authentication]: Authenticating using Account: '********@example.com', environment:
'AzureCloud', tenant: 'e709340c-****-****-****-***********'
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/25/2017 06:22:17: 143685c4-****-****-****-************ - AcquireTokenHandlerBase: === Token Acquisition
started:
 Authority: https://login.microsoftonline.com/e709340c-****-****-****-************/
 Resource: https://management.core.windows.net/
 ClientId: 1950a258-****-****-****-************
 CacheType: Microsoft.Azure.Commands.Common.Authentication.ProtectedFileTokenCache (3 items)
 Authentication Target: User

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/25/2017 06:22:17:  - TokenCache: Deserialized 3 items to token cache.
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 08/25/2017 06:22:17: 143685c4-****-****-****-************ - TokenCache: Looking up cache for a token...
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/25/2017 06:22:17: 143685c4-****-****-****-************ - TokenCache: An item matching the requested resource
was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 :
DEBUG: 08/25/2017 06:22:17: 143685c4-****-****-****-************ - TokenCache: 51.154426275 minutes left until token in
 cache expires
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/25/2017 06:22:17: 143685c4-****-****-****-************ - TokenCache: A matching item (access token or refresh
 token or both) was found in the cache
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 :
DEBUG: 08/25/2017 06:22:17: 143685c4-****-****-****-************ - AcquireTokenHandlerBase: === Token Acquisition
finished successfully. An access token was retuned:
 Access Token Hash: 9r30rHUKlNHJLnrpYCnvi2KFGMAktvDcf1zkUF7kLjs=
 Refresh Token Hash: PjIX/qjKArqu8TWmcSRAgxndEhTklKSpaPIzse0SOgw=
 Expiration Time: 08/25/2017 07:13:26 +00:00
 User Hash: k8LSbbbQnajnfR5KxVm8trfhjzp1PrKYgMjnuAUSQWU=

DEBUG: Client Created successfully
DEBUG: Query Microsoft.ClassicStorage with name = ************
DEBUG: Caught exception, type: System.AggregateException
DEBUG: Handling aggregate exception

Confirm
'parentResourcePath' cannot be null.
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"):
Restore-AzureRmRecoveryServicesBackupItem : 'parentResourcePath' cannot be null.
At line:1 char:15
+ ... estorejob = Restore-AzureRmRecoveryServicesBackupItem -RecoveryPoint  ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Restore-AzureRm...vicesBackupItem], ValidationException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.RestoreAzureRmRecoveryServicesB
   ackupItem

DEBUG: 15:22:18 - RestoreAzureRmRecoveryServicesBackupItem end processing.
DEBUG: 15:22:18 - RestoreAzureRmRecoveryServicesBackupItem end processing.
PS C:\Users\****>

But, older version (AzureRM.Backup 3.2.1) is work fine.

miyazawa avatar Aug 25 '17 06:08 miyazawa

@miyazawa can you run resolve-azurermerror to help us debug the issue. @dragonfly91 can you take a look at this issues?

sphibbs avatar Aug 25 '17 18:08 sphibbs

I am getting the same error. Running 'resolve-azurermerror' cmdlet gives me the below trace Message : 'parentResourcePath' cannot be null. StackTrace : at Microsoft.Azure.Management.Internal.Resources.ResourcesOperations.d__10.MoveNext() in D:\workspace\powershell-sign\src\ResourceManager\Common\Commands.ResourceManager.Common\Generated\ResourcesOperations.cs:line 632 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Management.Internal.Resources.ResourcesOperationsExtensions.d__11.MoveNext() in D:\workspace\powershel l-sign\src\ResourceManager\Common\Commands.ResourceManager.Common\Generated\ResourcesOperationsExtensions.cs:line 372 Exception : Microsoft.Rest.ValidationException InvocationInfo : {Restore-AzureRmRecoveryServicesBackupItem} Line : $restorejob = Restore-AzureRmRecoveryServicesBackupItem -RecoveryPoint $recoveryPoint -StorageAccountName "********" -StorageAccountResourceGroupName "*******" Position : At line:1 char:15 + ... estorejob = Restore-AzureRmRecoveryServicesBackupItem -RecoveryPoint ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ HistoryId : 39

ananimesh avatar Aug 26 '17 06:08 ananimesh

Same error here trying to run this within an Azure Automation runbook... 'parentResourcePath' cannot be null.

shland avatar Aug 26 '17 19:08 shland

Same here. Updated Azure SDK and Azure Powershell last Friday. Keep getting this error while calling Restore-AzureRmRecoveryServicesBackupItem from a Powershell script.

$item = Get-AzureRmRecoveryServicesBackupItem -BackupManagementType AzureVM -WorkloadType AzureVM -ErrorAction Stop
$startDate = (Get-Date).AddDays(-1)
$rp = Get-AzureRmRecoveryServicesBackupRecoveryPoint -Item $item -StartDate $startDate.ToUniversalTime() -ErrorAction Stop
$rpt = $rp[0].RecoveryPointTime.ToString()
$now = Get-Date
$RestoreJob = Restore-AzureRmRecoveryServicesBackupItem -RecoveryPoint $rp[0] -StorageAccountName $srcStorageAccountName -StorageAccountResourceGroupName $resourceGroupName -ErrorAction Stop
Wait-AzureRmRecoveryServicesBackupJob -Job $RestoreJob

Stricnis avatar Aug 28 '17 08:08 Stricnis

Got this issue too. Updated Azure Automation modules today and now have this issue. AzureRM.RecoveryServices.Backup v3.3.1

-update- Downgraded both AzureRM.RecoveryServices.Backup and AzureRM.RecoveryServices to 3.2.1 (and then upgrading AzureRM.Profile back to 3.3.1) through the powershell gallery allows to work around this bug.

https://www.powershellgallery.com/packages/AzureRM.RecoveryServices/3.2.1

henrytruongswo avatar Aug 31 '17 11:08 henrytruongswo

Same issue here. Downgrading to 3.2.1 as suggested fixed the issue. Thanks for the info.

RussPitcher avatar Sep 05 '17 11:09 RussPitcher

Hi,

As a workaround, this issue can be resolved by rolling back to the previous version 4.2.1 - https://github.com/Azure/azure-powershell/releases/tag/v4.2.1-July2017

Also, please let us know if you are not able to roll back. We are working on this issue and can help in providing private MSI if roll back is not working.

Thanks

JPallavi-zz avatar Sep 07 '17 09:09 JPallavi-zz

Hi, this was fixed in the previous release. I'm closing this issue. If there are any concerns, please feel free to reopen it.

Thanks

dragonfly91 avatar Oct 31 '17 08:10 dragonfly91