1. Packages
  2. Harness Provider
  3. API Docs
  4. cloudprovider
  5. Azure
Harness v0.7.1 published on Saturday, Mar 29, 2025 by Pulumi

harness.cloudprovider.Azure

Explore with Pulumi AI

Resource for creating an Azure cloud provider. This resource uses the config-as-code API’s. When updating the name or path of this resource you should typically also set the create_before_destroy = true lifecycle setting.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as harness from "@pulumi/harness";

const _default = harness.getSecretManager({
    "default": true,
});
const azureKey = new harness.EncryptedText("azure_key", {
    name: "azure_key",
    value: "<AZURE_KEY>",
    secretManagerId: _default.then(_default => _default.id),
});
const azure = new harness.cloudprovider.Azure("azure", {
    name: "azure",
    clientId: "<AZURE_CLIENT_ID>",
    tenantId: "<AZURE_TENANT_ID>",
    key: azureKey.name,
});
Copy
import pulumi
import pulumi_harness as harness

default = harness.get_secret_manager(default=True)
azure_key = harness.EncryptedText("azure_key",
    name="azure_key",
    value="<AZURE_KEY>",
    secret_manager_id=default.id)
azure = harness.cloudprovider.Azure("azure",
    name="azure",
    client_id="<AZURE_CLIENT_ID>",
    tenant_id="<AZURE_TENANT_ID>",
    key=azure_key.name)
Copy
package main

import (
	"github.com/pulumi/pulumi-harness/sdk/go/harness"
	"github.com/pulumi/pulumi-harness/sdk/go/harness/cloudprovider"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := harness.GetSecretManager(ctx, &harness.GetSecretManagerArgs{
			Default: pulumi.BoolRef(true),
		}, nil)
		if err != nil {
			return err
		}
		azureKey, err := harness.NewEncryptedText(ctx, "azure_key", &harness.EncryptedTextArgs{
			Name:            pulumi.String("azure_key"),
			Value:           pulumi.String("<AZURE_KEY>"),
			SecretManagerId: pulumi.String(_default.Id),
		})
		if err != nil {
			return err
		}
		_, err = cloudprovider.NewAzure(ctx, "azure", &cloudprovider.AzureArgs{
			Name:     pulumi.String("azure"),
			ClientId: pulumi.String("<AZURE_CLIENT_ID>"),
			TenantId: pulumi.String("<AZURE_TENANT_ID>"),
			Key:      azureKey.Name,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Harness = Pulumi.Harness;

return await Deployment.RunAsync(() => 
{
    var @default = Harness.GetSecretManager.Invoke(new()
    {
        Default = true,
    });

    var azureKey = new Harness.EncryptedText("azure_key", new()
    {
        Name = "azure_key",
        Value = "<AZURE_KEY>",
        SecretManagerId = @default.Apply(@default => @default.Apply(getSecretManagerResult => getSecretManagerResult.Id)),
    });

    var azure = new Harness.Cloudprovider.Azure("azure", new()
    {
        Name = "azure",
        ClientId = "<AZURE_CLIENT_ID>",
        TenantId = "<AZURE_TENANT_ID>",
        Key = azureKey.Name,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.harness.HarnessFunctions;
import com.pulumi.harness.inputs.GetSecretManagerArgs;
import com.pulumi.harness.EncryptedText;
import com.pulumi.harness.EncryptedTextArgs;
import com.pulumi.harness.cloudprovider.Azure;
import com.pulumi.harness.cloudprovider.AzureArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var default = HarnessFunctions.getSecretManager(GetSecretManagerArgs.builder()
            .default_(true)
            .build());

        var azureKey = new EncryptedText("azureKey", EncryptedTextArgs.builder()
            .name("azure_key")
            .value("<AZURE_KEY>")
            .secretManagerId(default_.id())
            .build());

        var azure = new Azure("azure", AzureArgs.builder()
            .name("azure")
            .clientId("<AZURE_CLIENT_ID>")
            .tenantId("<AZURE_TENANT_ID>")
            .key(azureKey.name())
            .build());

    }
}
Copy
resources:
  azureKey:
    type: harness:EncryptedText
    name: azure_key
    properties:
      name: azure_key
      value: <AZURE_KEY>
      secretManagerId: ${default.id}
  azure:
    type: harness:cloudprovider:Azure
    properties:
      name: azure
      clientId: <AZURE_CLIENT_ID>
      tenantId: <AZURE_TENANT_ID>
      key: ${azureKey.name}
variables:
  default:
    fn::invoke:
      function: harness:getSecretManager
      arguments:
        default: true
Copy

Create Azure Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Azure(name: string, args: AzureArgs, opts?: CustomResourceOptions);
@overload
def Azure(resource_name: str,
          args: AzureArgs,
          opts: Optional[ResourceOptions] = None)

@overload
def Azure(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          client_id: Optional[str] = None,
          key: Optional[str] = None,
          tenant_id: Optional[str] = None,
          environment_type: Optional[str] = None,
          name: Optional[str] = None)
func NewAzure(ctx *Context, name string, args AzureArgs, opts ...ResourceOption) (*Azure, error)
public Azure(string name, AzureArgs args, CustomResourceOptions? opts = null)
public Azure(String name, AzureArgs args)
public Azure(String name, AzureArgs args, CustomResourceOptions options)
type: harness:cloudprovider:Azure
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. AzureArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. AzureArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. AzureArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. AzureArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. AzureArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var azureResource = new Harness.Cloudprovider.Azure("azureResource", new()
{
    ClientId = "string",
    Key = "string",
    TenantId = "string",
    EnvironmentType = "string",
    Name = "string",
});
Copy
example, err := cloudprovider.NewAzure(ctx, "azureResource", &cloudprovider.AzureArgs{
	ClientId:        pulumi.String("string"),
	Key:             pulumi.String("string"),
	TenantId:        pulumi.String("string"),
	EnvironmentType: pulumi.String("string"),
	Name:            pulumi.String("string"),
})
Copy
var azureResource = new Azure("azureResource", AzureArgs.builder()
    .clientId("string")
    .key("string")
    .tenantId("string")
    .environmentType("string")
    .name("string")
    .build());
Copy
azure_resource = harness.cloudprovider.Azure("azureResource",
    client_id="string",
    key="string",
    tenant_id="string",
    environment_type="string",
    name="string")
Copy
const azureResource = new harness.cloudprovider.Azure("azureResource", {
    clientId: "string",
    key: "string",
    tenantId: "string",
    environmentType: "string",
    name: "string",
});
Copy
type: harness:cloudprovider:Azure
properties:
    clientId: string
    environmentType: string
    key: string
    name: string
    tenantId: string
Copy

Azure Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Azure resource accepts the following input properties:

ClientId This property is required. string
The client id for the Azure application
Key This property is required. string
The Name of the Harness secret containing the key for the Azure application
TenantId This property is required. string
The tenant id for the Azure application
EnvironmentType string
The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
Name Changes to this property will trigger replacement. string
The name of the cloud provider.
ClientId This property is required. string
The client id for the Azure application
Key This property is required. string
The Name of the Harness secret containing the key for the Azure application
TenantId This property is required. string
The tenant id for the Azure application
EnvironmentType string
The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
Name Changes to this property will trigger replacement. string
The name of the cloud provider.
clientId This property is required. String
The client id for the Azure application
key This property is required. String
The Name of the Harness secret containing the key for the Azure application
tenantId This property is required. String
The tenant id for the Azure application
environmentType String
The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
name Changes to this property will trigger replacement. String
The name of the cloud provider.
clientId This property is required. string
The client id for the Azure application
key This property is required. string
The Name of the Harness secret containing the key for the Azure application
tenantId This property is required. string
The tenant id for the Azure application
environmentType string
The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
name Changes to this property will trigger replacement. string
The name of the cloud provider.
client_id This property is required. str
The client id for the Azure application
key This property is required. str
The Name of the Harness secret containing the key for the Azure application
tenant_id This property is required. str
The tenant id for the Azure application
environment_type str
The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
name Changes to this property will trigger replacement. str
The name of the cloud provider.
clientId This property is required. String
The client id for the Azure application
key This property is required. String
The Name of the Harness secret containing the key for the Azure application
tenantId This property is required. String
The tenant id for the Azure application
environmentType String
The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
name Changes to this property will trigger replacement. String
The name of the cloud provider.

Outputs

All input properties are implicitly available as output properties. Additionally, the Azure resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing Azure Resource

Get an existing Azure resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: AzureState, opts?: CustomResourceOptions): Azure
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        client_id: Optional[str] = None,
        environment_type: Optional[str] = None,
        key: Optional[str] = None,
        name: Optional[str] = None,
        tenant_id: Optional[str] = None) -> Azure
func GetAzure(ctx *Context, name string, id IDInput, state *AzureState, opts ...ResourceOption) (*Azure, error)
public static Azure Get(string name, Input<string> id, AzureState? state, CustomResourceOptions? opts = null)
public static Azure get(String name, Output<String> id, AzureState state, CustomResourceOptions options)
resources:  _:    type: harness:cloudprovider:Azure    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ClientId string
The client id for the Azure application
EnvironmentType string
The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
Key string
The Name of the Harness secret containing the key for the Azure application
Name Changes to this property will trigger replacement. string
The name of the cloud provider.
TenantId string
The tenant id for the Azure application
ClientId string
The client id for the Azure application
EnvironmentType string
The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
Key string
The Name of the Harness secret containing the key for the Azure application
Name Changes to this property will trigger replacement. string
The name of the cloud provider.
TenantId string
The tenant id for the Azure application
clientId String
The client id for the Azure application
environmentType String
The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
key String
The Name of the Harness secret containing the key for the Azure application
name Changes to this property will trigger replacement. String
The name of the cloud provider.
tenantId String
The tenant id for the Azure application
clientId string
The client id for the Azure application
environmentType string
The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
key string
The Name of the Harness secret containing the key for the Azure application
name Changes to this property will trigger replacement. string
The name of the cloud provider.
tenantId string
The tenant id for the Azure application
client_id str
The client id for the Azure application
environment_type str
The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
key str
The Name of the Harness secret containing the key for the Azure application
name Changes to this property will trigger replacement. str
The name of the cloud provider.
tenant_id str
The tenant id for the Azure application
clientId String
The client id for the Azure application
environmentType String
The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
key String
The Name of the Harness secret containing the key for the Azure application
name Changes to this property will trigger replacement. String
The name of the cloud provider.
tenantId String
The tenant id for the Azure application

Import

Import using the Harness azure cloud provider id.

$ pulumi import harness:cloudprovider/azure:Azure example <provider_id>
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
harness pulumi/pulumi-harness
License
Apache-2.0
Notes
This Pulumi package is based on the harness Terraform Provider.