Use the virtualMachine-extensions building block template to deploy one or more virtual machine extensions to an Azure virtual machine.
Extensions can also be configured when using the multi-vm-n-nic-m-storage building block template. Both building block templates use the same extensions parameter structure.
Parameters
The virtualMachine-extensions building block template contains one parameter named virtualMachinesExtensionSettings.
virtualMachinesExtensionSettings
The virtualMachinesExtensionSettings parameter specifies the extensions to be installed on VMs. It contains the following properties:
- vms
Array of values. Required.
Specifies an array of names of pre-existing VMs that the extensions will be installed on. - extensions
Array of objects. Required.
Specifies one or more extension definitions. Each extension definition is specified using the following object:- name
Value. Required.
Defines the display name of this extension. - publisher
Value. Required.
Extension publisher name. - type
Value. Required.
Extension type. - typeHandlerVersion
Value. Required.
Version of extension to use. - autoUpgradeMinorVersion
Value. Required.
Valid values:true
|false
Set totrue
if the extension can upgrade automatically. Otherwisefalse
. - settingsConfigMapperUri
Value. Required.
Valid value:https://raw.githubusercontent.com/mspnp/template-building-blocks/v1.0.0/templates/resources/Microsoft.Compute/virtualMachines/extensions/vm-extension-passthrough-settings-mapper.json
URL of template used during deployment process. - settingsConfig
Object. Required.
Specifies extension specific settings. Set to an empty object for no extension specific settings. - protectedSettingsConfig
Object. Required.
Specifies extension specific settings that are encrypted during deployment. Set to an empty object for no extension specific settings.
- name
Deployment
You can deploy a building block using Azure portal, PowerShell, or Azure CLI.
Azure portal
Note that this building block deployment process requires a parameter file stored in a location with a publicly available URI.
- Right-click the button below and select either "open link in new tab" or "open link in new window":
- Wait for the Azure Portal to open.
- In the
Basics
section:
- Select your
Subscription
from the drop-down list. - For the
Resource group
, you can either create a new resource group or use an existing resource group. - Select the region where you'd like to deploy the VNet in the
Location
drop-down list.
- In the
Settings
section, enter a URI to a valid parameter file. There are several example parameter files in Github. Note that if you want to use one of these parameter files the URI must be the path to theraw
file in Github. These parameter files require pre-existing VNets and subnets and the deployment will fail if they do not exist. You will need to inspect the parameters to determine these requirements. - Review the terms and conditions, then click the I agree to the terms and conditions stated above checkbox.
- Click the Purchase button.
- Wait for the deployment to complete.
PowerShell
To deploy the building block template using a parameter file hosted at a publicly available URI, follow these steps:
- Upload your parameter file to a location with a publicly available URI.
- Log in to Azure using your selected subscription:
Login-AzureRmAccount -SubscriptionId <your subscription ID>
- If you do not have an existing resource group, run the
New-AzureRmResourceGroup
cmdlet to create one as shown below:
New-AzureRmResourceGroup -Location <Target Azure Region> -Name <Resource Group Name>
- Deploy a VNet. For more information see the vnet-n-subnet building block template.
- Run the
New-AzureRmResourceGroupDeployment
cmdlet as shown below.
New-AzureRmResourceGroupDeployment -ResourceGroupName <Resource Group Name> -TemplateUri https://raw.githubusercontent.com/mspnp/template-building-blocks/v1.0.0/scenarios/virtualMachine-extensions/azuredeploy.json -templateParameterUriFromTemplate <URI of parameter file>
Example
The cmdlet below deploys the multiple-extensions-multiple-vms parameter file from the scenarios folder in Github.
Note that this deployment requires two existing VMs, one named bb-dev-biz-vm1 and one named bb-dev-biz-vm2.
New-AzureRmResourceGroupDeployment -ResourceGroupName bb-dev-rg -TemplateUri https://raw.githubusercontent.com/mspnp/template-building-blocks/v1.0.0/scenarios/virtualMachine-extensions/azuredeploy.json -templateParameterUriFromTemplate https://raw.githubusercontent.com/mspnp/template-building-blocks/v1.0.0/scenarios/virtualMachine-extensions/parameters/multiple-extensions-multiple-vms.parameters.json
Azure CLI
Before you begin, install the latest version of the Azure CLI.
To deploy the building block template using a parameter file hosted at a publicly available URI, follow these steps:
- Upload your parameter file to a location with a publicly available URI.
- Log in to Azure using your selected subscripton:
az login
- Set your selected subscription:
az account set --subscription <your subscripton ID>
- If you do not have an existing resource group, create a new one using the following command:
az group create -l <Target Azure Region> -n <Resource Group Name>
- Deploy a VNet. For more information see the vnet-n-subnet building block template.
- Run the command shown below:
az group deployment create -g <Resource Group Name> --template-uri https://raw.githubusercontent.com/mspnp/template-building-blocks/v1.0.0/scenarios/virtualMachine-extensions/azuredeploy.json --parameters "{\"templateParameterUri\":{\"value\":\"<parameter file public URI>\"}}"
Example
The command below deploys the multiple-extensions-multiple-vms.parameters parameter file from the scenarios folder in Github.
Note that this deployment requires two existing VMs, one named bb-dev-biz-vm1 and one named bb-dev-biz-vm2.
az login
az group deployment create -g bb-dev-rg --template-uri https://raw.githubusercontent.com/mspnp/template-building-blocks/v1.0.0/scenarios/virtualMachine-extensions/azuredeploy.json --parameters "{\"templateParameterUri\":{\"value\":\"https://raw.githubusercontent.com/mspnp/template-building-blocks/v1.0.0/scenarios/virtualMachine-extensions/parameters/multiple-extensions-multiple-vms.parameters.json\"}}"
- Introduction
- Version 1
- Version 2
- Overview
- How To
- Install Template Building Blocks version 2 (Windows)
- Install Template Building Blocks version 2 (Linux)
- Use Template Building Blocks version 2 Command Line
- Create a Template Building Blocks Parameter File
- Specify and override default subscription ID, resource group, or location
- Secure the files used by the Template Building Block command line tool
- Reference