Restore-AzureRmRecoveryServicesBackupItem command failing for azureVM
Description
Script/Steps for Reproduction
Restore-AzureRmRecoveryServicesBackupItem -RecoveryPoint $rp[0] -StorageAccountName 'sisisa' -StorageAccountResourceGroupName 'sisi-RSV'
Module Version
Get-Module -ListAvailable
6.12
Environment Data
$PSVersionTable
Name Value
PSVersion 5.1.17763.1 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.17763.1 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1
Debug Output
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
POST
Absolute Uri:
https://management.azure.com/Subscriptions/da364f0f-307b-41c9-9d47-b7413ec45535/resourceGroups/sisi-RSV/providers/Microsoft.RecoveryServices/vaults/sisi-RSV-29-6/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;sisi-rsv;sisi-vm/protectedItems/VM;iaasvmcontainerv2;sisi-rsv;sisi-vm/recoveryPoints/359635127204933/restore?api-version=2016
-12-01
Headers:
x-ms-client-request-id : e49b211b-3495-4b82-bc45-ac743a9042ed
accept-language : en-US
Body:
{
"properties": {
"objectType": "IaasVMRestoreRequest",
"recoveryPointId": "359635127204933",
"recoveryType": "RestoreDisks",
"sourceResourceId": "/subscriptions/da364f0f-307b-41c9-9d47-b7413ec45535/resourceGroups/sisi-RSV/providers/Microsoft.Compute/virtualMachines/sisi-vm",
"storageAccountId": "/subscriptions/da364f0f-307b-41c9-9d47-b7413ec45535/resourceGroups/sisi-RSV/providers/Microsoft.Storage/storageAccounts/sisisa",
"createNewCloudService": false,
"originalStorageAccountOption": false
}
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
Accepted
Headers:
Pragma : no-cache
Retry-After : 60
Azure-AsyncOperation :
https://management.azure.com/Subscriptions/da364f0f-307b-41c9-9d47-b7413ec45535/resourceGroups/sisi-RSV/providers/Microsoft.RecoveryServices/vaults/sisi-RSV-29-6/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;sisi-rsv;sisi-vm/protectedItems/VM;iaasvmcontainerv2;sisi-rsv;sisi-vm/operationsStatus/f02d35f2-7088-4d6e-b218-70527022ae81?a
pi-version=2016-12-01
X-Content-Type-Options : nosniff
x-ms-request-id : 42a29504-b354-492d-b8c0-c794c1b2bd45
x-ms-client-request-id : 5f98b932-fdba-4935-abbe-d0dd9fa841c0-PS,5f98b932-fdba-4935-abbe-d0dd9fa841c0-PS
Strict-Transport-Security : max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-writes: 1199
x-ms-correlation-request-id : 42a29504-b354-492d-b8c0-c794c1b2bd45
x-ms-routing-request-id : WESTINDIA:20181114T133935Z:42a29504-b354-492d-b8c0-c794c1b2bd45
Cache-Control : no-cache
Date : Wed, 14 Nov 2018 13:39:35 GMT
Location :
https://management.azure.com/Subscriptions/da364f0f-307b-41c9-9d47-b7413ec45535/resourceGroups/sisi-RSV/providers/Microsoft.RecoveryServices/vaults/sisi-RSV-29-6/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;sisi-rsv;sisi-vm/protectedItems/VM;iaasvmcontainerv2;sisi-rsv;sisi-vm/operationResults/f02d35f2-7088-4d6e-b218-70527022ae81?a
pi-version=2016-12-01
X-Powered-By : ASP.NET
Body:
DEBUG: Restore submitted
DEBUG: Tracking operation status URL for
completion:https://management.azure.com/Subscriptions/da364f0f-307b-41c9-9d47-b7413ec45535/resourceGroups/sisi-RSV/providers/Microsoft.RecoveryServices/vaults/sisi-RSV-29-6/backupFabrics/Azure/protectionContainers/IaasVMContainer;iaasvmcontainerv2;sisi-rsv;sisi-vm/protectedItems/VM;iaasvmcontainerv2;sisi-rsv;sisi-vm/operationsStatus/f02d35f2-7088-4d6e-b218-705
27022ae81?api-version=2016-12-01
Issue
The region parameter in the restore request object is not able to get vault location when using the Set-AzureRmRecoveryServicesVaultContext cmdlet.
Workaround
There’s a workaround to solve this issue using a vault object.
$vault = Get-AzureRmRecoveryServicesVault -ResourceGroupName
Hi, is this fixed? I am still facing this issue.
Hi, this has been fixed. Try using the lastest version https://www.powershellgallery.com/packages/AzureRM.RecoveryServices.Backup/4.5.2
I am still facing the same issue :
$restorejob = Restore-AzureRmRecoveryServicesBackupItem -RecoveryPoint $rp[0] -StorageAccountName $StorageAccountName -StorageAccountResourceGroupName $StorageAccountResourceGroup -Verbose
Restore-AzureRmRecoveryServicesBackupItem : Restore Azure Backup Item Operation failed. Error Code: CloudInvalidInputError. Error Message: The current operation failed due to an internal service error "Invalid input error". Please retry the operation after some time. At line:43 char:23
- ... estorejob = Restore-AzureRmRecoveryServicesBackupItem -RecoveryPoint ...
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- CategoryInfo : NotSpecified: (:) [Restore-AzureRm...vicesBackupItem], Exception
- FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.RestoreAzureRmRecoveryServicesBackupItem
Get-AzureRmRecoveryServicesBackupJob : Cannot validate argument on parameter 'Job'. The argument is null. Provide a valid value for the argument, and then try running the command again. At line:46 char:57
- ... JOBID = (Get-AzureRmRecoveryServicesBackupJob -Job $restorejob).JobId
-
~~~~~~~~~~~- CategoryInfo : InvalidData: (:) [Get-AzureRmRecoveryServicesBackupJob], ParameterBindingValidationException
- FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.GetAzureRmRecoveryServicesBackupJob
PS C:\WINDOWS\system32> Get-Module AzureRM.RecoveryServices.Backup
ModuleType Version Name ExportedCommands
Script 4.5.2 AzureRM.RecoveryServices.Backup {Backup-AzureRmRecoveryServicesBackupItem, Disable-AzureRmRecoveryServicesBackupProtection, Disable-AzureRmRecoveryServicesBackupRPMo...
Mistake on my end. This fix went in the 2018-04-12 release and there were no AzureRM modules, only Az. You can either upgrade to Az module but you will have to update your existing scripts or you can keep using the same module and use work around by passing vault location and vault Id in the parameters as mentioned above.
I tried your workaround steps. I am getting the following error
Restore-AzureRmRecoveryServicesBackupItem : Cannot validate argument on parameter 'VaultId'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again. At line:1 char:66
- ... Restore-AzureRmRecoveryServicesBackupItem -vaultID $vault.ID -VaultL ...
-
~~~~~~~~~- CategoryInfo : InvalidData: (:) [Restore-AzureRm...vicesBackupItem], ParameterBindingValidati onException
- FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Azure.Commands.RecoveryServices.Bac kup.Cmdlets.RestoreAzureRmRecoveryServicesBackupItem
Also upgrading the module didn't help. Any other suggestions ?
@SidFallenAngel Looking at the error, it seems like you are passing an empty object in -VaultId parameter. You need to get the vault object using
$vault = Get-AzureRmRecoveryServicesVault -Name
@siddharth7 Hi Sid. I tried the same. I did pass the parameter values. However when I just ran $vault to print its value, no value is getting printed. That's weird.
@SidFallenAngel Since the $vault is empty, it points to the fact that you are passing wrong params to the get-vault cmdlet. Please run $vault = Get-AzureRmRecoveryServicesVault . It will return all the vaults in your subscription. Check the $vault variable if it contains the vault you are looking for.
#customer-response-expected
Since explanation was provided and the fix is provided, closing the issue.