Azure Cloud Shell with Oh My Zsh and Oh My Posh

Published Dec 22 2021 04:00 PM 3,143 Views
Microsoft

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.

 

For oh-my-zsh

 

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.

 

  1. Install oh-my-zsh.

    sh -c "$(curl -fsSL \
        https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    
  2. 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.

    # Plugin: zsh-completions
    git clone https://github.com/zsh-users/zsh-completions.git \
              ~/.oh-my-zsh/custom/plugins/zsh-completions
    # Plugin: zsh-syntax-highlighting
    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git \
              ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
    # Plugin: zsh-autosuggestions
    git clone https://github.com/zsh-users/zsh-autosuggestions.git \
              ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
    
  3. 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.

    # Theme: Spaceship
    git clone https://github.com/spaceship-prompt/spaceship-prompt.git \
              ~/.oh-my-zsh/custom/themes/spaceship-prompt --depth=1
    ln -s ~/.oh-my-zsh/custom/themes/spaceship-prompt/spaceship.zsh-theme \
          ~/.oh-my-zsh/custom/themes/spaceship.zsh-theme
    
    # Theme: Powerlevel10k
    git clone https://github.com/romkatv/powerlevel10k.git \
              ~/.oh-my-zsh/custom/themes/powerlevel10k --depth=1
    ln -s ~/.oh-my-zsh/custom/themes/powerlevel10k/powerlevel10k.zsh-theme \
          ~/.oh-my-zsh/custom/themes/powerlevel10k.zsh-theme
    
  4. If you choose the Powerlevel10k theme, run the following command for further configuration.

    p10k configure
    
  5. 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.

    bash -c zsh
    
  6. 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.

  7. If you want to run all steps above in just one command, run the following:

    # Download the GitHub repository
    git clone https://github.com/justinyoo/oh-my-azure-cloud-shell.git ~/oh-my-azure-cloud-shell
    
    # Install oh-my-zsh with the theme of "Spaceship"
    ~/oh-my-azure-cloud-shell/install.sh -t spaceship
    
    # Install oh-my-zsh with the theme of "Powerlevel10k"
    ~/oh-my-azure-cloud-shell/install.sh -t p10k
    
  8. If you are with the Powerlevel10k theme and want to turn on or off the current time, run the following script:

    # Turn on the clock feature
    ~/oh-my-azure-cloud-shell/switch-p10k-clock.sh -c
    
    # Turn off the clock feature
    ~/oh-my-azure-cloud-shell/switch-p10k-clock.sh
    

 

Now, your Azure Cloud Shell starts using oh-my-zsh.

 

For oh-my-posh

 

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.

 

  1. Install oh-my-posh.

    Install-Module oh-my-posh -Scope CurrentUser -Repository PSGallery -Force
    Import-Module oh-my-posh -Scope Local -Force
    
  2. 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.

    # Theme: Spaceship
    Set-PoshPrompt -Theme spaceship
    
    # Theme: Powerlevel10k - Rainbow
    Set-PoshPrompt -Theme powerlevel10k_rainbow
    
  3. Install plug-ins for oh-my-posh, like Terminal Icons.

    Install-Module Terminal-Icons -Scope CurrentUser -Repository PSGallery -Force
    Import-Module Terminal-Icons -Scope Local -Force
    
  4. Create the $PROFILE file to run when initiating a PowerShell session.

    if (!(Test-Path -Path $PROFILE)) {
        New-Item -ItemType File -Path $PROFILE -Force
    }
    
    # Theme: Spaceship
    Write-Output "
    Set-PoshPrompt -Theme spaceship
    Import-Module Terminal-Icons -Scope Local -Force
    " | Out-File -FilePath $PROFILE -Encoding UTF8 -Append -Force
    
    # Theme: Powerlevel10k - Rainbow
    Write-Output "
    Set-PoshPrompt -Theme powerlevel10k_rainbow
    Import-Module Terminal-Icons -Scope Local -Force
    " | Out-File -FilePath $PROFILE -Encoding UTF8 -Append -Force
    
  5. Run the following command to reload $PROFILE.

    . $PROFILE
    
  6. If you want to run all steps above in just one command, run the following:

    # Download the GitHub repository
    git clone https://github.com/justinyoo/oh-my-azure-cloud-shell.git `
              ~/oh-my-azure-cloud-shell
    
    # Install oh-my-zsh with the theme of "Spaceship"
    ~/oh-my-azure-cloud-shell/install.ps1 -Theme spaceship
    
    # Install oh-my-zsh with the theme of "Powerlevel10k - Rainbow"
    ~/oh-my-azure-cloud-shell/install.ps1 -Theme p10k
    
  7. If you are with the Powerlevel10k - Rainbow theme and want to turn on or off the current time, run the following script:

    # Turn on the clock feature
    ~/oh-my-azure-cloud-shell/switch-p10k-clock.ps1 -WithClock
    
    # Turn off the clock feature
    ~/oh-my-azure-cloud-shell/switch-p10k-clock.ps1
    

 

Now, your Azure Cloud Shell starts using oh-my-zsh.


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.

 

This article was originally published on Dev Kimchi.

%3CLINGO-SUB%20id%3D%22lingo-sub-3042284%22%20slang%3D%22en-US%22%3EAzure%20Cloud%20Shell%20with%20Oh%20My%20Zsh%20and%20Oh%20My%20Posh%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3042284%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20likely%20heard%20of%20or%20currently%20use%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eoh-my-zsh%3C%2FA%3E%20for%20your%20terminal%20on%20Linux%20or%20Mac%2C%20or%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fwindows%2Fwsl%2Fabout%3FWT.mc_id%3Ddotnet-52663-juyoo%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EWSL%3C%2FA%3E%20on%20Windows.%20It%20might%20also%20be%20possible%20to%20have%20heard%20of%20or%20currently%20use%20%3CA%20href%3D%22https%3A%2F%2Fohmyposh.dev%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Eoh-my-posh%3C%2FA%3E%20for%20your%20PowerShell.%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2F%3FWT.mc_id%3Ddotnet-52663-juyoo%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%3C%2FA%3E%20offers%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcloud-shell%2Foverview%3FWT.mc_id%3Ddotnet-52663-juyoo%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Cloud%20Shell%3C%2FA%3E%20service%2C%20which%20uses%20both%20Bash%20Shell%20and%20PowerShell%20by%20default.%20Therefore%2C%20if%20you%20want%20either%20oh-my-zsh%20or%20oh-my-posh%2C%20or%20both%2C%20you%20should%20configure%20it%20by%20yourself.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThroughout%20this%20post%2C%20I'm%20going%20to%20show%20how%20to%20configure%20your%20shell%20environment%20for%20both.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3EThis%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fjustinyoo%2Foh-my-azure-cloud-shell%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EGitHub%20repository%3C%2FA%3E%20provides%20the%20working%20shell%20script%20source%20for%20your%20reference.%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22for-oh-my-zsh%22%20id%3D%22toc-hId-333667667%22%20id%3D%22toc-hId-336644686%22%3EFor%20oh-my-zsh%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet's%20configure%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eoh-my-zsh%3C%2FA%3E%20on%20your%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcloud-shell%2Foverview%3FWT.mc_id%3Ddotnet-52663-juyoo%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Cloud%20Shell%3C%2FA%3E.%20Make%20sure%20that%20you%20see%20the%20Bash%20Shell%20prompt.%20If%20not%2C%20enter%20the%3CCODE%3Ebash%3C%2FCODE%3Ecommand%20to%20switch%20your%20prompt%20to%20Bash.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CP%3EInstall%20oh-my-zsh.%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Esh%20-c%20%22%24(curl%20-fsSL%20%5C%0A%20%20%20%20https%3A%2F%2Fraw.githubusercontent.com%2Fohmyzsh%2Fohmyzsh%2Fmaster%2Ftools%2Finstall.sh)%22%0A%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3CLI%3E%3CP%3EInstall%20plug-ins%20for%20oh-my-zsh.%20Although%20there%20are%20many%20good%20plug-ins%2C%20this%20post%20will%20install%20the%20three%20popular%20ones%20%E2%80%93%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fzsh-users%2Fzsh-completions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ezsh-completions%3C%2FA%3E%2C%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fzsh-users%2Fzsh-syntax-highlighting%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ezsh-syntax-highlighting%3C%2FA%3E%20and%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fzsh-users%2Fzsh-autosuggestions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ezsh-autosuggestions%3C%2FA%3E.%20If%20you%20want%20more%20plug-ins%2C%20follow%20the%20steps%20below.%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3E%23%20Plugin%3A%20zsh-completions%0Agit%20clone%20https%3A%2F%2Fgithub.com%2Fzsh-users%2Fzsh-completions.git%20%5C%0A%20%20%20%20%20%20%20%20%20%20~%2F.oh-my-zsh%2Fcustom%2Fplugins%2Fzsh-completions%0A%23%20Plugin%3A%20zsh-syntax-highlighting%0Agit%20clone%20https%3A%2F%2Fgithub.com%2Fzsh-users%2Fzsh-syntax-highlighting.git%20%5C%0A%20%20%20%20%20%20%20%20%20%20~%2F.oh-my-zsh%2Fcustom%2Fplugins%2Fzsh-syntax-highlighting%0A%23%20Plugin%3A%20zsh-autosuggestions%0Agit%20clone%20https%3A%2F%2Fgithub.com%2Fzsh-users%2Fzsh-autosuggestions.git%20%5C%0A%20%20%20%20%20%20%20%20%20%20~%2F.oh-my-zsh%2Fcustom%2Fplugins%2Fzsh-autosuggestions%0A%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3CLI%3E%3CP%3EInstall%20themes%20for%20oh-my-zsh.%20It's%20totally%20up%20to%20you%20which%20theme%20you're%20going%20to%20pick%2C%20but%20this%20post%20chooses%20either%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fspaceship-prompt%2Fspaceship-prompt%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ESpaceship%3C%2FA%3E%20or%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fromkatv%2Fpowerlevel10k%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EPowerlevel10k%3C%2FA%3E.%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3E%23%20Theme%3A%20Spaceship%0Agit%20clone%20https%3A%2F%2Fgithub.com%2Fspaceship-prompt%2Fspaceship-prompt.git%20%5C%0A%20%20%20%20%20%20%20%20%20%20~%2F.oh-my-zsh%2Fcustom%2Fthemes%2Fspaceship-prompt%20--depth%3D1%0Aln%20-s%20~%2F.oh-my-zsh%2Fcustom%2Fthemes%2Fspaceship-prompt%2Fspaceship.zsh-theme%20%5C%0A%20%20%20%20%20%20~%2F.oh-my-zsh%2Fcustom%2Fthemes%2Fspaceship.zsh-theme%0A%0A%23%20Theme%3A%20Powerlevel10k%0Agit%20clone%20https%3A%2F%2Fgithub.com%2Fromkatv%2Fpowerlevel10k.git%20%5C%0A%20%20%20%20%20%20%20%20%20%20~%2F.oh-my-zsh%2Fcustom%2Fthemes%2Fpowerlevel10k%20--depth%3D1%0Aln%20-s%20~%2F.oh-my-zsh%2Fcustom%2Fthemes%2Fpowerlevel10k%2Fpowerlevel10k.zsh-theme%20%5C%0A%20%20%20%20%20%20~%2F.oh-my-zsh%2Fcustom%2Fthemes%2Fpowerlevel10k.zsh-theme%0A%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3CLI%3E%3CP%3EIf%20you%20choose%20the%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fromkatv%2Fpowerlevel10k%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EPowerlevel10k%3C%2FA%3E%20theme%2C%20run%20the%20following%20command%20for%20further%20configuration.%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Ep10k%20configure%0A%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3CLI%3E%3CP%3EAs%20mentioned%20above%2C%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcloud-shell%2Foverview%3FWT.mc_id%3Ddotnet-52663-juyoo%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Cloud%20Shell%3C%2FA%3E%20uses%20Bash%20Shell%20by%20default.%20Unfortunately%2C%20you%20can't%20run%20the%3CCODE%3Echsh%20-s%20%24(which%20zsh)%3C%2FCODE%3Ecommand%20because%3CCODE%3Esudo%3C%2FCODE%3Eis%20not%20allowed.%20Therefore%2C%20update%20your%3CCODE%3E.bashrc%3C%2FCODE%3Elike%20below%2C%20as%20a%20workaround.%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Ebash%20-c%20zsh%0A%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3CLI%3E%3CP%3EOnce%20everything%20so%20far%20is%20done%2C%20restart%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcloud-shell%2Foverview%3FWT.mc_id%3Ddotnet-52663-juyoo%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Cloud%20Shell%3C%2FA%3E.%20Alternatively%2C%20run%20the%20command%2C%3CCODE%3Esource%20.bashrc%3C%2FCODE%3E.%20Then%2C%20you%20will%20have%20the%20oh-my-zsh%20applied%20shell%20prompt.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3EIf%20you%20want%20to%20run%20all%20steps%20above%20in%20just%20one%20command%2C%20run%20the%20following%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3E%23%20Download%20the%20GitHub%20repository%0Agit%20clone%20https%3A%2F%2Fgithub.com%2Fjustinyoo%2Foh-my-azure-cloud-shell.git%20~%2Foh-my-azure-cloud-shell%0A%0A%23%20Install%20oh-my-zsh%20with%20the%20theme%20of%20%22Spaceship%22%0A~%2Foh-my-azure-cloud-shell%2Finstall.sh%20-t%20spaceship%0A%0A%23%20Install%20oh-my-zsh%20with%20the%20theme%20of%20%22Powerlevel10k%22%0A~%2Foh-my-azure-cloud-shell%2Finstall.sh%20-t%20p10k%0A%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3CLI%3E%3CP%3EIf%20you%20are%20with%20the%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fromkatv%2Fpowerlevel10k%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EPowerlevel10k%3C%2FA%3E%20theme%20and%20want%20to%20turn%20on%20or%20off%20the%20current%20time%2C%20run%20the%20following%20script%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3E%23%20Turn%20on%20the%20clock%20feature%0A~%2Foh-my-azure-cloud-shell%2Fswitch-p10k-clock.sh%20-c%0A%0A%23%20Turn%20off%20the%20clock%20feature%0A~%2Foh-my-azure-cloud-shell%2Fswitch-p10k-clock.sh%0A%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%2C%20your%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcloud-shell%2Foverview%3FWT.mc_id%3Ddotnet-52663-juyoo%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Cloud%20Shell%3C%2FA%3E%20starts%20using%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eoh-my-zsh%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22for-oh-my-posh%22%20id%3D%22toc-hId--1473786796%22%20id%3D%22toc-hId--1470809777%22%3EFor%20oh-my-posh%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet's%20configure%20%3CA%20href%3D%22https%3A%2F%2Fohmyposh.dev%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Eoh-my-posh%3C%2FA%3E%20on%20your%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcloud-shell%2Foverview%3FWT.mc_id%3Ddotnet-52663-juyoo%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Cloud%20Shell%3C%2FA%3E%20this%20time.%20Make%20sure%20that%20you%20see%20the%20PowerShell%20prompt.%20If%20not%2C%20enter%20the%3CCODE%3Epwsh%3C%2FCODE%3Ecommand%20to%20switch%20your%20prompt%20to%20PowerShell.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CP%3EInstall%20oh-my-posh.%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EInstall-Module%20oh-my-posh%20-Scope%20CurrentUser%20-Repository%20PSGallery%20-Force%0AImport-Module%20oh-my-posh%20-Scope%20Local%20-Force%0A%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3CLI%3E%3CP%3EInstall%20themes%20for%20oh-my-posh.%20Again%2C%20it's%20totally%20up%20to%20you%20which%20theme%20you're%20going%20to%20pick%2C%20but%20this%20post%20chooses%20either%20%3CA%20href%3D%22https%3A%2F%2Fohmyposh.dev%2Fdocs%2Fthemes%23spaceship%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3ESpaceship%3C%2FA%3E%20or%20%3CA%20href%3D%22https%3A%2F%2Fohmyposh.dev%2Fdocs%2Fthemes%23powerlevel10k_rainbow%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EPowerlevel10k%20-%20Rainbow%3C%2FA%3E.%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%23%20Theme%3A%20Spaceship%0ASet-PoshPrompt%20-Theme%20spaceship%0A%0A%23%20Theme%3A%20Powerlevel10k%20-%20Rainbow%0ASet-PoshPrompt%20-Theme%20powerlevel10k_rainbow%0A%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3CLI%3E%3CP%3EInstall%20plug-ins%20for%20oh-my-posh%2C%20like%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fdevblackops%2FTerminal-Icons%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ETerminal%20Icons%3C%2FA%3E.%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3EInstall-Module%20Terminal-Icons%20-Scope%20CurrentUser%20-Repository%20PSGallery%20-Force%0AImport-Module%20Terminal-Icons%20-Scope%20Local%20-Force%0A%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3CLI%3E%3CP%3ECreate%20the%3CCODE%3E%24PROFILE%3C%2FCODE%3Efile%20to%20run%20when%20initiating%20a%20PowerShell%20session.%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3Eif%20(!(Test-Path%20-Path%20%24PROFILE))%20%7B%0A%20%20%20%20New-Item%20-ItemType%20File%20-Path%20%24PROFILE%20-Force%0A%7D%0A%0A%23%20Theme%3A%20Spaceship%0AWrite-Output%20%22%0ASet-PoshPrompt%20-Theme%20spaceship%0AImport-Module%20Terminal-Icons%20-Scope%20Local%20-Force%0A%22%20%7C%20Out-File%20-FilePath%20%24PROFILE%20-Encoding%20UTF8%20-Append%20-Force%0A%0A%23%20Theme%3A%20Powerlevel10k%20-%20Rainbow%0AWrite-Output%20%22%0ASet-PoshPrompt%20-Theme%20powerlevel10k_rainbow%0AImport-Module%20Terminal-Icons%20-Scope%20Local%20-Force%0A%22%20%7C%20Out-File%20-FilePath%20%24PROFILE%20-Encoding%20UTF8%20-Append%20-Force%0A%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3CLI%3E%3CP%3ERun%20the%20following%20command%20to%20reload%3CCODE%3E%24PROFILE%3C%2FCODE%3E.%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E.%20%24PROFILE%0A%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3CLI%3E%3CP%3EIf%20you%20want%20to%20run%20all%20steps%20above%20in%20just%20one%20command%2C%20run%20the%20following%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%23%20Download%20the%20GitHub%20repository%0Agit%20clone%20https%3A%2F%2Fgithub.com%2Fjustinyoo%2Foh-my-azure-cloud-shell.git%20%60%0A%20%20%20%20%20%20%20%20%20%20~%2Foh-my-azure-cloud-shell%0A%0A%23%20Install%20oh-my-zsh%20with%20the%20theme%20of%20%22Spaceship%22%0A~%2Foh-my-azure-cloud-shell%2Finstall.ps1%20-Theme%20spaceship%0A%0A%23%20Install%20oh-my-zsh%20with%20the%20theme%20of%20%22Powerlevel10k%20-%20Rainbow%22%0A~%2Foh-my-azure-cloud-shell%2Finstall.ps1%20-Theme%20p10k%0A%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3CLI%3E%3CP%3EIf%20you%20are%20with%20the%20%3CA%20href%3D%22https%3A%2F%2Fohmyposh.dev%2Fdocs%2Fthemes%23powerlevel10k_rainbow%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EPowerlevel10k%20-%20Rainbow%3C%2FA%3E%20theme%20and%20want%20to%20turn%20on%20or%20off%20the%20current%20time%2C%20run%20the%20following%20script%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3E%23%20Turn%20on%20the%20clock%20feature%0A~%2Foh-my-azure-cloud-shell%2Fswitch-p10k-clock.ps1%20-WithClock%0A%0A%23%20Turn%20off%20the%20clock%20feature%0A~%2Foh-my-azure-cloud-shell%2Fswitch-p10k-clock.ps1%0A%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%2C%20your%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcloud-shell%2Foverview%3FWT.mc_id%3Ddotnet-52663-juyoo%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Cloud%20Shell%3C%2FA%3E%20starts%20using%20%3CA%20href%3D%22https%3A%2F%2Fohmyposh.dev%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Eoh-my-zsh%3C%2FA%3E.%3C%2FP%3E%0A%3CHR%20%2F%3E%0A%3CP%3ESo%20far%2C%20I've%20walked%20through%20how%20to%20configure%20either%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eoh-my-zsh%3C%2FA%3E%20or%20%3CA%20href%3D%22https%3A%2F%2Fohmyposh.dev%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Eoh-my-posh%3C%2FA%3E%2C%20or%20both.%20With%20both%20configurations%2C%20you%20will%20be%20able%20to%20extend%20your%20local%20shell%20scripting%20experiences%20to%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fcloud-shell%2Foverview%3FWT.mc_id%3Ddotnet-52663-juyoo%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Cloud%20Shell%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22text-align%3A%20center%3B%22%3EThis%20article%20was%20originally%20published%20on%20%3CA%20href%3D%22https%3A%2F%2Fdevkimchi.com%2F2021%2F12%2F22%2Foh-my-azure-cloud-shell%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EDev%20Kimchi%3C%2FA%3E.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-3042284%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22oh-my-azure-cloud-shell-00%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F334962iFB6CCC60B02D6EAB%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22oh-my-azure-cloud-shell-00%22%20alt%3D%22oh-my-azure-cloud-shell-00%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CDIV%3E%0A%3CDIV%3E%3CSPAN%3EIn%20this%20post%2C%20I'm%20going%20to%20introduce%20the%20way%20to%20install%20both%20oh-my-zsh%20and%20oh-my-posh%20onto%20Azure%20Cloud%20Shell.%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3042284%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDevOps%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Co-Authors
Version history
Last update:
‎Dec 22 2021 04:00 PM
Updated by: