I want to run SharePoint Online PowerShell, from Azure Cloud Shell. It yields nonsense about the command being unrecognized, though. Here is some example session transcription.
PS /home/entra> Connect-SPOService -Url https://(tenant-admin).sharepoint.com
Connect-SPOService: The term 'Connect-SPOService' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
PS /home/entra> Get-Module -ListAvailable -Name Microsoft.Online.SharePoint.PowerShell | Select Name,Version
Name Version
Microsoft.Online.SharePoint.PowerShell 16.0.24810.12000
PS /home/entra> Connect-SPOService -Url https://(tenant-admin).sharepoint.com
Connect-SPOService: The term 'Connect-SPOService' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
PS /home/entra> Uninstall-Module -Name Microsoft.Online.SharePoint.PowerShell -AllVersions -Force
PS /home/entra> Install-Module Microsoft.Online.SharePoint.PowerShell
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): A
PS /home/entra> Connect-SPOService -Url https://(tenant-admin).sharepoint.com
Connect-SPOService: The term 'Connect-SPOService' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
PS /home/entra> Update-Module -Name Microsoft.Online.SharePoint.PowerShell
PS /home/entra> Connect-SPOService -Url https://(tenant-admin).sharepoint.com
Connect-SPOService: The term 'Connect-SPOService' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
PS /home/entra>