Learn about the PowerShell and Command Line Interface commands to create a resource group, validate, and deploy a template to Azure.
- [Instructor] As we've already discussed, you can deploy as your templates through a variety of sources. In this lesson we're going to focus in on the PowerShell and the command line interface commands. Let's go ahead and start with PowerShell. Before you actually deploy the template, you'll need to create a new resource group. And to do so you will use the Azure commandlet New-AzureRmResourceGroup. You will provide a name for your resource group, mine is the highly descriptive example resource group name. And then you will provide a location.
We're using the West US. Next you may want to validate your deployment settings. And this is totally up to you. When you validate your deployment, your deployment will be tested, but the resources will not be created. I like to validate my deployments on brand new templates. Just to work out all the bugs. The commandlet for this will be Test-AzureRmResourceGroupDeployment, again your resource group name, and then your template file. And finally after you've validated your deployment, you can go ahead and deploy the template.
And keep in mind that it is an incremental update. Therefore if you have resources in your resource group that are not specified in the template, those resources are not deleted. And the commandlets you will use to deploy are New-AzureRmResourceGroupDeployment. I'm providing the name ExampleDeployment. Next you'll provide your resource group name, and you created that in your first step, and finally the location of your template file. And that's it. Now let's see how we do the same thing using the command line interface.
This will be a very similar process. The commands are a little different. First we're going to start off by creating that resource group once again. And to do so we're using the command az group create, and here the syntax is a little different, it'll be --name. And I'm using the highly descriptive example resource group name once again. And as before our location is West US. As before we can go ahead and validate our deployment template, and to do so we'll use the commands az group deployment validate.
Specify your resource group, and then your local template file. And after your validation has passed, we can go ahead and deploy the template. The first thing we need to do is actually create the deployment. And to do so we are using az group deployment create. The name of our deployment again example deployment, the resource name we created in step one, and finally the location of our template. I know using command line in PowerShell can be a little intimidating, but once you get into the swing of it, you will find you can do things much faster and easier in Azure using these tools.
- Designing virtual machines
- Selecting appropriate VM SKUs
- Designing template deployment
- Deploying ARM templates via PowerShell and CLI
- Designing for availability
- Designing Azure Virtual Networks
- Azure VPN and ExpressRoute architecture and design