cloudshell

木村 公一 21 Reputation points
2022-06-26T15:48:07.647+00:00

I executed the following command in CloudShell.
When I started Cloud Shell again,an error occurred. Please tell me how to fix it.

Install-Module -Name Az.Accounts -Repository PSGallery -RequiredVersion 2.2.4
Install-Module -Name Az.Resources -Repository PSGallery -RequiredVersion 3.2.0
Install-Module -Name AzureAD -Repository PSGallery -RequiredVersion 2.0.2.128
Install-Module -Name AksHci -Repository PSGallery

↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓error↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
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.

Azure Cloud Services
Azure Cloud Services
An Azure platform as a service offer that is used to deploy web and cloud applications.
643 questions
0 comments No comments
{count} votes

Accepted answer
  1. Manu Philip 16,986 Reputation points MVP
    2022-06-26T19:53:30.833+00:00

    Cloud Shell is a pre-configured shell for managing Azure resources without the overhead of installing, versioning, and maintaining a machine yourself.

    The modules you are trying to install is already pre-existing in Azure Cloud Shell.

    215143-image.png

    ----------

    --please don't forget to upvote and Accept as answer if the reply is helpful--

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful