【发布时间】:2018-02-25 00:25:35
【问题描述】:
我正在尝试运行 PowerShell 脚本,但在这一行出现错误:
$eventHub = New-AzureRmEventHub -ResourceGroupName $eventHubConfig.resourceGroupName -NamespaceName $eventHubConfig.namespace -Location $location -EventHubName $hubConfig.Value.name
错误是这样的:
New-AzureRmEventHub :无法使用 指定的命名参数。在 C:\Users\David\Documents\EnvScripts\Components\EventHubs.ps1:108 字符:16 + ... $eventHub = New-AzureRmEventHub -ResourceGroupName $eventHubConfig.re ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [New-AzureRmEventHub], ParameterBindingException + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Azure.Commands.EventHub.Commands.EventHub.NewAzureRmEven 中心
我传递的参数是这些值:
eventHubConfig.resourceGroupName: MyApp_David
eventHubConfig.namespace: myapp-eventhub-david
location: Canada East
hubConfig.Value.name: myapp-user-position-transactions-Debug
我在同事的环境中运行这个脚本,他没有这个问题...我是否缺少 PowerShell 模块?我在我的 PowerShell 中安装并导入了 AzureRM。
【问题讨论】:
-
您的 Azure PowerShell 版本是什么?
Get-Module -ListAvailable -Name Azure -Refresh使用 cmdlet 检查它。 -
Azure 版本 2.1.0
-
这是旧版本。当你添加
-MessageRetentionInDays 3时,你解决了这个问题吗? -
我在我的实验室里测试,我得到了和你一样的错误日志。我添加
-MessageRetentionInDays 3,我解决了这个问题。
标签: powershell azure