"新-AzureStorageContext"未识别。 Linux的

时间:2017-09-19 12:44:26

标签: linux powershell azure azure-storage-blobs

我一直在运行一个脚本,可以在我的Windows机器上下载所有BLOB文件。我没有问题。现在我试图在我的Ubuntu 16.10上做同样的事情。

我已经在我的发行版上安装了PowerShell。当我尝试运行我的脚本时:

New-AzureStorageContext : The term 'New-AzureStorageContext' 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 /home/file.ps1

PowerShell无法识别多个命令。

PS /home> Install-Module AzureRM

所以我尝试安装AzureRM模块:

PS /home> Import-Module AzureRM
Import-Module : The specified module 'AzureRM' was not loaded because no valid     module file was found in any module directory.
At line:1 char:1
+ import-module <<<<  azurerm
+ CategoryInfo          : ResourceUnavailable: (azurerm:String) [Import-    Module], FileNotFoundException + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

有效。现在我导入模块:

AzureRM

如何解决这个问题?也许直接下载模块文件并将其放在模块目录中?

编辑: 我试图手动下载PS /home> Save-Module -Name AzureRM -Path ~/.local/share/powershell/modules/ -RequiredVersion 4.3.1 PS /home> Install-Module -Name AzureRM 模块(版本4.3.1),如下所示:

PREPARE

模块下载,安装没有输出,但仍然无法正常工作。

编辑:

我发现了一个不使用PowerShell的其他工具。 AzCopy

1 个答案:

答案 0 :(得分:0)

请参阅此question和此question

  

不幸的是,我发现不支持某些较旧的cmdlet   但是,因为它们位于一个名为Azure的旧模块中   还没有.NET Core实现。

现在,Linux PowerShell支持AzureRM.Netcore

Install-Module -Name AzureRM.Netcore

目前,它仅支持ARM cmdlet。很遗憾,New-AzureStorageContext不受支持。

如果您使用ARM存储帐户,则可以安装AzureRM.Storage.Netcore

Get-AzureRmStorageAccount Get-AzureRmStorageAccountKey New-AzureRmStorageAccount New-AzureRmStorageAccountKey Remove-AzureRmStorageAccount Set-AzureRmCurrentStorageAccount Set-AzureRmStorageAccount Get-AzureRmStorageAccountNameAvailability Get-AzureRmStorageUsage

Linux Powershell支持这些cmdlet。

更新

现在,Linux支持Azcopy,您可以使用Azcopy传输文件或目录,请参阅此link:Transfer data with AzCopy on Linux

相关问题