CloudShell icon indicating copy to clipboard operation
CloudShell copied to clipboard

Weird errors connecting to cloudshell

Open DanEhrlich opened this issue 2 years ago • 1 comments

This started happening today when I connect to https://portal.azure.com/#cloudshell/

Requesting a Cloud Shell.Succeeded. Connecting terminal...

Welcome to Azure Cloud Shell

Type "az" to use Azure CLI Type "help" to learn about Cloud Shell

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.7.5 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing | 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again. Additionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For | troubleshooting information, please see: https://aka.ms/azps-version-error

InvalidOperation: /opt/microsoft/powershell/7/profile.ps1:304 Line | 304 | & ($script:PSCloudShellUtilityModuleInfo){Get-CloudShellTip -ErrorAct … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.

VERBOSE: Authenticating to Azure ... InvalidOperation: /opt/microsoft/powershell/7/profile.ps1:60 Line | 60 | & ($script:PSCloudShellUtilityModuleInfo){param([string]$Label, [ … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.

Invoke-CloudShellTelemetry: /opt/microsoft/powershell/7/profile.ps1:91 Line | 91 | Invoke-CloudShellTelemetry -LogLabel "GETSUBSCRIPTIONID" -Sta … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.

InvalidOperation: /opt/microsoft/powershell/7/profile.ps1:60 Line | 60 | & ($script:PSCloudShellUtilityModuleInfo){param([string]$Label, [ … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.

InvalidOperation: /opt/microsoft/powershell/7/profile.ps1:60 Line | 60 | & ($script:PSCloudShellUtilityModuleInfo){param([string]$Label, [ … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.

InvalidOperation: /opt/microsoft/powershell/7/profile.ps1:60 Line | 60 | & ($script:PSCloudShellUtilityModuleInfo){param([string]$Label, [ … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.

Import-Module: /opt/microsoft/powershell/7/profile.ps1:391 Line | 391 | Microsoft.PowerShell.Core\Import-Module -Name AzurePSDrive | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | This module requires Az.Accounts version 2.7.5 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to add the switch '-RegenerateSupportModule' when executing | 'test-module.ps1'. Otherwise please open a new PowerShell session and import this module again. Additionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For | troubleshooting information, please see: https://aka.ms/azps-version-error

VERBOSE: Building your Azure drive ... InvalidOperation: /opt/microsoft/powershell/7/profile.ps1:60 Line | 60 | & ($script:PSCloudShellUtilityModuleInfo){param([string]$Label, [ … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.

New-PSDrive: /opt/microsoft/powershell/7/profile.ps1:402 Line | 402 | $null = Microsoft.PowerShell.Management\New-PSDrive -Name Azure - … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Cannot find a provider with the name 'SHiPS'.

WARNING: Something went wrong while creating Azure drive. You can still use this shell to run Azure PowerShell commands. InvalidOperation: /opt/microsoft/powershell/7/profile.ps1:60 Line | 60 | & ($script:PSCloudShellUtilityModuleInfo){param([string]$Label, [ … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.

InvalidOperation: /opt/microsoft/powershell/7/profile.ps1:415 Line | 415 | & ($script:PSCloudShellUtilityModuleInfo){Set-CloudShellPSReadLineKey … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.

InvalidOperation: /opt/microsoft/powershell/7/profile.ps1:60 Line | 60 | & ($script:PSCloudShellUtilityModuleInfo){param([string]$Label, [ … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.

PS /home/dan>

AB#14439939

DanEhrlich avatar Apr 29 '22 18:04 DanEhrlich

I suspect this issue is related to the first error (slightly reformatted for readability without side-scrolling):

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.7.5 or greater. An earlier version of Az.Accounts
| is imported in the current PowerShell session. If you are running test, please try to add the
| switch '-RegenerateSupportModule' when executing 'test-module.ps1'. Otherwise please open a
| new PowerShell session and import this module again. Additionally, this error could indicate
| that multiple incompatible versions of Azure PowerShell modules are installed on your system.
| For troubleshooting information, please see: https://aka.ms/azps-version-error

This error indicates that the version of PSCloudShellUtility the profile is attempting to load requires Az.Accounts version 2.7.5 or higher to be loaded. I can't tell if this error is because an older version was loaded before line 13 or a sufficiently new version is not available at all.

The documentation linked in the error includes the Symptom: Error when Importing an Azure PowerShell module section which seems to relate to this error.

michaeltlombardi avatar May 24 '22 20:05 michaeltlombardi

@DanEhrlich , we have updated the image, are you still seeing this issue?

maertendMSFT avatar Aug 25 '22 17:08 maertendMSFT

I fix it by removing all of the files in my home directory

“If we worked on the assumption that what is accepted as true really is true, then there would be little hope for advance.” -- Orville Wright

On Aug 25, 2022, at 1:22 PM, Danny Maertens @.***> wrote:

 @DanEhrlich , we have updated the image, are you still seeing this issue?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

DanEhrlich avatar Aug 25 '22 18:08 DanEhrlich