Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
1 like 0 dislike
2.8k views
in Azure by 37 41 48

 I got this error "PackageManagement\Install-Package : Unable to install, multiple modules matched 'AzureAD'. Please specify a single -Repository." when trying to install Azure Active Directory module using PowerShell!

Unable to install, multiple modules matched 'AzureAD'

PS C:\Windows\system32> Install-Module AzureAD
WARNING: 'AzureAD' matched module 'AzureAD/2.0.2.140' from provider: 'PowerShellGet', repository 'PSGallery'.
WARNING: 'AzureAD' matched module 'AzureAD/1.1.141.0' from provider: 'PowerShellGet', repository 'PoshTestGallery'.
PackageManagement\Install-Package : Unable to install, multiple modules matched 'AzureAD'. Please specify a single -Repository.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:9711 char:34
+ ... talledPackages = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], E
   xception
    + FullyQualifiedErrorId : DisambiguateForInstall,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

How can I specify a single repository for a Module in PowerShell?


1 Answer

1 like 0 dislike
by 163 204 403
selected by
 
Best answer

Solving: Unable to install, multiple modules matched 'AzureAD'. Please specify a single -Repository.

Generally, In case you are trying to install a module in PowerShell, and this module has multiple module versions. so you will get this error "Unable to install, multiple modules matched 'Module Name'. Please specify a single -Repository." if you didn't specify the required version parameter in your Install-Module cmdlet.

To solve Unable to install, multiple modules matched , you just need to specify which required version you need to install by specifying the required version in your cmdlet as the following:

Install-Module AzureAD -RequiredVersion version number

In your case, you have set the -RequiredVersion to the latest version as the following:

Install-Module AzureAD -RequiredVersion 2.0.2.140

See Also

If you don’t ask, the answer is always NO!
...