DEMO: Deploying IIS with Custom Script Extension
Start course

This course offers an in-depth look at VM scale sets, VM configuration management, VM storage options, and VM monitoring within Azure. We kick things off by looking at VM scale sets, vertical scaling, and horizontal scaling.

After that, you'll learn about the tools used for configuration management, as well as how to deploy software using VM extensions and how to deploy an Azure PowerShell DSC Configuration.

The course will then cover the wide range of VM storage options available in Microsoft Azure and show you how to use them. Finally, you'll learn about Azure Monitor, a service that allows you to monitor the performance and health of your VMs and VM scale sets.

This course is packed full of step-by-step demonstrations that you can follow along with, allowing you to see all of the above topics put into practice in real-life Azure environments.

For any feedback relating to this course, please feel free to contact us at

Learning Objectives

  • Scale VMs using scale sets and understand the difference between vertical and horizontal scaling
  • Learn about the tools used for managing VM configurations
  • Deploy software using VM extensions and PowerShell DSC
  • Understand the various VM storage options available in Azure
  • Learn about Azure Monitor and its uses

Intended Audience

  • Anyone interested in learning about scale sets, configuration management, storage, and monitoring for Azure VMs


To get the most from this course you should have a basic understanding of Microsoft Azure and of the Azure portal.


Hello, and welcome back. In this brief demonstration, I'm going to show you how to deploy software using VM extensions. More specifically, the custom script extension. What we're going to do here is install IIS on a virtual machine called VMO1.

So on the screen here, I'm logged into my Azure portal and I'm at the overview page for VMO1, which is a running Windows Server 2016 data center VM. What I'm going to do is grab my RDP session because I am RDPED into the server right now. And we can see if we go into Manage and Remove Roles. That web server or IIS is currently not installed on this VM.

So instead of installing It from within the VM itself. What we're going to do is use a custom script extension to do it for us. So let me minimize this RDP session here. And what we're going to do to begin this installation is first create a PowerShell script, which is a PS1 file. And that PS1 file needs to call the install Windows feature, a PowerShell command.

Now if I drag my PowerShell command in here, I have a script called Enable IIS that I created and this is on my local workstation. And in the PS1 script, I'm calling install Windows feature. And I'm specifying the web server feature with a name flag. And I'm also telling it to include the IIS management tools.

So again, this is a file called Enable IIS and it's a PS1 file or a PowerShell script. So I'll do drag this over here back onto my other screen. What we're going to do is reference that file when we deploy this custom script extension. So to deploy that Enable IIS file to my VMO1 virtual machine and to execute it, what I need to do is click on extensions under Settings.

Now from the extensions blade here, what I need to do to deploy my custom script extension is click add here. And then I can select Custom script extension here from the list in the left pane. So we'll go ahead and select our custom script extension. And what we'll do is we'll create our extension.

Now when we do this, we need to specify the script file, which in this case is the Enable IIS, PS1 file that I created ahead of this lab. And then I can specify any optional arguments. Now my script doesn't need arguments to install IIS, So this field will be left blank. But what we'll do here is we'll select our Enable IIS script here, and we can see that as your uploads it automatically to temporary storage. And it does this so the VM can then pull that script down and execute it.

So we'll go ahead and okay this, and we can see the deployment being submitted and then going into progress. What this custom script extension will do is switch over to transitioning shortly, and eventually it'll move on to provisioning succeeded.

While this is going on, let me drag my VM back over. And we'll refresh here, the Server Manager. And once the script runs, we'll see the IIS service show up here. It's Matter of fact, let me go into manage here and just see if it's showing up yet. We can see web server is now listed as installed. If we cancel out of here and do a refresh, we can see IIS is now installed and running. If we minimize our RDP session, and refresh our extension screen here, we can see that provisioning has succeeded on our VM.

So what our custom script extension did was take the PS1 PowerShell script that I created that calls the install Windows feature, and it uploaded it to temporary storage and Azure, the Windows VM then pulled down that script and executed it. And when it executed it called the install Windows feature and installed the IIS service on the VM.

So that's how you can use the custom script extension to install other applications and Software other than what you get here out of the box from Azure itself. So with that, we'll call it a wrap and I'll see you in the next lesson.

About the Author
Learning Paths

Tom is a 25+ year veteran of the IT industry, having worked in environments as large as 40k seats and as small as 50 seats. Throughout the course of a long an interesting career, he has built an in-depth skillset that spans numerous IT disciplines. Tom has designed and architected small, large, and global IT solutions.

In addition to the Cloud Platform and Infrastructure MCSE certification, Tom also carries several other Microsoft certifications. His ability to see things from a strategic perspective allows Tom to architect solutions that closely align with business needs.

In his spare time, Tom enjoys camping, fishing, and playing poker.