【发布时间】:2016-01-23 01:17:05
【问题描述】:
我正在尝试自动将 Blob 从本地计算机上传到 Azure 存储,然后在我设置的 Azure VM 上下载 Blob。我已经配置了所有内容,并且能够在本地运行脚本来上传 blob。然后我可以 RDP 进入 Azure VM 并运行其他脚本来下载 blob。完美的!
我的问题是尝试使用 PSSession 或 Invoke-Command 在我的本地计算机上执行所有这些操作。我可以成功启动到 Azure VM 的 PSSession
Enter-PSSession -ComputerName <myMachine>.cloudapp.net -Port 8888 -Credential username/password -UseSSL
但是,当我尝试运行 Azure 命令时,例如通过 PSSession
Get-AzureStorageBlob -Container $containerName -Context $context
我得到了错误。
The term 'Get-AzureStorageBlobContent' is not recognized as the name of a
cmdlet, function, script file, or operable program.
虽然我可以 RDP 到 Azure VM 并正常运行这些命令,但一切正常。 (我在两台机器上都安装了 Azure Powershell SDK)我也尝试过创建一个 New-PSSession 然后使用
Invoke-Command -Session $myNewSession -ScriptBlock {my script}
同样的错误。对这个问题有任何帮助,我会很高兴,谢谢。
【问题讨论】:
-
在 PS Session 中运行命令之前,您是否尝试过
Import-Module Azure? -
是的,不高兴 - 我已经添加了答案
标签: powershell azure