当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 无法识别术语“Connect-AzureRmAccount”

作者:精品下载站 日期:2024-12-14 20:54:17 浏览:12 分类:玩电脑

无法识别术语“Connect-AzureRmAccount”


[玩转系统] 无法识别术语“Connect-AzureRmAccount”

Azure PowerShell AzureRM 模块用于管理和自动化 Azure 资源(例如 VM、VNet 等)。

如果您尝试在未安装该模块的情况下连接到 Azure,您将遇到以下错误消息:

PS C:\> Connect-AzureRmAccount
Connect-AzureRmAccount : The term 'Connect-AzureRmAccount' 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 line:1 char:1
+ Connect-AzureRmAccount
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Connect-AzureRmAccount:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

要解决此问题,您必须安装 AzureRm PowerShell 模块。

AzureRM 先决条件

在成功安装 AzureRm PowerShell 模块之前,必须满足几个先决条件:

  • AzureRm 模块是基于 .Net Framework 构建的,因此必须存在。确保您拥有 4.7.2 或更高版本。如果需要,请从此处安装。
  • 您必须拥有 PowerShell 版本 5.1 或更高版本。使用以下命令检查您的版本:
PS C:\> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      17763  771
    • 如果 PowerShell 版本 5.1 不可用,您可以从此处安装它。
  • 您必须在系统上安装 NuGet 包提供程序。使用以下命令检查它是否存在:
  • PS C:\> Get-PackageProvider
    
    Name                     Version          DynamicOptions
    ----                     -------          --------------
    msi                      3.0.0.0          AdditionalArguments
    msu                      3.0.0.0
    NuGet                    2.8.5.208        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, ...
    PowerShellGet            1.0.0.1          PackageManagementProvider, Type, Scope, AllowClobber, ...
    Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent
    
    • 如果 NuGet 不存在,您可以使用以下命令安装它:
    Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force

    安装 Azure PowerShell AzureRM 模块

    如果满足所有先决条件,您可以使用以下命令安装 AzureRm PowerShell 模块:

    Install-Module AzureRm

    安装完成后,您应该能够使用 AzureRm 模块成功连接:

    PS C:\> Connect-AzureRmAccount
    
    Account                  SubscriptionName TenantId                             Environment
    -------                  ---------------- --------                             -----------
    [email protected] Pay-As-You-Go    c1493123-2ba6-a49e-b462-e3e7cdbae630 AzureCloud
    

    概括

    希望这篇文章能够帮助您使用 AzureRm PowerShell 模块。

    如果您正在寻找一种轻松简单的方法来管理 Office 365 用户、邮箱和许可证,请查看 Easy365Manager。

    借助 Easy365Manager,您可以在 AD 用户和计算机工具中执行所有日常管理,而无需不断在 Office 365 门户、Exchange 管理中心和 PowerShell 之间切换。

    Easy365Manager 提供功能齐全的 30 天试用版。

    您需要 登录账户 后才能发表评论

    取消回复欢迎 发表评论:

    关灯