1. Packages
  2. Azure Classic
  3. API Docs
  4. iot
  5. IotHubCertificate

We recommend using Azure Native.

Azure v6.21.0 published on Friday, Mar 7, 2025 by Pulumi

azure.iot.IotHubCertificate

Explore with Pulumi AI

Manages an IotHub Device Provisioning Service Certificate.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
import * as std from "@pulumi/std";

const example = new azure.core.ResourceGroup("example", {
    name: "example-resources",
    location: "West Europe",
});
const exampleIotHubDps = new azure.iot.IotHubDps("example", {
    name: "example",
    resourceGroupName: example.name,
    location: example.location,
    sku: {
        name: "S1",
        capacity: 1,
    },
});
const exampleIotHubCertificate = new azure.iot.IotHubCertificate("example", {
    name: "example",
    resourceGroupName: example.name,
    iotDpsName: exampleIotHubDps.name,
    certificateContent: std.filebase64({
        input: "example.cer",
    }).then(invoke => invoke.result),
});
Copy
import pulumi
import pulumi_azure as azure
import pulumi_std as std

example = azure.core.ResourceGroup("example",
    name="example-resources",
    location="West Europe")
example_iot_hub_dps = azure.iot.IotHubDps("example",
    name="example",
    resource_group_name=example.name,
    location=example.location,
    sku={
        "name": "S1",
        "capacity": 1,
    })
example_iot_hub_certificate = azure.iot.IotHubCertificate("example",
    name="example",
    resource_group_name=example.name,
    iot_dps_name=example_iot_hub_dps.name,
    certificate_content=std.filebase64(input="example.cer").result)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/iot"
	"github.com/pulumi/pulumi-std/sdk/go/std"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Name:     pulumi.String("example-resources"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleIotHubDps, err := iot.NewIotHubDps(ctx, "example", &iot.IotHubDpsArgs{
			Name:              pulumi.String("example"),
			ResourceGroupName: example.Name,
			Location:          example.Location,
			Sku: &iot.IotHubDpsSkuArgs{
				Name:     pulumi.String("S1"),
				Capacity: pulumi.Int(1),
			},
		})
		if err != nil {
			return err
		}
		invokeFilebase64, err := std.Filebase64(ctx, &std.Filebase64Args{
			Input: "example.cer",
		}, nil)
		if err != nil {
			return err
		}
		_, err = iot.NewIotHubCertificate(ctx, "example", &iot.IotHubCertificateArgs{
			Name:               pulumi.String("example"),
			ResourceGroupName:  example.Name,
			IotDpsName:         exampleIotHubDps.Name,
			CertificateContent: pulumi.String(invokeFilebase64.Result),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
using Std = Pulumi.Std;

return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "example-resources",
        Location = "West Europe",
    });

    var exampleIotHubDps = new Azure.Iot.IotHubDps("example", new()
    {
        Name = "example",
        ResourceGroupName = example.Name,
        Location = example.Location,
        Sku = new Azure.Iot.Inputs.IotHubDpsSkuArgs
        {
            Name = "S1",
            Capacity = 1,
        },
    });

    var exampleIotHubCertificate = new Azure.Iot.IotHubCertificate("example", new()
    {
        Name = "example",
        ResourceGroupName = example.Name,
        IotDpsName = exampleIotHubDps.Name,
        CertificateContent = Std.Filebase64.Invoke(new()
        {
            Input = "example.cer",
        }).Apply(invoke => invoke.Result),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.iot.IotHubDps;
import com.pulumi.azure.iot.IotHubDpsArgs;
import com.pulumi.azure.iot.inputs.IotHubDpsSkuArgs;
import com.pulumi.azure.iot.IotHubCertificate;
import com.pulumi.azure.iot.IotHubCertificateArgs;
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) {
        var example = new ResourceGroup("example", ResourceGroupArgs.builder()
            .name("example-resources")
            .location("West Europe")
            .build());

        var exampleIotHubDps = new IotHubDps("exampleIotHubDps", IotHubDpsArgs.builder()
            .name("example")
            .resourceGroupName(example.name())
            .location(example.location())
            .sku(IotHubDpsSkuArgs.builder()
                .name("S1")
                .capacity("1")
                .build())
            .build());

        var exampleIotHubCertificate = new IotHubCertificate("exampleIotHubCertificate", IotHubCertificateArgs.builder()
            .name("example")
            .resourceGroupName(example.name())
            .iotDpsName(exampleIotHubDps.name())
            .certificateContent(StdFunctions.filebase64(Filebase64Args.builder()
                .input("example.cer")
                .build()).result())
            .build());

    }
}
Copy
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: example-resources
      location: West Europe
  exampleIotHubDps:
    type: azure:iot:IotHubDps
    name: example
    properties:
      name: example
      resourceGroupName: ${example.name}
      location: ${example.location}
      sku:
        name: S1
        capacity: '1'
  exampleIotHubCertificate:
    type: azure:iot:IotHubCertificate
    name: example
    properties:
      name: example
      resourceGroupName: ${example.name}
      iotDpsName: ${exampleIotHubDps.name}
      certificateContent:
        fn::invoke:
          function: std:filebase64
          arguments:
            input: example.cer
          return: result
Copy

Create IotHubCertificate Resource

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

Constructor syntax

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

@overload
def IotHubCertificate(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      certificate_content: Optional[str] = None,
                      iot_dps_name: Optional[str] = None,
                      resource_group_name: Optional[str] = None,
                      is_verified: Optional[bool] = None,
                      name: Optional[str] = None)
func NewIotHubCertificate(ctx *Context, name string, args IotHubCertificateArgs, opts ...ResourceOption) (*IotHubCertificate, error)
public IotHubCertificate(string name, IotHubCertificateArgs args, CustomResourceOptions? opts = null)
public IotHubCertificate(String name, IotHubCertificateArgs args)
public IotHubCertificate(String name, IotHubCertificateArgs args, CustomResourceOptions options)
type: azure:iot:IotHubCertificate
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. IotHubCertificateArgs
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. IotHubCertificateArgs
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. IotHubCertificateArgs
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. IotHubCertificateArgs
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. IotHubCertificateArgs
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 iotHubCertificateResource = new Azure.Iot.IotHubCertificate("iotHubCertificateResource", new()
{
    CertificateContent = "string",
    IotDpsName = "string",
    ResourceGroupName = "string",
    IsVerified = false,
    Name = "string",
});
Copy
example, err := iot.NewIotHubCertificate(ctx, "iotHubCertificateResource", &iot.IotHubCertificateArgs{
	CertificateContent: pulumi.String("string"),
	IotDpsName:         pulumi.String("string"),
	ResourceGroupName:  pulumi.String("string"),
	IsVerified:         pulumi.Bool(false),
	Name:               pulumi.String("string"),
})
Copy
var iotHubCertificateResource = new IotHubCertificate("iotHubCertificateResource", IotHubCertificateArgs.builder()
    .certificateContent("string")
    .iotDpsName("string")
    .resourceGroupName("string")
    .isVerified(false)
    .name("string")
    .build());
Copy
iot_hub_certificate_resource = azure.iot.IotHubCertificate("iotHubCertificateResource",
    certificate_content="string",
    iot_dps_name="string",
    resource_group_name="string",
    is_verified=False,
    name="string")
Copy
const iotHubCertificateResource = new azure.iot.IotHubCertificate("iotHubCertificateResource", {
    certificateContent: "string",
    iotDpsName: "string",
    resourceGroupName: "string",
    isVerified: false,
    name: "string",
});
Copy
type: azure:iot:IotHubCertificate
properties:
    certificateContent: string
    iotDpsName: string
    isVerified: false
    name: string
    resourceGroupName: string
Copy

IotHubCertificate 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 IotHubCertificate resource accepts the following input properties:

CertificateContent This property is required. string
The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
IotDpsName
This property is required.
Changes to this property will trigger replacement.
string
The name of the IoT Device Provisioning Service that this certificate will be attached to. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group under which the Iot Device Provisioning Service Certificate resource has to be created. Changing this forces a new resource to be created.
IsVerified Changes to this property will trigger replacement. bool
Specifies if the certificate is created in verified state. Defaults to false. Changing this forces a new resource to be created.
Name Changes to this property will trigger replacement. string
Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
CertificateContent This property is required. string
The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
IotDpsName
This property is required.
Changes to this property will trigger replacement.
string
The name of the IoT Device Provisioning Service that this certificate will be attached to. Changing this forces a new resource to be created.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group under which the Iot Device Provisioning Service Certificate resource has to be created. Changing this forces a new resource to be created.
IsVerified Changes to this property will trigger replacement. bool
Specifies if the certificate is created in verified state. Defaults to false. Changing this forces a new resource to be created.
Name Changes to this property will trigger replacement. string
Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
certificateContent This property is required. String
The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
iotDpsName
This property is required.
Changes to this property will trigger replacement.
String
The name of the IoT Device Provisioning Service that this certificate will be attached to. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group under which the Iot Device Provisioning Service Certificate resource has to be created. Changing this forces a new resource to be created.
isVerified Changes to this property will trigger replacement. Boolean
Specifies if the certificate is created in verified state. Defaults to false. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. String
Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
certificateContent This property is required. string
The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
iotDpsName
This property is required.
Changes to this property will trigger replacement.
string
The name of the IoT Device Provisioning Service that this certificate will be attached to. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group under which the Iot Device Provisioning Service Certificate resource has to be created. Changing this forces a new resource to be created.
isVerified Changes to this property will trigger replacement. boolean
Specifies if the certificate is created in verified state. Defaults to false. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. string
Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
certificate_content This property is required. str
The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
iot_dps_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the IoT Device Provisioning Service that this certificate will be attached to. Changing this forces a new resource to be created.
resource_group_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the resource group under which the Iot Device Provisioning Service Certificate resource has to be created. Changing this forces a new resource to be created.
is_verified Changes to this property will trigger replacement. bool
Specifies if the certificate is created in verified state. Defaults to false. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. str
Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
certificateContent This property is required. String
The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
iotDpsName
This property is required.
Changes to this property will trigger replacement.
String
The name of the IoT Device Provisioning Service that this certificate will be attached to. Changing this forces a new resource to be created.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group under which the Iot Device Provisioning Service Certificate resource has to be created. Changing this forces a new resource to be created.
isVerified Changes to this property will trigger replacement. Boolean
Specifies if the certificate is created in verified state. Defaults to false. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. String
Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the IotHubCertificate 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 IotHubCertificate Resource

Get an existing IotHubCertificate 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?: IotHubCertificateState, opts?: CustomResourceOptions): IotHubCertificate
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        certificate_content: Optional[str] = None,
        iot_dps_name: Optional[str] = None,
        is_verified: Optional[bool] = None,
        name: Optional[str] = None,
        resource_group_name: Optional[str] = None) -> IotHubCertificate
func GetIotHubCertificate(ctx *Context, name string, id IDInput, state *IotHubCertificateState, opts ...ResourceOption) (*IotHubCertificate, error)
public static IotHubCertificate Get(string name, Input<string> id, IotHubCertificateState? state, CustomResourceOptions? opts = null)
public static IotHubCertificate get(String name, Output<String> id, IotHubCertificateState state, CustomResourceOptions options)
resources:  _:    type: azure:iot:IotHubCertificate    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:
CertificateContent string
The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
IotDpsName Changes to this property will trigger replacement. string
The name of the IoT Device Provisioning Service that this certificate will be attached to. Changing this forces a new resource to be created.
IsVerified Changes to this property will trigger replacement. bool
Specifies if the certificate is created in verified state. Defaults to false. Changing this forces a new resource to be created.
Name Changes to this property will trigger replacement. string
Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the resource group under which the Iot Device Provisioning Service Certificate resource has to be created. Changing this forces a new resource to be created.
CertificateContent string
The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
IotDpsName Changes to this property will trigger replacement. string
The name of the IoT Device Provisioning Service that this certificate will be attached to. Changing this forces a new resource to be created.
IsVerified Changes to this property will trigger replacement. bool
Specifies if the certificate is created in verified state. Defaults to false. Changing this forces a new resource to be created.
Name Changes to this property will trigger replacement. string
Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the resource group under which the Iot Device Provisioning Service Certificate resource has to be created. Changing this forces a new resource to be created.
certificateContent String
The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
iotDpsName Changes to this property will trigger replacement. String
The name of the IoT Device Provisioning Service that this certificate will be attached to. Changing this forces a new resource to be created.
isVerified Changes to this property will trigger replacement. Boolean
Specifies if the certificate is created in verified state. Defaults to false. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. String
Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
The name of the resource group under which the Iot Device Provisioning Service Certificate resource has to be created. Changing this forces a new resource to be created.
certificateContent string
The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
iotDpsName Changes to this property will trigger replacement. string
The name of the IoT Device Provisioning Service that this certificate will be attached to. Changing this forces a new resource to be created.
isVerified Changes to this property will trigger replacement. boolean
Specifies if the certificate is created in verified state. Defaults to false. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. string
Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. string
The name of the resource group under which the Iot Device Provisioning Service Certificate resource has to be created. Changing this forces a new resource to be created.
certificate_content str
The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
iot_dps_name Changes to this property will trigger replacement. str
The name of the IoT Device Provisioning Service that this certificate will be attached to. Changing this forces a new resource to be created.
is_verified Changes to this property will trigger replacement. bool
Specifies if the certificate is created in verified state. Defaults to false. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. str
Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
resource_group_name Changes to this property will trigger replacement. str
The name of the resource group under which the Iot Device Provisioning Service Certificate resource has to be created. Changing this forces a new resource to be created.
certificateContent String
The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
iotDpsName Changes to this property will trigger replacement. String
The name of the IoT Device Provisioning Service that this certificate will be attached to. Changing this forces a new resource to be created.
isVerified Changes to this property will trigger replacement. Boolean
Specifies if the certificate is created in verified state. Defaults to false. Changing this forces a new resource to be created.
name Changes to this property will trigger replacement. String
Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
The name of the resource group under which the Iot Device Provisioning Service Certificate resource has to be created. Changing this forces a new resource to be created.

Import

IoTHub Device Provisioning Service Certificates can be imported using the resource id, e.g.

$ pulumi import azure:iot/iotHubCertificate:IotHubCertificate example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/provisioningServices/example/certificates/example
Copy

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

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.