Defining a template to create resources in Microsoft Azure


As an application business analyst, you can define Azure Resource Management (ARM) templates to create resources in Microsoft Azure, such as virtual machines and storage accounts. An ARM template is a JSON file that defines the resource that you want to create and the resource properties. Templates help you to save time by reusing the information to create different resources. You can create a process in your application to define a template by using the Create Template element in the Process designer of BMC Helix Innovation Studio. 

For information about ARM templates, Templates overview.

The following video (3:08) explains how to automate the task of defining an Azure Resource Management template for creating a storage account in Microsoft Azure:


22_1_icon_play.pnghttps://youtu.be/cosyzCiI2Fk

Before you begin

Make sure that an administrator has configured the Microsoft Azure connector. For more information, see Adding-a-Microsoft-Azure-connector-configuration.

To create a process to define a resource template

  1. Log in to BMC Helix Innovation Studio.
  2. Navigate to the Workspace tab, and select the application in which you want to create a process.
  3. In the application, select Processes, and then click New.
  4. In the Process designer, drag the Create Template element to the canvas.
  5. In the element Properties pane, enter the values of the following input properties:

    Property

    Description

    Storage account template example

    Connection ID

    ID of the Microsoft Azure connector.

    7f46afa3-7feb-43f8-8c67-9662c42eb8b8

    Resource Name

    Name of the resource that you want to create by using the template.

    storage1

    Template

    JSON that defines the Azure resource that you want to create and its properties as per Azure formats.



    {
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
    "location": {
    "type": "string"
    },
    "storageAccountName": {
    "type": "string"
    },
    "accountType": {
    "type": "string"
    },
    "kind": {
    "type": "string"
    },
    "accessTier": {
    "type": "string"
    }
    },
    "variables": {},
    "resources": [
    {
    "name": "[parameters('storageAccountName')]",
    "type": "Microsoft.Storage/storageAccounts",
    "apiVersion": "2019-06-01",
    "location": "[parameters('location')]",
    "properties": {
    "accessTier": "[parameters('accessTier')]"
    },
    "dependsOn": [],
    "sku": {
    "name": "[parameters('accountType')]"
    },
    "kind": "[parameters('kind')]",
    "tags": {}
    }
     ],
    "outputs": {}
    }

    Important: You must add all the JSON name and value pairs in double quotes such as ""contentVersion"":""1.0.0.0""

    Parameters

    Expression for the template parameters.

    To specify the parameters, use any one of the following ways:

    • Specify a key-value pair in a JSON, key is the parameter name as the value is the parameter value.
    • Specify the output of the Create Document template.
    {
       "location": {
           "value": "eastus"
       },
       "storageAccountName": {
           "value": "storage1"
       },
       "accountType": {
           "value": "Standard_RAGRS"
       },
       "kind": {
           "value": "StorageV2"
       },
       "accessTier": {
           "value": "Hot"
       }
    }

    Important: You must add all the JSON name and value pairs in double quotes such as 

    {""location"":{""value"":""eastus""}

    Is Existing Resource Group

    The value specifies whether the resource belongs to an existing resource group.

    You can specify the value as True or False.

    True

    Resource Group

    Resource group in which you want to create the resource.

    MyStorageGroup

    (Optional) Region

    Name of the region in which you want to create the resource group.

    This field is applicable when you specify the Is Existing Resource Group as False.

    eastus

    (Optional) Template Link URL

    If you do not want to specify a JSON in the Template property, specify the URL of the template that you created in the Azure portal.

    https://mystorageaccount.blob.core.windows.net/container1/template.json

    (Optional) Template Link Content Version

    To use a specific version of an existing template that you created in the Azure portal, specify the template version.
    If you do not specify the template version, the 1.0.0.0 version of the template is used by default.

    1.0.0.0

    Mode

    Specify one of the following template modes:

    • Complete—Select this mode to delete the existing resources in the resource group and then add resources specified in the template to the resource group.
    • Incremental—Select this mode to add resources specified in the template to the resource group and do not change the existing resources in the resource group.

    COMPLETE

    The Create Template element provides Resource Name as an output.

  6. If required, add the other process elements and specify the flow of execution that you want to create for your business logic.
  7. Save the process.

Example: Automating storage account template creation in Azure

Ajay is an application business analyst in Apex Global. He wants to automate the task of defining an ARM template to create a storage account in Azure. To automate the task, he creates a process. Ajay uses the Create Document element to access attributes within the schema of the AzureTemplateParameters document definition. He adds the values for the document nodes and uses these values as input to create the template. Ajay uses the Create Template element to define the template.

Ajay performs the following actions to create the process to define the template:

Step

Description

Example

1

Create the process.

22_1_Create template process.png

2

Add the Create Document element properties.

22_1_Create template document properties.png

a. To add a document, select the AzureTemplateParameters document definition.

22_1_Select Azure document definition.png

b. To add values for the document nodes, click Add/Remove Document Nodes, and select the key and value check boxes of nodes

22_1_Template add document nodes.png

For information about the Create Document element, see Creating-a-document-instance.

3

Add Create Template element properties

22_1_Create template properties.png

4

In the Create Template properties, in the Parameters field, map the Create Template element output.


22_1_Create template_expression for parameters.png

5

Save the process.