Get-AzsHealthReport is not recognized

325 Views Asked by At

I tried to get Azure Stack identity health report according to the below document. But getting error if the packages are installed on 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
1

There are 1 best solutions below

0
On BEST ANSWER

Follow the steps provided in this document on powershell as Admin.

Start Powershell in Admin mode and run the below steps:

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

Now install Azure Stack Tools:

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

You should now be able to run the command.

Hope this helps!