无法识别获取 AzsHealthReport

Get-AzsHealthReport is not recognized

我尝试根据以下文档获取 Azure Stack 身份健康报告。但是如果软件包安装在 power shell 上,则会出现错误。 Link

Get-AzsHealthReport : The term 'Get-AzsHealthReport' 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:3 char:17
+ $healthReport = Get-AzsHealthReport -AdminResourceManagerEndpoint $Ad ...
+                 ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-AzsHealthReport:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

以管理员身份在 powershell 上按照此 document 中提供的步骤进行操作。

以管理员模式启动 Powershell 并运行执行以下步骤:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

# Install the AzureRM.BootStrapper module. Select Yes when prompted to install NuGet
Install-Module -Name AzureRM.BootStrapper

# Install and import the API Version Profile required by Azure Stack into the current PowerShell session.
Use-AzureRmProfile -Profile 2019-03-01-hybrid -Force
Install-Module -Name AzureStack -RequiredVersion 1.7.2

现在安装 Azure Stack 工具:

https://github.com/Azure/AzureStack-Tools/tree/master/Identity#download-azure-stack-tools

cd C:
mkdir Azure-Stack
cd .\Azure-Stack\
# Download the tools archive.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
invoke-webrequest `...
# Expand the downloaded files.
expand-archive master.zip `...
# Change to the tools directory.
cd AzureStack-Tools-master
cd .\Identity\
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Import-Module ..\Connect\AzureStack.Connect.psm1
Import-Module ..\Identity\AzureStack.Identity.psm1
Get-AzsHealthReport

您现在应该可以 运行 命令。

希望对您有所帮助!