Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore-AzureRmRecoveryServicesBackupItem command failing for azureVM #7823

Closed
siddharth7 opened this issue Nov 14, 2018 · 11 comments
Closed
Labels
Recovery Services Backup Service Attention This issue is responsible by Azure service team.

Comments

@siddharth7
Copy link
Contributor

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
@siddharth7 siddharth7 changed the title Restore-AzureRmRecoveryServicesBackupItem command error Restore-AzureRmRecoveryServicesBackupItem command failing for azureVM Nov 14, 2018
@siddharth7
Copy link
Contributor Author

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 -Name
$restorejob = Restore-AzureRmRecoveryServicesBackupItem -VaultID $vault.ID -VaultLocation $vault.Location -RecoveryPoint $rp[0] -StorageAccountName "DestAccount" -StorageAccountResourceGroupName "DestRG"

@maddieclayton maddieclayton added Recovery Services Backup Service Attention This issue is responsible by Azure service team. labels Nov 14, 2018
siddharth7 added a commit to MabOneSdk/azure-powershell that referenced this issue Nov 27, 2018
siddharth7 added a commit to MabOneSdk/azure-powershell that referenced this issue Nov 27, 2018
siddharth7 added a commit to MabOneSdk/azure-powershell that referenced this issue Nov 27, 2018
siddharth7 added a commit to MabOneSdk/azure-powershell that referenced this issue Nov 28, 2018
siddharth7 added a commit to MabOneSdk/azure-powershell that referenced this issue Nov 28, 2018
cormacpayne added a commit that referenced this issue Nov 29, 2018
[RecoveryServices.Backup] VM restore fix for #7823
@rupanter
Copy link

Hi, is this fixed? I am still facing this issue.

@siddharth7
Copy link
Contributor Author

Hi, this has been fixed.
Try using the lastest version https://www.powershellgallery.com/packages/AzureRM.RecoveryServices.Backup/4.5.2

@rupanter
Copy link

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...

@siddharth7
Copy link
Contributor Author

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.

@Phoenix0610
Copy link

Phoenix0610 commented Jan 11, 2019

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 ?

@siddharth7
Copy link
Contributor Author

@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 -ResourceGroupName .
And pass the vault id i.e. $vault.ID

@Phoenix0610
Copy link

@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.

@siddharth7
Copy link
Contributor Author

siddharth7 commented Jan 21, 2019

@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.

@pvrk
Copy link
Member

pvrk commented May 23, 2019

#customer-response-expected

@pvrk
Copy link
Member

pvrk commented May 27, 2019

Since explanation was provided and the fix is provided, closing the issue.

@pvrk pvrk closed this as completed May 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Recovery Services Backup Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

6 participants