Managing ARM Templates and Resource Groups
ARM templates simplify provisioning on Azure. You can create templates for the service or application architectures you want and have Azure use those templates for quick and reliable provisioning of services or applications in resource groups. Resource groups allow you to group resources with similar lifecycle requirements. By adding an ARM template to the Commander service catalog, you can use Commander to deploy any set of Azure resources into an existing resource group or a new resource group — whether or not those resources are directly supported by Commander.
ARM templates are JSON files that specify Azure resources to deploy and configure. These templates can be thought of as an analogue to the Commander service catalog entry. They list the images used to provision instances and they describe information such as network security groups and availability sets used to configure the instances. ARM templates have parameters that serve as inputs, such as DNS name, OS version and credentials.
Commander allows you to add ARM template parameters to the request form with a combination of custom attributes and variables. When you add an ARM template to the service catalog, the parameters and initial values displayed are retrieved from the template. Parameter values are encrypted when saved in the Commander database. Parameters can also be customized during manual deployment.
Custom attributes allow:
- requesters to select parameter values on the form
- requesters to specify a regular expression value for a parameter on the form
- administrators to select parameter values during manual deployment
- administrators to specify a regular expression value for a parameter during manual deployment
Variables allow you to access information about the deployment destination and the request form. See ARM Template Parameter Variables for the list of supported variables.
For example, our ARM template has parameters for user name, password and Ubuntu version. You can hard-code parameter values when you create the service catalog entry, or you can allow users to input values. To allow a user to specify the credentials and select the Ubuntu version:
- Add an ARM template to the catalog as described in Components page.
- On the Attributes tab, click Add Attributes.
- In the Add Attributes dialog, click Create New Attribute.
- Enter "Ubuntu Version" for the Name, and enter a description if you wish.
- For Type, choose List (to allow users to select from a list of versions).
- For Applies To, choose Form.
- Clear the Edit in Service Portal option and click Next.
- On the Configure Attribute page of the wizard, enter a comma-separated list of Ubuntu versions, then click Add to move the values to the list box.
- Click Finish.
- Click OK.
- Click the Attributes tab. The Ubuntu Version attribute appears. If you want, choose a default version.
- Click the Form tab, then from the Toolbox at the right side of the page, click Ubuntu Version to add it to the form.
- Click Edit and enable the Required option.
- From the Toolbox, click Input Text Field, and once the element is added to the form, in Display Label, type "User Name", then click OK.
- From the Toolbox, click Input Text Field again, and once the element is added to the form, in Display Label, type "Password", enable Hide User Input, then click OK.
- Click the Parameters tab to add the variables to the adminPassword and adminUsername fields.
To allow users to specify a regular expression instead, select Text. See Creating custom attributes for more information.
The Ubuntu Version attribute is now selected in the Add Attributes dialog.
- Beside the adminPassword field, click to open the Variable Assistant. Notice that the form elements you just created on the Form tab now appear under Form Input Fields.
In the Variable Assistant, select Password from the list, click Insert, and click OK.
- Beside the adminUsername field, click , then in the Variable Assistant, select User Name from the list, click Insert, and click OK.
- Beside the ubuntuOSVersion field, click , then in the Variable Assistant, select Ubuntu Version, click Insert, and click OK
The Parameters tab now looks like this:
Now, requesters must enter credentials and select an Ubuntu version when requesting this ARM template from the service catalog. Their selection will be passed to Azure as a parameter through the Commander variable. An administrator can override the requester's selection during manual deployment of the service request.
As the cost of an ARM template can't be determined until the resources are deployed, we recommend that you include an estimated Annual ARM Template Cost in the service catalog. This cost provides users with an estimate of the template's cost at request time.
Once the template is deployed, the cost of each VM in the resource group is displayed in Commander. Costs are not displayed for the resource group itself, or for other types of resources deployed as part of an ARM template.
If a user owns a resource group, but doesn't own all of the VMs in the resource group, the unowned VMs are displayed as unsupported resources. Unsupported resources are displayed in the Resources table for the resource group, but the VM name can't be clicked to access its details, and an icon is not displayed in the Type column.