Octopus 中的“Azure PowerShell 会话尚未正确初始化”错误消息

Dec*_*lty 5 powershell cmdlets azure azure-powershell octopus-deploy

我正在尝试Get-AzureRmEventHubNamespaceKey在 Octopus 中的 Azure Powershell 步骤中运行cmdlet。

我收到以下错误:

Get-AzureRmEventHubNamespaceKey : The Azure PowerShell session has not been properly 
                                  initialized.  Please import the module and try again
Run Code Online (Sandbox Code Playgroud)

该模块安装在八达通服务器的以下目录中:

C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.EventHub

作为同一步骤的一部分,我尝试先导入模块:

Import-Module –Name "C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.EventHub" -Verbose

我可以在输出中看到它已被导入:

VERBOSE: Importing cmdlet 'Get-AzureRmEventHubNamespaceKey'.

但紧随其后的是上述错误。如果我 RDP 到章鱼服务器并直接从那里运行它运行良好。

关于可能导致这种情况的任何想法?

Non*_*ter 0

要从您的计算机使用任何与 Azure 相关的命令,您需要先登录。

请注意,有多个 Azure 模块,每个模块都有不同的登录 cmdlet,但上面的链接特定于你正在使用的模块。