Okay, I know this is old, but I found a better way to deal with Powershell modules. This doesn’t do all of them, but does a good amount. I am so tired of having to install MSIs everytime I want to do something. This is all based off the PowerShell Gallery. https://www.powershellgallery.com. For this article I am going to go over how to install it, then using a module manage AzureAD.
First you need the pre-requests. Now currently the documents say go to https://docs.microsoft.com/en-us/powershell/gallery/readme but docs.microsoft.com I hear is going away. So I thought I would just put it here instead.
Install the requirements
Installing items from the Gallery requires the latest version of the PowerShellGet module, which is available in Windows 10, in Windows Management Framework (WMF) 5.0, or in the MSI-based installer (for PowerShell 3 and 4).+ If you are running the latest version of Windows 10, you don’t need any of this, it is included
Supported Operating Systems
The PowerShellGet module requires PowerShell 3.0 or newer.+
Therefore, PowerShellGet requires one of the following operating systems:+
- Windows 10
- Windows 8.1 Pro
- Windows 8.1 Enterprise
- Windows 7 SP1
- Windows Server 2016 TP5
- Windows Server 2012 R2
- Windows Server 2008 R2 SP1
PowerShellGet also requires .NET Framework 4.5 or above. You can install .NET Framework 4.5 or above from here.
Loading the Module
- Do all these steps elevated to administrator (as in run as administrator)
- If your OS is running 64bit you must make sure to do this in 64bit PowerShell
Before you can actually use it, you need to import the module
Then get the latest version of the PowerShellGet module. You can store it anywhere, but I store it where my regular user and my admin account can get to it easily
Save-Module -Name PowerShellGet -Path c:\source
Then Install the Module
Install-Module -Name PowerShellGet -Force
Now get the AzureAD Module
Save-Module -Name AzureAD -Path c:\source
And Lastly install the AzureAD Module
Install-Module -Name AzureAD
REBOOT YOUR COMPUTER!!
How to Find Modules
There are a lot of modules out there and a few ways to find them. You can start with going to https://www.powershellgallery.com. To find this Azure AD Module click on Items and Search for AzureAD. Generally I like the GA versions, so click on the that.
You can now load the module with
Then to connect to Azure just do
connect-azuread -credential AdminUPN