Articles → MICROSOFT AZURE → Run A Custom Script From GitHub In The Linux Machine
Run A Custom Script From GitHub In The Linux Machine
GitHub
- Create a new repository myrepo
- Create a new file with the name install_web.sh
- Inside the file install_web.sh, write the following command
apt-get update -y && apt-get upgrade -y
apt-get install -y nginx
- Commit the file install_web.sh
- Get the raw URL of the file
Click to Enlarge
Customscript.Json File
{
"fileUris": [
"https://raw.githubusercontent.com/guptakaran21/myrepo/main/install_web.sh"
],
"commandToExecute": "./install_web.sh"
}
Run Script In The Powershell
- Open the cloud shell in the Azure portal
- In the PowerShell mode, upload the customscript.json
Click to Enlarge
- Inside the PowerShell, execute the following command
az vm extension set --resource-group RG --vm-name myvm --name customScript --publisher Microsoft.Azure.Extensions --settings customscript.json
Click to Enlarge