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

Get-AzureRmRecoveryServicesBackupProtectionPolicy not working in automation runbook

Open chaheti29 opened this issue 8 years ago • 2 comments

Hi,

I am facing below issue when I am trying to run Get-AzureRmRecoveryServicesBackupProtectionPolicy through automation runbook.(This works fine when I run on poershell ISE)

Get-AzureRmRecoveryServicesBackupProtectionPolicy : Method not found: 'Newtonsoft.Json.Serialization.IAttributeProvider Newtonsoft.Json.Serialization.JsonProperty.get_AttributeProvider()'. At line:7 char:11

  • $policy = Get-AzureRmRecoveryServicesBackupProtectionPolicy -AzureRmC ...
  •       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Get-AzureRmReco...rotectionPolicy], MissingMethodException
    • FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.GetAzureRmRecoveryServicesBackupProtectionPolicy

here is the code that I am trying to run

$context = Get-AzureRmContext $recoveryServiceVault = Get-AzureRmRecoveryServicesVault -Name 'recoveryservicevaultname' -AzureRmContext $context Set-AzureRmRecoveryServicesVaultContext -Vault $recoveryServiceVault -AzureRmContext $context $policy = Get-AzureRmRecoveryServicesBackupProtectionPolicy -AzureRmContext $context $policy

chaheti29 avatar Apr 18 '18 12:04 chaheti29

@chaheti29 this appears to be a similar issue to https://github.com/Azure/azure-powershell/issues/5977, so I will close this issue in favor of that one to track the progress of the fix there.

Quick question, was this script working previously for you in Azure Automation? If so, do you remember which version of AzureRM.RecoveryServices.Backup that you used?

cormacpayne avatar Apr 18 '18 16:04 cormacpayne

@cormacpayne thanks for quick reply. The current version I am using for AzureRM.RecoveryServices.Backup is 4.1.2. I have same versions on azure and local. Local seems to work fine but azure automation is not working

chaheti29 avatar Apr 18 '18 17:04 chaheti29