Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Az.Accounts version conflict #346

Closed
mahmoud76 opened this issue Aug 21, 2023 · 2 comments
Closed

Az.Accounts version conflict #346

mahmoud76 opened this issue Aug 21, 2023 · 2 comments

Comments

@mahmoud76
Copy link

mahmoud76 commented Aug 21, 2023

Hi,
I got the below error every time I open cloudShell (PowerShell).

Import-Module: /opt/microsoft/powershell/7/profile.ps1:13
Line |
13 | Microsoft.PowerShell.Core\Import-Module -Name PSCloudShellUtility
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| This module requires Az.Accounts version 2.12.5. An earlier version of Az.Accounts is imported in the current PowerShell session. Please open a new session before importing this
| module. This error could indicate that multiple incompatible versions of the Azure PowerShell cmdlets are installed on your system. Please see https://aka.ms/azps-version-error for
| troubleshooting information.

I tried the following commands as per the documentation, with no luck:

PS /home/mahmoud> Select-AzSubscription -SubscriptionId f24f799f-4ad0-4f93-bdc6-3aa22a2ddfe1

Name Account SubscriptionName Environment TenantId


Visual Studio Enterprise Subscription –… MSI@50342 Visual Studio Enterprise Subscripti… AzureCloud e1304ad9-93ba-4557-8b20-8c1c1143b399

PS /home/mahmoud> Register-AzResourceProvider -ProviderNamespace Microsoft.CloudShell
Register-AzResourceProvider: The 'Register-AzResourceProvider' command was found in the module 'Az.Resources', but the module could not be loaded. For more information, run 'Import-Module Az.Resources'.
PS /home/mahmoud> Import-Module Az.Resources
Write-Error: This module requires Az.Accounts version 2.12.5. An earlier version of Az.Accounts is imported in the current PowerShell session. Please open a new session before importing this module. This error could indicate that multiple incompatible versions of the Azure PowerShell cmdlets are installed on your system. Please see https://aka.ms/azps-version-error for troubleshooting information.
Import-Module: The module to process 'Az.Resources.psm1', listed in field 'ModuleToProcess/RootModule' of module manifest '/usr/local/share/powershell/Modules/Az.Resources/6.9.0/Az.Resources.psd1' was not processed because no valid module was found in any module directory.
PS /home/mahmoud>

Also, I tried to update the module, but got the below error.

PS /home/mahmoud> Update-Module -Name Az.Accounts
Install-Package: Unable to find repository '/usr/cloudshell/temp'. Use Get-PSRepository to see all available repositories.
PS /home/mahmoud> Get-PSRepository

Name InstallationPolicy SourceLocation


PSGallery Trusted https://www.powershellgallery.com/api/v2

@theJasonHelmick
Copy link
Member

Hi @mahmoud76 -- Thank you for the issue. One way of fixing this is to try and uninstall the older module then install the new one. Please try:
Uninstall-module Az.accounts
Install-module Az.Accounts

Please let us know if this resolves the problem.

@mahmoud76
Copy link
Author

Many thanks, theJasonHelmick.
I've fixed it by recreating the cloudshell VM.

@mahmoud76 mahmoud76 reopened this Aug 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants