尝试运行Invoke-AzVMRunCommand在另一个Azure VM中执行脚本时出错



在尝试运行Invoke-AzVMRunCommand以运行脚本从azure blob存储下载不同VM中的文件时,我得到以下错误。az模块安装在这里涉及的所有VM中。

Value[0]        :
Code          : ComponentStatus/StdOut/succeeded
Level         : Info
DisplayStatus : Provisioning succeeded
Message       :
Value[1]        :
Code          : ComponentStatus/StdErr/succeeded
Level         : Info
DisplayStatus : Provisioning succeeded
Message       : New-AzStorageContext : The term 'New-AzStorageContext' is not recognized as
the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is
correct and try again.
At C:PackagesPluginsMicrosoft.CPlat.Core.RunCommandWindows1.1.8Downloadss
cript10.ps1:3 char:19
+ $StorageContext = New-AzStorageContext -StorageAccountName csd1u1prdo ...
+                   ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (New-AzStorageContext:String) []
, CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Get-AzStorageBlobContent : The term 'Get-AzStorageBlobContent' is not
recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At C:PackagesPluginsMicrosoft.CPlat.Core.RunCommandWindows1.1.8Downloadss
cript10.ps1:5 char:1
+ Get-AzStorageBlobContent -Blob "test.txt" -Container $containerName - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (Get-AzStorageBlobContent:String
) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Status          : Succeeded
Capacity        : 0
Count           : 0

显示没有加载Azure PowerShell模块。当你安装cmdlet时,你也会得到一个新的快捷方式"Microsoft Azure Powershell"它将自动为您加载模块(并使cmdlet可用)。

使用Azure PowerShell cmdlet的最佳方法是直接从安装程序生成的快捷方式启动Azure PowerShell。或者使用import - module命令导入Azure PowerShell模块。

有关详细说明,请阅读此:如何安装和配置Azure Power Shell模块- https://azure.microsoft.com/en-us/documentation/articles/install-configure-powershell/

最新更新