【问题标题】:Issue in bind parameter 'StorageContext'绑定参数“StorageContext”中的问题
【发布时间】:2017-09-23 02:28:06
【问题描述】:

当使用 New-AzureStorageContext 命令检索的 AzureStorageContext 与 New-AzureServiceDiagnosticsExtensionConfig 输入参数不兼容时,我遇到了问题。

$storageContext = New-AzureStorageContext –StorageAccountName $storage_AccountName –StorageAccountKey $storage_Key

$config2 = New-AzureServiceDiagnosticsExtensionConfig -StorageContext $storageContext -DiagnosticsConfigurationPath $configuration_FilePath_EventHubListener -role $workerRole_WorkerRoleName

错误:New-AzureServiceDiagnosticsExtensionConfig:无法绑定 参数“StorageContext”。无法转换 “Microsoft.WindowsAzure.Commands.Storage.AzureStorageContext”的值 键入“Microsoft.WindowsAzure.Commands.Storage.AzureStorageContext”到 类型 “Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext”。 在 C:\Build\BuildScripts\AzurePowershell_V1.3.8-DeployeAndDiagnostics\DeployeAndDiagnosticsNewPowershell.ps1:90 字符:71 + $config2 = New-AzureServiceDiagnosticsExtensionConfig -StorageContext $storageCo ... + ~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [New-AzureServic...ExtensionConfig],ParameterBindingException +fullyQualifiedErrorId:CannotConvertArgumentNoMessage,Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions.NewAzureServiceDiagnosticsEx 张力配置命令

它在本地工作,但不在虚拟机中。

【问题讨论】:

  • 如果可以,请将解决方案粘贴到答案中并接受。完全可以回答您自己的问题!

标签: powershell azure


【解决方案1】:

问题似乎是 Azure.Storage 中的版本不兼容。 Azure Powershell 模块的版本在 VM 中是 4.0.1,在我本地是 3.4.0。我已经通过下面给出的链接在 VM 中卸载并安装了 3.4.0,它运行良好。

https://www.powershellgallery.com/packages/Azure/3.4.0

【讨论】:

  • 根据这个 github 问题,Azure Powershell 模块 4.0.1(2017 年 5 月 15 日)确实与 Azure.Storage 3.0.1 不兼容。建议的解决方案是删除它并安装具有 Azure.Storage 2.8.0 作为依赖项的 Azure 3.8.0(2017 年 4 月 5 日)。 Uninstall-Module -Name Azure.Storage; Uninstall-Module -Name Azure; Install-Module -Name Azure -RequiredVersion 3.8.0https://github.com/Azure/azure-powershell/issues/3976
猜你喜欢
  • 2021-03-28
  • 1970-01-01
  • 2010-12-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-03-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多