The Azure command-line interface (CLI) is Microsoft's cross-platform command-line experience for managing Azure resources. The Azure CLI is designed to be easy to learn and get started with, but powerful enough to be a great tool for building custom automation to use Azure resources.
The Azure CLI is available to install in Windows, macOS and Linux environments. It can also be run in a Docker container and Azure Cloud Shell.
To install Azure CLI in PowerShell is super easy. Just execute:
Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'
And you can just use it directly.
But if you execute az
in git-bash, it will tell you that az
can not be found. It was because az
is a file named az.cmd so bash doesn't treat as a command in bash.
So how can we use az and write az shell in bash?
After installing the Azure CLI, open a new bash instance with admin privilege.
And execute the following command:
echo \"C:\\Program Files \(x86\)\\Microsoft SDKs\\Azure\\CLI2\\wbin\\az.cmd\" \$1 \$2 \$3 \$4 \$5 \$6 \$7 \$8 \$9 \${10} \${11} \${12} \${13} \${14} \${15} > "$SYSTEMROOT\az"
That will create a new bash executable file named az under your system root.
Now try to execute az command in bash.
The blog post provides a detailed explanation on how to install Azure CLI on Windows 10 and use it in bash. The author starts by introducing the Azure command-line interface (CLI) as a cross-platform command-line experience for managing Azure resources. They highlight its easy-to-learn nature and powerful automation capabilities.
The author then explains that the Azure CLI is available to install in Windows, macOS, and Linux environments, as well as in a Docker container and Azure Cloud Shell. They provide a step-by-step guide on how to install the Azure CLI in PowerShell, including a screenshot of the process.
One issue that the author addresses is the inability to execute the 'az' command in git-bash due to it being a file named az.cmd. To resolve this, they provide a solution on how to create a new bash executable file named 'az' under the system root. The author also includes screenshots to demonstrate the successful execution of the 'az' command in bash.
Overall, the blog post is well-written and informative. The step-by-step guide is easy to follow and the inclusion of screenshots is helpful for readers. The author's effort to address a common issue and provide a solution is commendable.
However, there are a few areas that could be improved. Firstly, the author could provide more context on why someone might want to use Azure CLI in bash, especially for readers who are new to Azure or bash. Additionally, it would be beneficial to include some examples of Azure CLI commands to give readers a better understanding of its capabilities and use cases. Lastly, the author could provide external links to the official Azure CLI documentation for readers who want to learn more about the tool.
In conclusion, the blog post is a valuable resource for those looking to install Azure CLI on Windows 10 and use it in bash. With some minor improvements, the post can be even more informative and useful for readers.