Issue In Azure Restore – Restore-AzRecoveryServicesBackupItem : Set vault context first using cmdlet Set-AzRecoveryServicesVaultContext
Hope you all are doing good !!! 🙂 .
In our previous articles we have discussed How To Address One Issue We Faced During Enabling The BackUp . Today in this article we will talk about another issue we come across during restore file share from backup and how we fixed that issue.
Tool Installation Articles :
- Configure Azure Command Line Interface ( Azure CLI) On Windows
- Configure PowerShell For Microsoft Azure Az Module On Windows
Previous Azure series :
- Learn Basics Of Azure Networking In 60 Hours
- Learn Basic Of Azure Active Directory And Azure Identity And Access Management
- Azure DevOps – Learn at one place
If you have missed our previous articles on Azure Storage and Database Series, please check it in following links.
Issue Details :
In one of my previous article, I am working on an exercise, where I had to restore my file share from the backup using powershell. I have gather all recovery point and then tried to restore the backup using following PowerShell command.
Restore-AzRecoveryServicesBackupItem -RecoveryPoint $ManasRecoveryPoint -ResolveConflict Overwrite
but it ends with the and error. Below is the error details.
Restore-AzRecoveryServicesBackupItem : Set vault context first using cmdlet Set-AzRecoveryServicesVaultContext
At line:1 char:1Restore-AzRecoveryServicesBackupItem -RecoveryPoint $ManasRecoveryPoi …
~~~~~~~~~~~~~~~~~CategoryInfo : InvalidArgument: (:) [Restore-AzRecoveryServicesBackupItem], ArgumentException
FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.RestoreAzureRmRecoveryServicesBackupItem
As it suggested, we have to set the context of our vault, when we get it as showing in the following example.
$ManasVault = Get-AzRecoveryServicesVault -ResourceGroupName "StorageAndDatabase" -Name "Manas-Storage-RSV-PS"
Set-AzRecoveryServicesVaultContext -Vault $ManasVault
I just skipped it because some where in one Microsoft document, it mentioned that, the
Set-AzRecoveryServicesVaultContext command is going to be deprecated soon. I re-executed the command after set the context of the vault and this time it ends with restoring my file share as showing in the following figure.
This is a very small post but I hope this is informative to you. Please let me know if I missed anything important or if my understanding is not up to the mark. Keep reading, share your thoughts, experiences. Feel free to contact us to discuss more.
If you have any suggestion / feedback / doubt, you are most welcome. Stay tuned on Knowledge-Junction, will come up with more such articles.
Thanks for reading 🙂 .