Moving beyond the Azure browser portal opens up a lot of options for an Azure administrator. In this video, learn how to craft commands and their associated parameters to manipulate the Azure infrastructure.
- [Instructor] We're ready now to take a look at the Azure CLI and the question I want to answer for you is, well, why use this? Why use a command line interface when you can just go to the portal, you can click around, and it's real simple and easy, and it shows you exactly what you're going to do? Well, let me tell you the benefits of the Azure CLI. First, it's easy to learn and it's easy to use. Microsoft started this because they needed a transition between PowerShell, which is a bit complicated, and the portal, which doesn't serve you well for some of the things that you're going to need to do in Microsoft Azure. So they developed this because it's easy to learn and easy to use. This works with Apple, it works with Linux, works with Windows, and works on the web, and that's the one that I'm going to show you through something called the Cloud Shell. So you can install this on Apple, Linux, and Windows, and use it. You can't do that with some of the PowerShell and some of the other tools that you have with Microsoft Azure. We have repeatable commands, and this is the core of using the Azure CLI. If you're going to use the portal and you're going to say, create 16 virtual machines, well, you're going to have to go in there 16 times and you're going to have to answer the same question over and over and over if you're going to use that and 16 VMs, 16 times. With this, and you're going to see this, you can just go to the same command, make one change to an argument, and then hit Return. And you can do that repeating it 16 times. It's going to be a lot easier for you. That is the core of using the Azure CLI as opposed to the portal. This has a brief and concise syntax and I want to show you that syntax right now. This is it. Now, you're not going to type in X's here. Keep that in mind. I'm just using those for placeholders so you can understand. Let's start with az. This is the focus, and this is going to be az for pretty much all you use. You can guess it, az stands for Azure. Secondly, we have the group, and what this group is going to do is tell you the resource, or rather tell Azure the resource that you're going to want to work on. Now the subgroup, not all commands are going to have a subgroup. Let me explain this. If you have a virtual machine, maybe you want to work on the disks on that virtual machine. The group would the be the VM, the subgroup would be the disks. And then we have the base command. Think of this. You have create, you have delete, you have show, you have list. That is the base command of what you want to do to the group of or the subgroup. And then we have the required arguments. Arguments, that is what this nomenclature uses. You can think of that as a parameter, too. It will tell you if you didn't type in a required argument. And then we have the optional arguments. This would be extra things that you want to do to the group or the subgroup. And then we have global arguments. The global arguments are going to be something like what do you want the output to look like. A global argument is just how it sounds. These arguments, or parameters, if you will, are going to be applicable to pretty much any command that you put in there. Now that you understand the syntax, let's go ahead, get inside Microsoft Azure, and I'll show you the Azure CLI. Here we are on the homepage. We're going to come up here and we click on here where it says Cloud Shell. And as this is filling in, let me tell you what the Cloud Shell is. It is a way to get into what you're working on, your subscription, your directory, all in the same place. Now, you're going to see this when you first start off. You have no storage mounted. This is a storage group that needs to be created so you can use the Cloud Shell. So just click Create Storage. So that's a look at the Azure CLI in Microsoft Azure.
- Customizing the Azure portal
- Creating and deploying resources
- Using the Azure CLI
- Deploying and configuring resources with the CLI
- Deploying and configuring resources with PowerShell
- Deploying resources with JSON templates