You likely heard of or currently use oh-my-zsh for your terminal on Linux or Mac, or WSL on Windows. It might also be possible to have heard of or currently use oh-my-posh for your PowerShell. Azure offers Azure Cloud Shell service, which uses both Bash Shell and PowerShell by default. Therefore, if you want either oh-my-zsh or oh-my-posh, or both, you should configure it by yourself.
Throughout this post, I'm going to show how to configure your shell environment for both.
This GitHub repository provides the working shell script source for your reference.
Let's configure oh-my-zsh on your Azure Cloud Shell. Make sure that you see the Bash Shell prompt. If not, enter the bash command to switch your prompt to Bash.
Install oh-my-zsh.
Install plug-ins for oh-my-zsh. Although there are many good plug-ins, this post will install the three popular ones – zsh-completions, zsh-syntax-highlighting and zsh-autosuggestions. If you want more plug-ins, follow the steps below.
Install themes for oh-my-zsh. It's totally up to you which theme you're going to pick, but this post chooses either Spaceship or Powerlevel10k.
If you choose the Powerlevel10k theme, run the following command for further configuration.
As mentioned above, Azure Cloud Shell uses Bash Shell by default. Unfortunately, you can't run the chsh -s $(which zsh) command because sudo is not allowed. Therefore, update your .bashrc like below, as a workaround.
Once everything so far is done, restart Azure Cloud Shell. Alternatively, run the command, source .bashrc. Then, you will have the oh-my-zsh applied shell prompt.
If you want to run all steps above in just one command, run the following:
If you are with the Powerlevel10k theme and want to turn on or off the current time, run the following script:
Let's configure oh-my-posh on your Azure Cloud Shell this time. Make sure that you see the PowerShell prompt. If not, enter the pwsh command to switch your prompt to PowerShell.
Install oh-my-posh.
Install themes for oh-my-posh. Again, it's totally up to you which theme you're going to pick, but this post chooses either Spaceship or Powerlevel10k - Rainbow.
So far, I've walked through how to configure either oh-my-zsh or oh-my-posh, or both. With both configurations, you will be able to extend your local shell scripting experiences to Azure Cloud Shell.