Deploying a template using CLI

- [Narrator] We can also deploy templatesusing the command line interface.We're going to go ahead and create another resource groupwith our virtual machine and networkingusing the command line interface.We're going to call it SimpleVMRev5.I know, not very creative.I'm going to go back to our exercise files folder,and we happen to be in chapter 01_05,and you'll notice here that I have a text document,and I have our json template.

As before I have copied over the json template,but in this case I have actuallymade some changes to the parameters.You could use a separate parametersfile if you wish to do so.In this case, I've opted to keep it simple,and edit the parameters within the template file.One thing you'll notice here though,I do have to provide a password.So I am providing our super secret password.Everything else has been modified to include rev five.

If you'll notice here, we have rev five and SG, rev five IP.We're keeping simple network the samebecause it will be deployed to a different resource group.I'm going to go ahead and save that and make sure it's okay.And go ahead and close down Visual Studio.Next we're going to go ahead and open up the Notepad file.You will see from our Notepad file,this is a very simple setup.We're going to log into Azure.We're going to set our subscriptionbased on our subscription ID.We're going to go ahead and create a new resource groupcalled SimpleVMRev5, and then we're going to go aheadand actually deploy the template itself,with the exception of I need to changemy resource group to match my name.

And I'm specifying my template file,and in this case, I actually have an error here,because I'm pointing it to the wrong folder.So I'm glad I caught that.There we are.Now I'm going to go ahead and launch Command Prompt.Yup, good old Command Prompt, nothing fancy here,and I am going to run it as admin.I'm going to right click, run as admin.If you happen to receive a dialog box askingare you really sure you want to run as administrator,go ahead and click yes.

And then I'm just going to simply enter in the commands.Some of these I'm going to type,some of them I'm going to copy paste.You may encounter this issuewhen you log in using the command line interface.If you see this what you will do is open up the webpage,aka.msdevicelogin, and then you're going to enterin the code that is provided to you.So in another browser,I'm going to go ahead and enter this information.So this is the page I'm directed to.

You'll have to enter in your code,and then we can go ahead, click continue.We can see we already signed in.I'm going to go ahead, click on my account.I'm already signed in,so now I should be able to close this window,and we can see that we are now logged invia the command line interface.The next thing I need to do is set my subscription,and to do that I'm going to go ahead and just copy everything.

Go ahead click enter.We can see that the account has nowbeen set to pay as you go.Our next step is to go ahead and create that resource group.We're going to do it in the East US again,and I'm just going to do a copy paste here.The command is Azure group createour SimpleVMRev5 in the east US.Perfect, it is now created, and we can continue on.

And finally, our last command, and I'm just going to copyand paste it and we'll step through it once it's pasted.The command is Azure group deployment create.We're going to create it within this resource groupas SimpleVMRev5, the one we just createdthat will provide the path to our template file.So this is on our desktop in the exercise filesin chapter 01_05 and it's the template, the json file.Go ahead hit enter, and then this will takeseveral minutes to create as well.

So this would be a great time to go grab a cup of coffee.After several minutes, we can see that the templatedeployed to Azure, and one thing I want to point out hereis you'll notice that incremental was the mode.Remember that incremental is the defaultmode when deploying templates.Let's go ahead, pop into Azure, and take a look at this.I'm going to go ahead and refresh,and then we should see SimpleVMRev5, and there we are.I also want to point out that you'll notice thatanother resource group has been created here,and this has to do with an existing storage groupthat I do have sitting in the background.

So every so often you'll see this pop in.Nothing to worry about.Let's drill into SimpleVMRev5, and as before, we have allof our resources within that resource group ready to go.As you can see, whether or not you use PowerShell,command line, or even the rest API for you developersout there, the process is very similar, and simpler,to create custom templates to redeployyour resources over and over again.

Resume Transcript Auto-Scroll

Author

Released

4/11/2017

Gain the skills you need to design easy-to-use, reliable Azure Resource Manager templates. In this course, instructor Sharon Bennett dives into Azure templates and securing Azure resources. She explains how to implement Azure Resource Manager templates, control access to your resources, and design Role-Based Access Control (RBAC). As this is an intermediate-level course, an understanding of the Azure platform and the Azure Resource Manager portal is required. This course is also an exam preparation resource for the 70-533 exam: Implementing Microsoft Azure Infrastructure Solutions.