the next door (so called) geek @rakkimk | your next door geek | friend | blogs mostly on technology, and gadgets.

Auto Install IIS in the Microsoft Azure VM that you are creating

The world is moving fast, actually faster! You too want to do things faster, right? Why wait until the VM is created, provisioned, available over RDP, login, etc to do a few initial stuff. Of course, you can upload your custom VM image, and bring up a Virtual Machine from the image, but few times you may also want to do it afresh.

In TechEd 2014, Scott announced a lot of updates to Microsoft Azure. One of my favorite is the ability to run custom scripts on VM creation. Yeah, it’s more like your startup scripts that you are used to, but trust me, you will save a lot of times in doing a few repetitive things that you might want to do with your deployments.

To do this, first write a simple powershell script to install the IIS role (along with what all features you might want to have), and save it as a ps1 file in the local disk, or you can upload to your Azure Storage, and pull it from there. The later step is better, so that you don’t need to rely on the local disk to have your scripts repository.

In my case, I just had the below command in my install.ps1 script file:

Add-WindowsFeature Web-Server –IncludeAllSubFeature

This installs all the sub features under the Web-Server. Security Statement : You should choose to install only those that you need, so that you reduce the surface area for the updates/attacks. Now, using this script is just simple from the Portal. You can choose to install the VM agent first, and then choose the “Custom Script” option, and choose the file that has the installation scripts. Here, you can be fancy. You can do all your other configuration stuff like opening firewall ports, changing website path, etc. It’s your VM. You own it!

image

Hope this helps! I’ll try to work on a few useful powershell scripts for your web-server scenario, and post it later. Keep coming!

Microsoft Azure. Rock on.

Add comment

biuquote
  • Comment
  • Preview
Loading