Articles → MICROSOFT AZURE → Custom Script Extension In Azure

Custom Script Extension In Azure






Purpose





Scenario





Custom Powershell Script




Import-Module ServerManager
Install-WindowsFeature -Name Web-Server -IncludeAllSubFeature -IncludeManagementTools





Create A Storage Account




  1. Create the storage account
  2. Picture showing a new storage account created
    Click to Enlarge

  3. Inside the storage account, create the container
  4. Picture showing a new container inside the storage account
    Click to Enlarge

  5. Inside the container, upload the script
  6. Picture showing the powershell script uploaded inside the container
    Click to Enlarge

Execute Custom Script In Virtual Machine




  1. Go inside the detail screen of the virtual machine
  2. Go to the Extensions
  3. Picture showing the Extensions submenu inside the virtual machine
    Click to Enlarge

  4. Click on the + Add button
  5. Picture showing the screen for adding the extensions in the virtual machine
    Click to Enlarge

  6. In the next window, click on the Custom Script Extension
  7. Picture showing the custom script extension in the list of resources
    Click to Enlarge

  8. A custom script extension screen will come. Click on the Create button
  9. Picture showing the create button for creating the custom extensions
    Click to Enlarge

  10. Another screen will come to select the script file
  11. Picture showing an option to select the file to be executed on the virtual machine
    Click to Enlarge

  12. Click on the Browse button. Once you click on the bottom, you can select the storage account → container → script
  13. Picture showing the accessing the powershell script from the container inside the storage account
    Click to Enlarge

  14. Once the script is selected, you can click on the Ok button
  15. Picture showing the powershell script selected in the custom extension screen
    Click to Enlarge

  16. Once you click on the Ok button, the script will be deployed and start executing
  17. Once the script deployment is completed, you will get the following message

    Picture showing the screen to confirm that deployment is completed
    Click to Enlarge

Output




Picture showing the IIS home screen in the browser of the virtual machine
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, April 20, 2021

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250