Microsoft has not yet added a way to add extensions to Resource Manger VMs on Azure. Luckily there is a way to do this using Powershell.
You need to have the Azure Powershell tools installed – see https://azure.microsoft.com/da-dk/documentation/articles/powershell-install-configure/
Afterwards connect to Azure – see this http://azurefabric.com/powershell-1-0-and-arm-tenants-and-subscriptions/
First we need to install the Windows Azure VM Agent on the VM server. This can be downloaded from here – http://aka.ms/vmagentwin.
You need to run this installer from an elevated command prompt (run command prompt or Powershell as administrator).
If you skip this step you will be in all kinds of trouble 😉 I didn’t install this before I installed the BGInfo extensions. The extension was installed, but the status was failed. Also the standard extension (if you installed diagnostics) Microsoft.Insights.VMDiagnosticsSettings failed after this. Installing the Azure VM Agent afterwards does not solve these problems. I’m currently trying to uninstall the BGInfo extension again from the portal, it has been running for 54 minutes now… I will update this post later, when I have a solution for this mess.
Start up your Azure Powershell and connect to your subscription (see prerequisites)
Run this command to install the BGInfo extension (thank you BigSkyTech – Technet forums post)
Warning! Users will get disconnected while the VM is being updated!
Set-AzureRmVMExtension -ExtensionName BGInfo -Publisher Microsoft.Compute -Version 2.1 -ExtensionType BGInfo -Location northeurope -ResourceGroupName YOUR_RESOURCE_GROUP -VMName YOUR_VM_NAME
Next time you log in to your server, the BGInfo should now be displayed, yay!
The extension also becomes visible in the Azure management portal – look under Virtual Machines > YOUR_VM > Settings > Extensions
Wanna see all available extensions? Run this…
Get-AzureVMAvailableExtension | Out-GridView