Closed LiquidPT closed 7 months ago
@LiquidPT you don't have the AZ module installed, that's why it fails. We also have that switch due to fetching module availability taking too long.
I do have the AZ module installed. When I type az
at the prompt I get the AZ help
@LiquidPT do you import that module AFTER loading oh-my-posh? Because that's all that switch does. If you check the contents of the $error
variable, you will see that error.
What do you mean by "import that module"?
I'm using the exact same PowerShell profile script and theme on another machine and it works fine.
As it turns out, it's also got the same version of OMP, PowerShell, and AZ CLI, so I don't actually know what's going on
Error: The term 'Get-AzContext' 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.
Ah, I'm guessing this is a case of Azure having multiple PowerShell modules. I have the newer Microsoft.AzureCLI installed on this machine, but I'm guessing the segment needs one of the others. I will look into this.
SOLVED: This segment requires the "Az" PowerShell module. Not the AzureCLI (which uses the command az, and I confused with the Az PowerShell module) nor the older AzureRM Powershell Module
All working now
@LiquidPT the segment doesn't require it, if you have the AZ CLI, that will also work. You simply shouldn't set $env:POSH_AZURE_ENABLED = $true
in that case.
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.
Code of Conduct
What happened?
I just updated OhMyPosh to 19.11.7 via Winget, and my prompt became
PS>
. Running init at the prompt showed the OMP prompt again, but closing and reopening Terminal showedPS>
. Opened the PowerShell profile, and commented out the line that says$env:POSH_AZURE_ENABLED = $true
and the prompt works again (but without my Azure info).Here is my PowerShell_profile.ps1 contents:
Theme
What OS are you seeing the problem on?
Windows
Which shell are you using?
powershell
Log output