Adding Custom Script Extension In Azure Virtual Machine

Introduction

 
In this article we are going to deploy custom script extension for windows. The custom script extension tool can be used on our Azure virtual machines when we want deployment in Windows. These scripts can be located at our storage account.
 
Currently, we have an Azure Virtual Machine with the Windows Server 2016 operating system and the Public IP address in 13.82.7.75.
 
Adding Custom Script Extension In Azure Virtual Machine
 
Step 1
 
Open the PowerShell ISE. We need to enter the Internet Information Service installation Script and then save the script file, in this demo our script file name is “iisscript.ps1”
 
Adding Custom Script Extension In Azure Virtual Machine
 
Step 2
 
Now we are going to create a storage account, so we will choose the correct subscription and the correct resource group, we can provide a name for our storage account “lankascript”, for the location of the storage account it must be in the same location housing as our virtual machine, and then click “Review + Create”.
 
Adding Custom Script Extension In Azure Virtual Machine
 
Step 3
 
After successfully creating the storage account, open the storage account “lankascript”, and then select “Containers”
 
Adding Custom Script Extension In Azure Virtual Machine
 
Step 4
 
In the “lankascript” containers click “+ Container”, enter the name for the container and click create.
 
Adding Custom Script Extension In Azure Virtual Machine
 
Step 5
 
Now we need to upload our Script “iisscript.ps1” file that we have already created in Step 1. Click the browse button, then select the script file and upload it.
 
Adding Custom Script Extension In Azure Virtual Machine
 
Step 6
 
After successfully uploading the Script file, go to the Virtual Machine, select “Extension” and then click “+ Add”.
 
Adding Custom Script Extension In Azure Virtual Machine
 
Step 7
 
Now Select the Custom Script Extension and click the Create button.
 
Adding Custom Script Extension In Azure Virtual Machine
 
Step 8
 
Click the browse button and select the “Storage Account”.
 
Adding Custom Script Extension In Azure Virtual Machine
 
Step 9
 
Select the storage account that we have uploaded the script file. In our demo, we have uploaded the script file into “lankastorage”, so click the correct storage account.
 
Adding Custom Script Extension In Azure Virtual Machine
 
Step 10
 
Select the Script Container
 
Adding Custom Script Extension In Azure Virtual Machine
 
Step 11
 
In the Script Container Select the “iisscript.ps1” file and then click “Select”.
 
Adding Custom Script Extension In Azure Virtual Machine
 
Step 12
 
Now the file is initializing the deployment.
 
Adding Custom Script Extension In Azure Virtual Machine
 
Step 13
 
Now we can verify that the Custom Script Extension status is “Provisioning Succeeded”.
 
Adding Custom Script Extension In Azure Virtual Machine
 
Step 14
 
Copy the Public IP address from the “LankaVM”.
 
Adding Custom Script Extension In Azure Virtual Machine
 
Step 15
 
Past the IP address and press enter, we can get the Internet Information Services Landing Page.
 
Adding Custom Script Extension In Azure Virtual Machine
 

Summary

 
If you haven’t received the Internet Information Services Landing Page, check the Network Security Group, Port 80. In this article we have learned how to deploy custom script extension. If you have any questions feel free to comment under the comment box.