How to Execute a PowerShell Script on An Azure Virtual Machine with the Custom Script Extension

One of the great things about the cloud is that we ultimately use code for everything from creating new resources to making those resources function a certain way. One of those configuration methods we have in Azure would be the custom script extension. This is a cloud function that will allow us to inject code into our VMs to make them do something or be configured in a certain way.
In todays video we will use the custom script extension to setup an IIS Web server in three ways.

  1. When building a new VM in the Azure Portal,
  2. Updating an existing VM through the Azure Portal
  3. Building a new VM with ARM Templates

Prerequisites include: Azure Subscription

You can download the code for the ARM Template scenario from this public GitHub Repo