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

Set-ASRVaultContext Error

Open shubhamgupta514 opened this issue 9 years ago • 4 comments

Hi,

When I am getting an error while executing below cmdlets:

###################### #Cmdlets ###################### $Vault = Get-AzureRMRecoveryServicesVault -ResourceGroupName $rgName -Name $VaultName Set-ASRVaultContext -vault $vault

########################

Error

######################## Set-AzureRmRecoveryServicesAsrVaultContext : Cannot bind parameter 'Vault'. Cannot convert the "Microsoft.Azure.Commands.RecoveryServices.ARSVault" value of type "Microsoft.Azure.Commands.RecoveryServices.ARSVault" to type "Microsoft.Azure.Commands.RecoveryServices.ARSVault". At line:2 char:28

  • Set-ASRVaultContext -vault $vault
  •                        ~~~~~~
    
    • CategoryInfo : InvalidArgument: (:) [Set-AzureRmReco...AsrVaultContext], ParameterBindingException
    • FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.SetAz ureRmRecoveryServicesAsrVaultSettings

########################################################

Exception

########################################################

System.Management.Automation.ParameterBindingException: Cannot bind parameter 'Vault'. Cannot convert the "Microsoft.Azure.Commands.RecoveryServices.ARSVault" value of type "Microsoft.Azure.Commands.RecoveryServices.ARSVault" to type "Microsoft.Azure.Commands.RecoveryServices.ARSVault". ---> System.Management.Automation.PSInvalidCastException: Cannot convert the "Microsoft.Azure.Commands.RecoveryServices.ARSVault" value of type "Microsoft.Azure.Commands.RecoveryServices.ARSVault" to type "Microsoft.Azure.Commands.RecoveryServices.ARSVault". at System.Management.Automation.LanguagePrimitives.ThrowInvalidCastException(Object valueToConvert, Type resultType) at System.Management.Automation.LanguagePrimitives.ConvertNoConversion(Object valueToConvert, Type resultType, Boolean recurse, PSObject originalValueToConvert, IFormatProvider formatProvider, TypeTable backupTable) at System.Management.Automation.LanguagePrimitives.ConversionData1.Invoke(Object valueToConvert, Type resultType, Boolean recurse, PSObject originalValueToConvert, IFormatProvider formatProvider, TypeTable backupTable) at System.Management.Automation.LanguagePrimitives.ConvertTo(Object valueToConvert, Type resultType, Boolean recursion, IFormatProvider formatProvider, TypeTable backupTypeTable) at System.Management.Automation.ParameterBinderBase.CoerceTypeAsNeeded(CommandParameterInternal argument, String parameterName, Type toType, ParameterCollectionTypeInformation collectionTypeInfo, Object currentValue) --- End of inner exception stack trace --- at System.Management.Automation.ParameterBinderBase.CoerceTypeAsNeeded(CommandParameterInternal argument, String parameterName, Type toType, ParameterCollectionTypeInformation collectionTypeInfo, Object currentValue) at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags) at System.Management.Automation.CmdletParameterBinderController.BindParameter(CommandParameterI nternal argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags) at System.Management.Automation.CmdletParameterBinderController.BindParameter(UInt32 parameterSets, CommandParameterInternal argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags) at System.Management.Automation.CmdletParameterBinderController.BindParameters(UInt32 parameterSets, Collection1 arguments) at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoVali dation(Collection1 arguments) at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Colle ction1 arguments) at System.Management.Automation.CommandProcessor.BindCommandLineParameters() at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary psDefaultParameterValues) at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream) at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input) at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext funcContext) at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)

##############################################################################

Please look into it. Thanks, Shubham Gupta

shubhamgupta514 avatar Oct 27 '17 06:10 shubhamgupta514

@viverm can you take a look?

markcowl avatar Oct 30 '17 21:10 markcowl

@shubhamgupta514

Can you tell Module version of Get-AzureRmSiteRecoveryVaultSettings and Set-ASRVaultContext get-command Get-AzureRmSiteRecoveryVaultSettings get-command Set-ASRVaultContext

viverm avatar Oct 31 '17 12:10 viverm

@viverm its resolved with the new module version AzureRM.RecoveryServices.SiteRecovery 0.1.6 Please close this issue

shubhamgupta514 avatar Oct 31 '17 14:10 shubhamgupta514

@shubhamgupta514 Thanks for Update.

viverm avatar Oct 31 '17 14:10 viverm