Azure VM extensions



VM extensions allow you to install additional software/features into your VM without having to actually log on to the VM to do that.Whilst looking into it this past week i realised there are a lot more available than i had realised.

If you go to the extensions blade in the portal you see a few listed (see screenshot below) and i had kind of thought that this was it.

These seem to be more commercially focussed or 'bigger' things - there are actually quite a few simple ones also available - but this seems to be only via powershell (not sure why this is the case really - and in fact the reverse seems to be true - the GUI available ones are not available via powershell).

If you navigate to here you can see the ones that can be added via powershell


https://docs.microsoft.com/en-us/powershell/module/azurerm.compute/?view=azurermps-5.7.0#vm_extensions

Here is a quick pic of that link showing some of the ones available:


Now in my case i only have one extension shown in my servers extension blade (this is actually the enablevmaccess one but named differently as i was having trouble getting in to an old VM and somehow ended up in this state with a strangely named one - but lets ignore that - pretend there are none there) - here is what the extensions blade looks like:



Now i plan to add the bginfo tool (this is the handy thing that sets the desktop background image with some summary info about the VM you are on).

To do this I first launch powershell in cloud shell from the >_ icon at the top right. When thats launched I then want to set my subscription to the right one via

 select-azurermsubscription -subscriptionname "My sub name"


Once i'm in the right context I then enable the bginfo extension via:

 Set-AzureRmVMBginfoExtension -ResourceGroupName "My sub name" -VMName "myvmname"


That all looks good - and if i navigate back to the blade again I now see the bginfo one is listed there:


And just to prove it works - here is the backdrop from the VM when logging on showing the dbinfo detail:


Nice - all of that was acheived without having to log into the VM. I now need to investigate further what other things are available - i see mention of a domain join one which is immediatly useful and there seems to also be an extension supporting some kind of SAP enhancement which i also plan to check out.

I'm not sure why there is this mismatch between extensions between powershell and the portal - I guess there is some reason for that - it's just not immediatly apparent to me.

You can also write a completely custom script and execute this using the 'custom script extension' - more on that here:

https://docs.microsoft.com/en-us/azure/virtual-machines/windows/extensions-customscript

We've made use of that to install a zabbix agent for infrastructure monitoring - but you can do anything you like that is relevant for your environments.



1 comments:

  1. Really nice blog post.provided a helpful information.I hope that you will post more updates like this
    Azure Online Training Hyderabad


    ReplyDelete