When a command is not available in the Azure terminal (Azure Cloud Shell), it is usually because the required tool is not installed in the current environment, you are using the wrong shell (Bash vs. PowerShell), or the executable is not in the system's PATH. To fix this, first verify you are in the correct shell for the command, then install the missing module or tool using the built-in package managers.
What You'll Need
- An active Azure account.
- Access to the Azure Portal.
- The specific name of the command that is failing.
Step-by-Step
- Verify the Shell Environment
Azure Cloud Shell offers two environments: Bash and PowerShell. Many commands are specific to one or the other. Look at the top-left corner of the terminal window. If it says "Bash" but you are trying to run a PowerShell cmdlet (like
Get-AzVM), click the dropdown menu and switch to PowerShell. Conversely, if you are running a Linux-based command (likelsorgrep) and the shell is set to PowerShell, switch to Bash. Note that labels may differ slightly depending on the portal version or region. - Check for Typos and Case Sensitivity
Bash is case-sensitive, meaning
Azureandazureare treated as different commands. Ensure the command is spelled exactly as listed in the official documentation. If you are using PowerShell, case sensitivity is generally not an issue, but spelling must be exact. - Install Missing Azure PowerShell Modules
If you are in PowerShell and a
Azcommand is missing, you may need to install or update the module. Use the following command to install the required module:Install-Module -Name Az -AllowClobber -Scope CurrentUser. After installation, restart the terminal session to ensure the changes take effect. - Install Missing Tools in Bash
If a tool is missing in the Bash environment, check if it can be installed via the package manager. While Cloud Shell is a managed environment with limited root access, some tools can be installed to the user directory. For example, if you need a specific CLI tool, you can often download the binary and move it to
~/bin. - Update the System PATH
If you have installed a tool but the terminal still says "command not found," the directory containing the tool is likely not in your PATH variable. For Bash, you can add a directory to your path by running:
export PATH=$PATH:/home/username/bin(replacing the path with the actual location of your tool). To make this permanent, add that line to your.bashrcfile. - Refresh the Session
Sometimes the terminal environment does not register new installations immediately. Click the "Restart" icon (the power symbol) in the Cloud Shell toolbar or close the browser tab and reopen the terminal to force a fresh session load.
Common Mistakes
- Using Local Commands in Cloud Shell: Attempting to run a command that you have installed on your physical laptop/PC inside the Azure Cloud Shell. Cloud Shell is a separate container in the cloud; it does not have access to your local machine's software.
- Confusing Azure CLI with Azure PowerShell: Azure CLI commands start with
az(e.g.,az group list), while Azure PowerShell commands usually follow a Verb-Noun format (e.g.,Get-AzResourceGroup). Running anazcommand in a shell where the CLI isn't configured, or a PowerShell cmdlet in Bash, will result in a "not available" error. - Ignoring Versioning: Using a command from an old tutorial that has been deprecated or renamed in newer versions of the Azure CLI or PowerShell modules.
Tips
- Use Tab Completion: Start typing the first few letters of a command and press the
Tabkey. If the terminal doesn't autocomplete the command, it is a strong sign that the command is not installed or available in that environment. - Use the Help Flag: If a command is available but not working as expected, use
--help(for Azure CLI) orGet-Help(for PowerShell) to verify the correct syntax. - Check the Cloud Shell Documentation: Refer to the official Azure documentation to see which tools are pre-installed in the Cloud Shell image to avoid unnecessary installation attempts.
Troubleshooting
If the command is still not available after following the steps above, try these solutions in order:
- Sign Out and Back In: Sign out of the Azure Portal entirely and sign back in. This refreshes your authentication tokens and session permissions.
- Reset Cloud Shell Storage: If your home directory is corrupted, it can cause path issues. Warning: Resetting your storage will delete files saved in your Cloud Shell home directory. To do this, go to the Azure Portal, search for "Cloud Shell," and look for the option to reset or delete the associated storage account/file share.
- Check Service Health: Visit the Azure Service Health dashboard to ensure there are no regional outages affecting the Cloud Shell service in your specific area.
- Try a Different Browser: Occasionally, browser extensions or cache issues can interfere with the terminal's ability to load the environment correctly. Try an Incognito/Private window.
Frequently Asked Questions
Why does the command work on my computer but not in Azure Cloud Shell?
Azure Cloud Shell is a hosted container with its own pre-installed set of tools. It does not share the software, paths, or configurations of your local operating system.
Can I install any software I want in the Azure terminal?
No. You do not have root/sudo access to the underlying container. You can only install tools that can reside in your user home directory or use official package managers provided by the environment.
What is the difference between Bash and PowerShell in Azure?
Bash is a Unix-based shell used primarily for Linux commands and the Azure CLI. PowerShell is a task automation framework from Microsoft used for .NET-based cmdlets and the Az module.
How do I know which shell I am currently using?
Look at the dropdown menu in the top-left corner of the terminal window; it will explicitly display either "Bash" or "PowerShell."
Do I need to install the Azure CLI separately in Cloud Shell?
No, the Azure CLI (the az command) is pre-installed and pre-authenticated in both the Bash and PowerShell environments of the Azure Cloud Shell.