Add Azure ARM Templates to Harness

Updated 2 months ago by Michael Cretzman

Currently, this feature is behind a Feature Flag. Contact Harness Support to enable the feature. Feature Flags can only be removed for Harness Professional and Essentials editions. Once the feature is released to a general audience, it is available for Trial and Community Editions.

This topic describes how to add your Azure ARM templates to Harness using Harness Infrastructure Provisioners. This involves providing the Git repo location of the ARM template and setting its scope in Harness.

Once you've added the template as an Infrastructure Provisioner, you can do the following:

  • Target the Azure infrastructure: use the Infrastructure Provisioner in a Harness Infrastructure Definition. Next, you add this Infrastructure Definition to a Workflow to define the ARM template's resources as the target infrastructure for the deployment. See Target an Azure ARM Provisioned Infrastructure.
  • Provision the Azure infrastructure: use the Infrastructure Provisioner in a Harness Workflow to provision the Azure resources. This will run your ARM template and create its Azure resources. These resources could be the target infrastructure for a deployment from the Infrastructure Definition or simply other Azure resources. See Provision using a Harness ARM Infrastructure Provisioner.

In this topic:

Before You Begin

Visual Summary

The following video shows you how to add an ARM template from Azure's ARM templates GitHub account to Harness as a Harness Infrastructure Provisioner.

Supported Platforms and Technologies

See Supported Platforms and Technologies.

Step 1: Add Harness Delegate

Make sure you have set up a Harness Delegate as described in Set Up Your Harness Account for Azure ARM.

The Delegate must be able to connect to your Git provider to add the ARM template, and to pull it at deployment runtime.

Step 2: Add Source Source Provider

Harness Source Repo Providers connect your Harness account with your Git platform accounts.

For Azure ARM templates, you add a Harness Source Repo Provider and connect it to the Git repo for your ARM templates.

For steps on setting up a Source Repo Provider, see Add Source Repo Providers.

For example, in Azure's ARM templates GitHub repo at https://github.com/Azure/azure-quickstart-templates there is a simple VM template at 101-vm-simple-windows/azuredeploy.json.

Here is a Harness Source Repo Provider that uses the URL of the repo and the master branch:

Next, you use this Source Repo Provider as the source of your Harness Infrastructure Provisioner.

Step 3: Add the Infrastructure Provisioner

In your Harness Application, click Infrastructure Provisioners.

Click Add Infrastructure Provisioner, and then click ARM Template.

In Azure Resource Type, click ARM.

Enter a name and description.

In Scope, enter the scope for the template. The schema link in the template identifies the template scope:

  • Resource group: "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#"
  • Subscription: "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#"
  • Management group: "$schema": "https://schema.management.azure.com/schemas/2019-08-01/managementGroupDeploymentTemplate.json#"
  • Tenant: "$schema": "https://schema.management.azure.com/schemas/2019-08-01/tenantDeploymentTemplate.json#"

In Source Type, select Git Repository or Template Body.

If you select Template Body, paste the template in Template Body, and click Submit.

If you are using templates from a third-party, ensure that the templates are formatted correctly.

If you select Git Repository, select the Harness Source Repo Provider you set up to connect Harness to your Git repo.

In Commit, enter the branch or commit ID for the repo.

Enter the branch name or commit ID.

In File Path, enter path to the template JSON file in the Git repo. You don't need to enter the repo name, as that is set up in the Harness Source Repo Provider.

Let's look at an example:

  • I have a Harness Source Repo Provider for the repo https://github.com/Azure/azure-quickstart-templates.
  • My template is located at https://github.com/Azure/azure-quickstart-templates/blob/master/101-vm-simple-windows/azuredeploy.json.
  • In File Path, I enter 101-vm-simple-windows/azuredeploy.json.

Click Submit.

The Infrastructure Provisioner is added.

Now you can use the Infrastructure Provisioner, you can:

  • Target the Azure infrastructure: use the Infrastructure Provisioner in a Harness Infrastructure Definition. Next, you add this Infrastructure Definition to a Workflow to define the ARM template's resources as the target infrastructure for the deployment. See Target an Azure ARM Provisioned Infrastructure.
  • Provision the Azure infrastructure: use the Infrastructure Provisioner in a Harness Workflow to provision the Azure resources. This will run your ARM template and create its Azure resources. These resources could be the target infrastructure for a deployment or simply other Azure resources. See Provision using a Harness ARM Infrastructure Provisioner.

Configure As Code

To see how to configure the settings in this topic using YAML, configure the settings in the UI first, and then click the YAML editor button (</>).


How did we do?