Without a lot of experience within Azure, I’m going to “assume” that the CLI has the same benefits that the AWS CLI has and that is SPEED. Clicking through a bunch of screens is slow. I know that synching data through the UI versus CLI to S3 in AWS is insanely different. I avoid looking at the UI if at all possible, except when learning and figuring out what is possible.
Installing the CLI is just like installing anything else; you simply download and install it. You do have to setup credentials to access your Azure account. Oh yeah, this assumes that you created an Azure account! You can actually learn A LOT at Microsoft Learn. It’s almost like they’re making it really easy to learn their platform to gain market share from some other Seattle based cloud provider. A lot of their services seem eerily similar too :) Some of their training modules even launch sandboxes, which is a great way to get free hands-on experience.
If you haven’t logged in through the CLI before it’s as simple as:
az login
The first time I did this it popped open a tab in my browser and automatically authenticated me! I was already logged in though; it might ask you for a username and password. I think that I already forgot my password, so it worked out for me in this case. Not normally the case.
A lot of the responses to commands return json, which is only kind of easy to read. There are a lot of times where I just want a summarized list of items and to do this you just add a “–output table” to the command. So you can try running both:
az account list
az account list --output table
And just view the differences in output. If you noticed, this command checks what Azure subscriptions you have available.
If you ever need to list all the resource groups in a subscription, then you’ll run the az group list command.
az group list --output table
For a list of resources within a resource group run:
az resource list \
--resource-group [resource group name] --output table
For a list of resources of a certain type within a resource group run:
az resource list \
--resource-group [resource group name] \
--resource-type Microsoft.Web/sites
This is really a good start to begin with. You can just about do anything. If you have a web app you can start and stop it, etc:
az webapp stop \
--resource-group [resource group name] \
--name <web app name>
az webapp start \
--resource-group [resource group name] \
--name <web app name>
Here is the official Azure Command-Line Interface (CLI) documentation.
Definitely, going through the free training available at Microsoft Learn is incredibly useful. As always, stay inb8a!