Adding Extensions to Azure VM in Resource Manager (ARM)

Just a quick note since I found this information terribly difficult to find...

To get the available extensions, you need to use the service management cmdlet:

Add-AzureAccount
Get-AzureVMAvailableExtension | ft ExtensionName, Publisher

Find the extension that you need, and get all the details:

Get-AzureVMAvailableExtension | ?{$_.ExtensionName -eq "VMAccessAgent"}

Using the information provided, now use the ARM cmdlet:

Set-AzureRmVMExtension -ResourceGroupName "[rgName]" -VMName "[vmName]" -Name "VMAccessAgent" -Publisher "Microsoft.Compute" -TypeHandlerVersion "2.0" -ExtensionType "VMAccessAgent" -Location "North Central US"

$settingsString = '{"AntimalwareEnabled":true}'
Set-AzureRmVMExtension -ResourceGroupName "[rgName]" -VMName "[vmName]" -Name "IaasAntimalware" -Publisher "Microsoft.Azure.Security" -TypeHandlerVersion 1.3 -ExtensionType IaasAntimalware -Location "North Central US" -settingstring $settingsString