Show
The Azure CLI is a cross-platform, open-source command-line tool that we may use to build and manage resources in the Azure Portal. This application allows us to issue commands and manage Azure resources directly from the Windows command prompt. Since this application is cross-platform, users can easily install it on Windows, Linux, or Mac OS X. In this blog we will learn about Azure CLI in the following order:
Check out this YouTube video to learn more about Azure: Azure CLI OverviewMicrosoft Azure CLI is a cross-platform command-line tool for managing and administering Microsoft Azure. It doesn’t replace PowerShell, but it does provide an alternative to using the command line to manage Azure. The program allows you to use the terminal to query, create, and administer cloud resources. It is available on a variety of platforms, including Windows, macOS, Linux, and, most recently, a web browser. Users may use this platform to automate a variety of operations in the Azure portal, such as creating or deleting Azure resources including Virtual Machines or backing up SQL Databases. The Azure CLI can also be accessed using a web browser, otherwise known as the cloud shell. After logging into the Azure portal from any browser, the user can access the cloud shell. Both the CLI and the cloud shell have the same set of commands. What can Azure CLI do?Azure CLI provides an alternate method of accessing the various Azure resources through commands rather than clicking on the UI elements. This can prove to be essential for users in automating the tasks. It can do all the tasks that can be done through the portal including:
Click and be ready for the Industry with Microsoft Azure Certification Training with Intellipaat! Using Azure CLI without InstallingOne of the best features of this cross platform is its ability to be run on a web browser. So users don’t really need to install it on their devices. Just opening the browser and typing in https://shell.azure.com/ will land you right into Azure CLI. Itcan also be accessed from the Microsoft Azure mobile app. After logging in using the Azure account in the app, users can click on cloud shell to launch the CLI. How to Install Azure CLI?This CLI is available on a variety of platforms, including macOS, Linux, and Docker containers. Azure CLI being cross-platform has the huge advantage of collaboration with users who are accustomed to different platforms. The user can install CLI on the OS of his/her own choice. How to Install Azure CLI on WindowsYou can download Azure CLI on Windows in two ways – using a standard Windows MSI installer or through Windows PowerShell. Using MSI Installer
Earlier versions required the users to install python before installing CLI but newer versions do it themselves if python is not already installed. Using PowerShell Windows PowerShell can be used to download and install the Azure CLKi MSi.
Running this command downloads the CLI installer and installs it. If you have it already installed, this command updates it.
You can also install it via PowerShell using the chocolatey package manager as well. Assuming you have already installed chocolatey, use the command choco install azure-cli. Installing Azure CLI on MacOSUsing the Homebrew package management system is the easiest way to install Azure CLI on MacOS.
If this returns an error about python not being installed, use brew install python 3 to first install python and brew upgrade python3 && brew link –overwrite python3 to overwrite existing python with the newer version. Click here to know various aspects of Azure with the Azure tutorial! Get 100% Hike! Master Most in Demand Skills Now ! Installing Azure CLI on LinuxNow it is available for various Linux distributions as well. On Ubuntu Installation on Ubuntu is very easy with a single line of command. curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bashRunning this command on Terminal will download a Microsoft script and execute all the necessary actions to install this interface on Ubuntu. On CentOS or Fedora
sudo dnf install azure-cli Using Azure Command Line InterfaceAfter installing it on the machine of your choice, the rest is consistent among all the different operating systems. This consistency is what makes this cross-platform really useful. As already mentioned It can be used for executing all the tasks that are usually done through the Azure portal. Preparing for Azure Interview? Check our Top 50 Azure Interview Questionsnow! Interactive ModeYou can use the –help command to know more about the platform. Using –help or the shorthand -h after any command gives you the information about what you can do with the command. But there is also an interactive mode that can be invoked using the command: az interactiveYou may get basic help for the Azure CLI commands and arguments you’re using, and IntelliSense will even show you examples as you construct your command. It’s an excellent approach, to begin. Azure LoginThe first thing to do before using the various commands that CLI provides would be to log in. az loginRunning this command invokes the browser and from there the user has to input the login credentials to the Azure portal. But if you don’t have the flexibility to launch the browser, the following command can be used to log in with an alternate authentication mechanism known as device code flow. az login --use-device-codeThe log in as a service principle can also be used with the following command for authentication. az login --service-principal -u -p -tThis is particularly useful when automating the processes for DevOps pipelines or unattended tasks. If you have a docker container, a virtual machine, or an app service that has an Azure identity, this can be used to login with managed identity. az login --identityTenants and SubscriptionThe hierarchy in Azure is each tenant tied to an Azure Active Directory and the various subscriptions come under the tenants. The following command can be used to see the various subscriptions attached to your account. az account listLike every other command, the following can be used to identify how to manage the subscriptions. az account -hCreating a Resource GroupCreating a resource group is quite easy using the command az group create. az group create --location northeurope --resource-group Rsrcgrouptest --verboseThis command creates a resource group with the name Rsrcgrouptest in the location North Europe and will return all verbose output. QueryingRunning certain commands will frequently give us large JSON files like the command for showing subscriptions. It Supports the use of query input flags that can allow the basic filtering of the incoming JSON files. az ad sp list --query "[].appDisplayName"Running this command will display the app display name property of all apps in our subscription. Debuggingaz group list --debug --verboseThis command scrolls a lot of text, but it clearly reveals the REST URL to which a request was made within that content. It displays the request’s data as well as the response received. All you have to do now is copy and paste that URL into your app, verify that it has a valid access token and the required permissions, then execute the identical REST call that Azure CLI demonstrated ConclusionThese sets of commands make the experience of using the resources that Azure provides much snappier. Typing through the various commands makes it easier and faster for automating for the purpose of use in DevOps pipelines or for unattended processes. This was just a basic introduction to the service, Azure CLi in itself is very vast and is an extremely useful tool for managing the Azure resources. If you are having any doubts. You can resolve your Azure Queries on Intellipaat’s Azure community! Can Azure cloud shell be accessed from a Web browser on a Linux computer?Answer is Yes. Azure PowerShell is available for Windows, Linux, and Mac, Chrome OS and can be accessed in a web browser via the Cloud Shell. An Azure administrator plans to run a PowerShell script that creates Azure resources. You need to recommend which computer configuration to use to run the script.
Does Azure cloud shell run on Linux?Azure Cloud Shell runs on Common Base Linux - Mariner (CBL-Mariner), Microsoft's Linux distribution for cloud-infrastructure-edge products and services.
How do I access Azure cloud shell?Direct link: Open a browser to https://shell.azure.com.. Azure portal: Select the Cloud Shell icon on the Azure portal:. Code snippets: In Microsoft technical documentation and training resources, select the Try It button that appears with Azure CLI and Azure PowerShell code snippets: Azure CLI Copy. Try It. az account show.. Can Azure cloud shell run on Chrome OS?Cloud Shell supports the latest versions of Microsoft Edge, Microsoft Internet Explorer, Google Chrome, Mozilla Firefox, and Apple Safari. Safari in private mode is not supported.
|