Reading Time: 3 minutes
Share:
Twitter
LinkedIn
Facebook
Reddit
Whatsapp
Follow by Email

In this blog post, I am going to show you how to install PowerShell for Azure Stack. This should be one of the first things you do after you install Azure Stack.

Prerequisites

Before we are able to install PowerShell for Azure Stack we have to register the PSGallery repository.

Open PowerShell with Elevated credentials on the machine you want to install Azure Stack PowerShell on. (Normally the Azure Stack Host if you are not connected via VPN) and type the following code.

Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
view raw AzureStackPS.ps1 hosted with ❤ by GitHub

Install the latest version of the Azure Stack PowerShell modules

Uninstall any existing versions

It is always best to uninstall any existing version of the PowerShell module first. This can be done by using the following PowerShell code in an elevated window.

Get-Module -ListAvailable | where-Object {$_.Name -like "Azure*"} | Uninstall-Module
view raw AzureStackPS.ps1 hosted with ❤ by GitHub

Once that finishes we have to clear up some folders also. This can be done by using the following PowerShell command

Cd "C:\Program Files\WindowsPowerShell\Modules"; get-childitem -include "Azure*" -recurse -force| remove-Item -Force -Recurse
Cd "C:\Users\AzureStackAdmin\Documents\WindowsPowerShell\Modules"; get-childitem -include "Azure*" -recurse -force| remove-Item -Force -Recurse
view raw AzureStackPS.ps1 hosted with ❤ by GitHub

You may find that there is nothing to be deleted but it’s always good to check. That’s what the error above shows.

Install the PowerShell Module

Open PowerShell with elevated permissions and type the following PowerShell cmdlet. Make sure to select yes when prompted.

Install-module -Name AzureRm.BootStrapper
view raw AzureStackPS.ps1 hosted with ❤ by GitHub

Now we need to install the latest Version of the AzureRM modules for Computer, Storage, Network, etc. At the time of this blog post, the current version is 2007-03-09-profile. In your elevated PowerShell Window use the following command.

use-AzureRMProfile -Profile 2017-03-09-profile -Force
view raw AzureStackPS.ps1 hosted with ❤ by GitHub

Now we can install the Azure Stack Modules by using the following PowerShell command

Install-Module -Name AzureStack -RequiredVersion 1.2.10
view raw AzureStackPS.ps1 hosted with ❤ by GitHub

To Confirm the installation was a success we can use the following PowerShell command.

Get-Module -ListAvailable | where-Object {$_.Name -like "Azure*"}
view raw AzureStackPS.ps1 hosted with ❤ by GitHub

And that’s it you have now installed the Azure Stack PowerShell modules. In another blog post I will show you how to configure PowerShell for use with Azure Stack.

Share:
Twitter
LinkedIn
Facebook
Reddit
Whatsapp
Follow by Email

Pixel Robots.

I’m Richard Hooper aka Pixel Robots. I started this blog in 2016 for a couple reasons. The first reason was basically just a place for me to store my step by step guides, troubleshooting guides and just plain ideas about being a sysadmin. The second reason was to share what I have learned and found out with other people like me. Hopefully, you can find something useful on the site.

1 Comment

Register Azure Stack with your Azure Subscription – Pixel Robots. · August 31, 2017 at 7:03 pm

[…] Azure Subscription ID Username and Password of the Azure subscription owner The Azure Active Directory Name of the Azure subscription PowerShell For Azure Stack on Azure Stack host https://pixelrobots.co.uk/2017/07/install-the-azure-stack-powershell-module/ […]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

I agree