Badgerati / Fogg

PowerShell tool to aide and simplify the creation, deployment and provisioning of infrastructure in Azure
MIT License
7 stars 2 forks source link

If we had to install the CustomScriptExtension, ensure it's uninstalled post-provision #25

Closed Badgerati closed 7 years ago

Badgerati commented 7 years ago

There's a bug in the CustomScriptExtension where if you have to restart a VM with it, it'll attempt to run the extension again and again.

This could lead to duplicate items, failures because software already installed, or other unexpected behaviour.

The fix here is to uninstall the CustomScriptExtension once provisioning of a VM is complete - but only if we had to originally install the extension.

Useful link: http://www.gi-architects.co.uk/2016/07/custom-script-extension-for-arm-vms-in-azure/

PowerShell to remove extension:

Remove-AzurermVMCustomScriptExtension -ResourceGroupName $RGName -VMName $VMname –Name $ExtName -Force