在windows 10上安装Azure PowerShell模块

在windows 10上安装Azure PowerShell模块,azure,Azure,你好 尝试在我的windows 10计算机上安装azure AZ模块时出现以下错误。任何帮助和建议都将不胜感激。多谢各位 PS C:\WINDOWS\system32>安装模块-名称Az-AllowClobber 需要NuGet提供程序才能继续 PowerShellGet需要NuGet提供程序版本“2.8.5.201”或更高版本才能与基于NuGet的存储库交互。努吉人 提供程序必须在“C:\Program Files\PackageManagement\ProviderAssembly”中可用,

你好

尝试在我的windows 10计算机上安装azure AZ模块时出现以下错误。任何帮助和建议都将不胜感激。多谢各位

PS C:\WINDOWS\system32>安装模块-名称Az-AllowClobber

需要NuGet提供程序才能继续 PowerShellGet需要NuGet提供程序版本“2.8.5.201”或更高版本才能与基于NuGet的存储库交互。努吉人 提供程序必须在“C:\Program Files\PackageManagement\ProviderAssembly”中可用,或 'C:\Users\user\AppData\Local\PackageManagement\ProviderAssemblies'。您还可以通过运行 '安装PackageProvider-名称NuGet-最小版本2.8.5.201-强制'。是否要PowerShellGet安装并导入 现在是NuGet提供者吗? [Y] 是[N]否[S]挂起[?]帮助(默认值为“Y”):是 警告:无法从URI“”下载到“”。 警告:无法下载可用提供程序的列表。检查你的互联网连接。 PackageManagement\Install PackageProvider:未找到与提供程序的指定搜索条件匹配的项 “努吉”。包提供程序需要“PackageManagement”和“provider”标记。请检查指定的包装是否正确 有标签。 位于C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7468 char:21 + ... $null=PackageManager\Install PackageProvider-名称$script:N。。。 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +CategoryInfo:InvalidArgument:(Microsoft.Power…PackageProvider:InstallPackageProvider)[安装Pac kageProvider]异常 +FullyQualifiedErrorId:NoMatchFoundForProvider,Microsoft.PowerShell.PackageManager.cmdlet.InstallPackagePro 维德

PackageManagement\Import PackageProvider:找不到与指定搜索条件和提供程序名称匹配的项 “努吉”。请尝试“Get-PackageProvider-ListAvailable”查看系统上是否存在该提供程序。 位于C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7474 char:21 + ... $null=PackageManager\Import PackageProvider-名称$script:Nu。。。 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +CategoryInfo:InvalidData:(NuGet:String)[Import PackageProvider],异常 +FullyQualifiedErrorId:NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManager.cmdlet.ImportPackageProv 伊德尔

警告:无法从URI“”下载到“”。 警告:无法下载可用提供程序的列表。检查你的互联网连接。 PackageManager\Get PackageProvider:找不到包提供程序'NuGet'。它可能还没有进口。尝试 “获取PackageProvider-ListAvailable”。 在C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7478 char:30 + ... tProvider=PackageManagement\Get PackageProvider-Name$script:NuGet。。。 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +CategoryInfo:ObjectNotFound:(Microsoft.Power…PackageProvider:GetPackageProvider)[获取PackageProvi 例外情况 +FullyQualifiedErrorId:ActivatedList中的未知提供程序,Microsoft.PowerShell.PackageManager.cmdlet.GetPackage geProvider

安装模块:需要NuGet提供程序与基于NuGet的存储库交互。请确保“2.8.5.201” 或安装了更新版本的NuGet provider。 第1行字符:1 +安装模块-名称Az-AllowClobber + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +类别信息:InvalidOperation:(:)[安装模块],InvalidOperationException
+FullyQualifiedErrorId:CouldNotInstallNuGetProvider,Install Module

此错误是由Windows PowerShell与提供NuGet软件包提供程序和Windows PowerShell模块的NuGet基础结构交互的方式引起的

整个基础架构使用SSL/TLS进行保护。这可以防止中间类型攻击中的窃听和干预,即恶意用户向纯文本通信流中注入恶意代码

Windows PowerShell不使用TLS 1.2与基础架构通信,而是使用不太安全的加密协议。与许多其他基础设施一样,NuGet基础设施关闭了不太安全的加密协议。Windows Server 2016上与基础架构交互的最佳当前方式是使用TLS 1.2

要运行以下cmdlet [Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12

你也可以参考这个

注意:该命令仅影响当前会话,不会持续

您还可以检查计算机上为客户端设置的TLS版本。看起来需要客户端的TLS 1.0。(参考号:)


TLS安全相关(参考:)

@SumanthMarigowda MSFT非常感谢,终于能够安装PowershellGet/Azure Powershell模块了

[以下https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-5.1.0 要在Powershell上安装Azure模块,需要Powershell Get,而Powershell Get又需要NuGet]

PS C:\WINDOWS\system32> Install-Module -Name PowershellGet -Force
需要NuGet提供程序继续 PowerShellGet需要NuGet提供程序版本“2.8.5.201”或更高版本才能与基于NuGet的存储库交互。NuGet提供程序必须在“C:\Program”中可用 文件\PackageManager\ProviderAssemblies'或'C:\Users\AditArg\AppData\Local\PackageManager\ProviderAssemblies'。您还可以通过运行 'Install-PackageProvider-Name NuGet-MinimumVersion 2.8.5.201-Force'。是否希望PowerShellGet立即安装并导入NuGet提供程序? [Y] 是[N]否[S]挂起[?]帮助(默认值为“Y”):N

由于它提示安装NuGet,我取消了上面的命令,并在上面的行中发出命令:

PS C:\WINDOWS\system32> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
警告:无法从URI下载https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409'到''。 警告:Unab
  + CategoryInfo          : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-PackageProvider], Exception
  + FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider

PS C:\WINDOWS\system32> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
PS C:\WINDOWS\system32>
PS C:\WINDOWS\system32> Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
PS C:\WINDOWS\system32>
PS C:\WINDOWS\system32> Install-Module -Name PowerShellGet -Force
PS C:\WINDOWS\system32>
PS C:\WINDOWS\system32>
PS C:\WINDOWS\system32> Get-InstalledModule -Name PowerShellGet

Version    Name                                Repository              Description
-------    ----                                ----------                       -----------
2.2.5      PowerShellGet                       PSGallery             PowerShell module with commands for discovering, installing, updating and publishing the PowerShell artifacts like Mo...
PS C:\WINDOWS\system32>

if ($PSVersionTable.PSEdition -eq 'Desktop' -and (Get-Module -Name AzureRM -ListAvailable)) {
Write-Warning -Message ('Az module not installed. Having both the AzureRM and ' +
  'Az modules installed at the same time is not supported.')
} else {
Install-Module -Name Az -AllowClobber -Scope CurrentUser
PS C:\WINDOWS\system32> Get-InstalledModule -Name Az

Version    Name                                Repository            Description
5.1.0      Az                                  PSGallery             Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module  is compatible with WindowsPowerShell a...
PS C:\WINDOWS\system32> Connect-AzAccount

Do you want to run software from this untrusted publisher?
File C:\Users\aditgarg\Documents\WindowsPowerShell\Modules\Az.Accounts\2.2.1   \Accounts.format.ps1xml is published by CN=Microsoft Corporation, O=Microsoft   Corporation, L=Redmond,
S=Washington, C=US and is not trusted on your system. Only run scripts from    trusted publishers.
[V] Never run  [D] Do not run  [R] Run once  [A] Always run  [?] Help   (default is "D"): Y
[V] Never run  [D] Do not run  [R] Run once  [A] Always run  [?] Help  (default is "D"): A
Connect-AzAccount : The 'Connect-AzAccount' command was found in the module   'Az.Accounts', but the module could not be loaded. For more information, run   'Import-Module Az.Accounts'.
At line:1 char:1
+ Connect-AzAccount
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (Connect-AzAccount:String) [],   CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
PS C:\WINDOWS\system32> Import-Module -Name Az
Import-Module : File C:\Users\aditgarg\Documents\WindowsPowerShell\Modules  \Az\5.1.0\Az.psm1 cannot be loaded because running scripts is disabled on this  system. For more information, see
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ Import-Module -Name Az
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : SecurityError: (:) [Import-Module], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ImportModuleCommand
PS C:\WINDOWS\system32>
PS C:\WINDOWS\system32> Set-ExecutionPolicy Unrestricted

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust.   Changing the execution policy might expose you to the security risks described  in the about_Execution_Policies
help topic at https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to    change the execution policy?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help  (default is "N"): Y