ARM JSON: Azure VM with IIS pre-installed.

In one of our previous post we saw how to install IIS while you are setting up the Virtual Machine in Azure. We will repeat the same stuff here but this time doing it through Azure ARM Json templates.

As again this post isn’t about how to setup Virtual Machine in Azure so we will focus on the Azure VM Extension however some background is important so here’s some screenshot. Additionally we would not go in best practices on how to setup Virtual Machine.

Parameters: Some basic parameters set up for Virtual Machine.

azuredeploy.json: let’s quickly see some of the parameters, variables and resources that we have setup in azuredeploy.json




Finally we have reached to state where we can talk about Azure Virtual Machines Extension.

let’s first understand all the arguments that we have used for Azure VM Extension.

a. Type: We have to specific what type of resource it’s going to be

b. apiversion: The Azure apiversion we are going to use, there are many and no reason you should choose the one that i have added here.

c. name: (Very Important) Because the extension resource is a child resource of the virtual machine object, the name must have the virtual machine name prefix.

d. location: Where you have your resource.

e. dependsOn: Since the actual VM should be available before you roll out the extension we have a dependency here.

f. Properties: Within properties section you have few properties to add.

Publisher: The VMImage Publisher, there are about 1291 publishers in Azure as of writing this blog, we need to focus on Microsoft.Compute publisher.

Type: With type we intend to say what type of extension we want to use, the other types are BGInfo, JsonADDDomainExtension, VMAccessAgent, in this blog we are selecting CustomScriptExtension.

TypeHandlerVersion: Every type will have a version associated with it, so you need to choose the right version, but how would i know which version to select, which type, version is available in which region, so the easiest way is to use the PowerShell

As much as everything is needed to get it working but the actual magic happens at “Settings”, this is where you specific what do you want to run.

Final Result:

Web server running on port 80 on Virtual Machine.

Template is available here: I have removed password from the template, i just don’t want people to know how bad i am with passwords, but hey it’s about quickly showing people how to do things.

1 comment on ARM JSON: Azure VM with IIS pre-installed.

Leave a Reply

Your email address will not be published. Required fields are marked *