Azure Blueprint provisioning
Provision Azure resources using Azure Blueprints in Harness.
Harness supports Azure Blueprints as an infrastructure provisioner. You can use Azure Blueprints to provision resources that adhere to your organization's standards, patterns, and requirements. You can package ARM templates, resource groups, policy and role assignments, and much more into a Blueprint. See this video from Microsoft Developer for more details.
This topic provides steps on using Harness to provision target environment resources using Azure Blueprints.
What you will learn from this topic
How to understand the supported deployment types and scopes for Azure Blueprint provisioning.
How to choose between ad hoc provisioning and dynamic provisioning for Azure Blueprints.
How to create an Azure Blueprint Template step and configure Blueprint templates and assignment files.
How to assemble complete pipeline examples for ad hoc and dynamic provisioning.
Supported deployment types and scopes
Harness Azure Blueprint provisioning supports the following deployment types:
Basic
Canary
Blue-Green for Azure Web Apps
Harness Azure Blueprint provisioning is used to deploy Azure Web Apps. You can use Azure Blueprints to provision any Azure resources, but deployment target provisioning is limited to Azure Web App deployments.
Harness supports the following Azure Blueprint assignment scopes:
Tenant
Management Group
Subscription
Resource Group
The Create Azure BP Resources step supports selecting Subscription or Management Group as the assignment scope.
Blueprint templates must be in JSON format. Bicep is not supported.
Incremental mode is supported for Subscription, Resource Group, Management Group, and Tenant scopes.
Complete mode is supported only for Resource Group scope.
Blueprint rollback is supported only for Resource Group scope.
Before you begin
Harness project access: View, Create/Edit, and Execute permissions on Pipelines, Environments, and Infrastructure Definitions. Go to RBAC in Harness to configure roles.
Azure connector: A Harness Azure connector with permissions to provision resources in your target subscription or resource group. Go to Add Microsoft Azure connector to configure the connector and review required Azure roles for Blueprint provisioning.
Harness Delegate: A delegate installed in an environment that can connect to Azure. Go to Delegate installation overview to install a delegate.
Azure Blueprint template: A JSON Blueprint template that defines the resources to provision. Blueprint templates must be in JSON format; Bicep is not supported.
Provisioning modes
Harness supports two Azure Blueprint provisioning modes:
Ad hoc provisioning: Provision infrastructure as a standalone task without deploying an application in the same flow.
Dynamic provisioning: Provision the target infrastructure and deploy your application to it in the same stage.
The Create Azure BP Resources step is configured similarly for both modes, but it is added in different sections of the stage.
Go to Provisioning overview to understand Harness provisioning concepts and use cases.
Ad hoc provisioning
Ad hoc provisioning lets you provision infrastructure as a standalone workflow without deploying an application in the same flow. This mode is useful to create test environments, set up shared resources, or make infrastructure changes independently of application deployments.
For ad hoc provisioning, add the Azure Blueprint Template step to the Execution section of a CD Deploy stage. The step provisions your resources when the stage runs.
Example use cases:
Provision a shared Azure resource group that adheres to organizational policies.
Stand up a temporary test environment for validation, then destroy it in a later step.
Run a one-time infrastructure change defined in a Blueprint template.
To configure ad hoc provisioning, go to Create Azure Blueprint Template step and Pipeline examples.
Dynamic provisioning
Dynamic provisioning provisions the target infrastructure as part of the deployment process and then deploys the application to the provisioned infrastructure in the same stage.
The dynamic provisioning workflow consists of the following steps:
Provision the target infrastructure: The Create Azure BP Resources step provisions the infrastructure using the Azure Blueprint.
Obtain Blueprint outputs: The provisioning step generates outputs that identify or provide details about the provisioned infrastructure.
Map the outputs to the Infrastructure Definition: Use the provisioner outputs to dynamically configure the Infrastructure Definition for the deployment target.
Deploy the application: Harness deploys the application to the provisioned infrastructure.
For dynamic provisioning, add the Create Azure BP Resources step to the Environment section of the Deploy stage. Configure the Infrastructure Definition to use outputs from the provisioning step.
For example, if the Blueprint provisioning step produces namespace and releaseName outputs, you can reference them in the Infrastructure Definition using Harness expressions:
The output names depend on the resources provisioned by your Azure Blueprint and the deployment target. namespace and releaseName are examples for a Kubernetes deployment and are not predefined Azure Blueprint outputs.
Example use cases:
Provision an Azure Web App resource group and deploy a containerized application to it in a single pipeline.
Create ephemeral Azure resources per pull request, deploy to them, and tear them down afterward.
Each Harness deployment type requires different Blueprint outputs to be mapped to its infrastructure settings. Go to the topic for your deployment type to understand which Blueprint outputs are required:
Azure Web Apps: Web App deployments.
Tanzu Application Services: Tanzu (Pivotal Cloud Foundry) deployments.
VM deployments using SSH: Traditional virtual machine deployments over SSH.
Windows VM deployments using WinRM: Windows virtual machine deployments over WinRM.
To configure dynamic provisioning, go to Create Azure Blueprint Template step and Pipeline examples.
Create an Azure BP Resources step
The Create Azure BP Resources step provisions infrastructure resources using the Blueprint template file and assignment file you provide.
Perform the following steps to add and configure the Create Azure BP Resources step:
In your Harness CD Deploy stage, add the Create Azure BP Resources step.
If you are using the step for dynamic infrastructure provisioning, add the step in the stage Environment tab.
If you are using the step for ad hoc provisioning, add the step in the stage Execution tab.
In Name, enter a name for the step.
Configure the step settings described in the sections below.
Select Apply Changes.
Azure Connector
In Azure Connector, select or create a Harness Azure connector that Harness will use to connect to Azure and provision the Blueprint. Go to Add Microsoft Azure connector to configure the connector.
Scope
Select the scope for your Blueprint assignment:
Subscriptions: Assign the Blueprint at the subscription level.
Management Groups: Assign the Blueprint at the management group level.
The targetScope property in your Blueprint template identifies the scope.
Assignment Name
In Assignment Name, enter a unique name to give the assignment of the Blueprint.
When you assign a Blueprint to a subscription, you provide an assignment name to identify that specific assignment instance. The Assignment Name should be unique within the scope of the subscription where the Blueprint is being assigned.
The Blueprint assignment configuration determines how the Blueprint is assigned, including the assignment name, scope, parameters, and other assignment properties. Depending on the configuration and source used in Pipeline Studio, these values can be provided through the step configuration and the Blueprint template source.
Azure Blueprint Template
In Azure Blueprint Template, provide the Blueprint template used for provisioning. The Blueprint template defines the resources, parameters, and other configuration for the Blueprint.
The Blueprint assignment configuration determines how the Blueprint is assigned, including the assignment name, scope, parameters, and other assignment properties.
When you store the Blueprint template in Git, configure the following:
Git Connector: Select the connector used to access the repository.
Repository: Enter the Git repository containing the Blueprint template.
Branch: Select the branch containing the template.
Folder Path: Enter the path to the folder containing the Blueprint template.
Create Azure BP Resources step - YAML example
The following YAML example demonstrates a Git resource configuration. Replace the placeholder values with your own.
Advanced step settings
In Advanced tab, you can use the following options:
Pipeline examples
The following examples show complete pipeline YAML for ad hoc provisioning and dynamic provisioning using Azure Blueprints.
Ad hoc provisioning example
This example provisions infrastructure using Azure Blueprints without deploying an application. The Create Azure Blueprint Template step is in the Execution section of the stage.
Dynamic provisioning example
This example provisions infrastructure using Azure Blueprints in the Environment section and maps the Blueprint outputs to the Infrastructure Definition. The application is then deployed to the provisioned infrastructure in the Execution section.
Next steps
Go to Deploy Azure Web Apps to understand how to deploy applications to Azure Web App infrastructure provisioned with Blueprints.
Go to Provisioning overview to understand Harness provisioning concepts across all cloud providers.
Last updated
Was this helpful?