The Custom Script Extension downloads and executes scripts on Azure virtual machines. This extension is useful for post-deployment configuration, software installation, or any other configuration or management tasks. Scripts can be downloaded from Azure storage or GitHub, or provided to the Azure portal at extension run time. The Custom Script Extension integrates with Azure Resource Manager templates and can be run using the Azure CLI, PowerShell, Azure portal, or the Azure Virtual Machine REST API.
The extension's status can be found by running the PowerShell cmdlet:
Get-AzVM -ResourceGroupName $RGName -Name $vmName -Status
or the CLI command:
az vm extension show -g <RG Name> --vm-name <VM Name> --name <Extension Name>
or in the Azure portal, by browsing to the VM Blade / Settings / Extensions. You can then click on the extension and check its status and message.
Remove-AzVMExtension -ResourceGroupName $RGName -VMName $vmName -Name "myCustomScriptExtension"
Once the extension has been removed, the template can be re-executed to run the scripts on the VM.