0

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

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
4

1 回答 1

1

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

以管理员模式启动 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

您现在应该能够运行该命令。

希望这可以帮助!

于 2019-11-07T08:55:00.780 回答