Installing Azure Stack PowerShell module
Installation of PowerShell module depends on Azure stack version. You can refer Microsoft documentation. The below mentioned steps are for Azure Stack version 1908:
Install Windows PowerShell 5.1.
Install
PowerShellGet:You need access to the PowerShell Gallery. The gallery is the central repository for PowerShell content. ThePowerShellGetmodule contains cmdlets for discovering, installing, updating, and publishing PowerShell artifacts.To install a package from the Gallery either execute the
Install-ModuleorInstall-Scriptcmdlet, depending on the package type.Run: Install-Module -Name PowershellGet -RequiredVersion 2.2.1
Validate the PowerShell Gallery accessibility using the below commands:
Import-Module -Name PowerShellGet -ErrorAction Stop
Import-Module -Name PackageManagement -ErrorAction Stop
Get-PSRepository -Name "PSGallery"
If the repository isn't registered, open an elevated PowerShell session and run the following command:
Register-PSRepository -Default Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
To install the Azure Stack PowerShell, perform the below steps:
Install the
AzureRM.BootStrappermodule. Select Yes when prompted to installNuGet.Install-Module -Name AzureRM.BootStrapper
Install and import the API Version Profile required by Azure Stack into the current PowerShell session. Required version will vary with respect to Azure Stack Version
Use-AzureRmProfile -Profile 2019-03-01-hybrid -Force Install-Module -Name AzureStack -RequiredVersion 1.7.2
You can confirm the Azure Stack PowerShell installation by executing the below commands:
Get-Module -Name "Azure*" -ListAvailable
Get-Module -Name "Azs*" -ListAvailable
See Deploying the virtual appliances in Azure Stack using PowerShell script.