We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
Manages an IotHub Device Provisioning Service Certificate.
Example Usage
using System;
using System.IO;
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
private static string ReadFileBase64(string path) {
return Convert.ToBase64String(Encoding.UTF8.GetBytes(File.ReadAllText(path)))
}
public MyStack()
{
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
{
Location = "West Europe",
});
var exampleIotHubDps = new Azure.Iot.IotHubDps("exampleIotHubDps", new Azure.Iot.IotHubDpsArgs
{
ResourceGroupName = exampleResourceGroup.Name,
Location = exampleResourceGroup.Location,
Sku = new Azure.Iot.Inputs.IotHubDpsSkuArgs
{
Name = "S1",
Capacity = 1,
},
});
var exampleIotHubCertificate = new Azure.Iot.IotHubCertificate("exampleIotHubCertificate", new Azure.Iot.IotHubCertificateArgs
{
ResourceGroupName = exampleResourceGroup.Name,
IotDpsName = exampleIotHubDps.Name,
CertificateContent = ReadFileBase64("example.cer"),
});
}
}
package main
import (
"encoding/base64"
"io/ioutil"
"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/iot"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func filebase64OrPanic(path string) pulumi.StringPtrInput {
if fileData, err := ioutil.ReadFile(path); err == nil {
return pulumi.String(base64.StdEncoding.EncodeToString(fileData[:]))
} else {
panic(err.Error())
}
}
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleIotHubDps, err := iot.NewIotHubDps(ctx, "exampleIotHubDps", &iot.IotHubDpsArgs{
ResourceGroupName: exampleResourceGroup.Name,
Location: exampleResourceGroup.Location,
Sku: &iot.IotHubDpsSkuArgs{
Name: pulumi.String("S1"),
Capacity: pulumi.Int(1),
},
})
if err != nil {
return err
}
_, err = iot.NewIotHubCertificate(ctx, "exampleIotHubCertificate", &iot.IotHubCertificateArgs{
ResourceGroupName: exampleResourceGroup.Name,
IotDpsName: exampleIotHubDps.Name,
CertificateContent: filebase64OrPanic("example.cer"),
})
if err != nil {
return err
}
return nil
})
}
Example coming soon!
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
import * from "fs";
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleIotHubDps = new azure.iot.IotHubDps("exampleIotHubDps", {
resourceGroupName: exampleResourceGroup.name,
location: exampleResourceGroup.location,
sku: {
name: "S1",
capacity: "1",
},
});
const exampleIotHubCertificate = new azure.iot.IotHubCertificate("exampleIotHubCertificate", {
resourceGroupName: exampleResourceGroup.name,
iotDpsName: exampleIotHubDps.name,
certificateContent: Buffer.from(fs.readFileSync("example.cer"), 'binary').toString('base64'),
});
import pulumi
import base64
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_iot_hub_dps = azure.iot.IotHubDps("exampleIotHubDps",
resource_group_name=example_resource_group.name,
location=example_resource_group.location,
sku=azure.iot.IotHubDpsSkuArgs(
name="S1",
capacity=1,
))
example_iot_hub_certificate = azure.iot.IotHubCertificate("exampleIotHubCertificate",
resource_group_name=example_resource_group.name,
iot_dps_name=example_iot_hub_dps.name,
certificate_content=(lambda path: base64.b64encode(open(path).read().encode()).decode())("example.cer"))
Example coming soon!
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,
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 string
- The unique name of the resource.
- args IotHubCertificateArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args 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 string
- The unique name of the resource.
- args IotHubCertificateArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args IotHubCertificateArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args 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",
Name = "string",
});
example, err := iot.NewIotHubCertificate(ctx, "iotHubCertificateResource", &iot.IotHubCertificateArgs{
CertificateContent: pulumi.String("string"),
IotDpsName: pulumi.String("string"),
ResourceGroupName: pulumi.String("string"),
Name: pulumi.String("string"),
})
var iotHubCertificateResource = new IotHubCertificate("iotHubCertificateResource", IotHubCertificateArgs.builder()
.certificateContent("string")
.iotDpsName("string")
.resourceGroupName("string")
.name("string")
.build());
iot_hub_certificate_resource = azure.iot.IotHubCertificate("iotHubCertificateResource",
certificate_content="string",
iot_dps_name="string",
resource_group_name="string",
name="string")
const iotHubCertificateResource = new azure.iot.IotHubCertificate("iotHubCertificateResource", {
certificateContent: "string",
iotDpsName: "string",
resourceGroupName: "string",
name: "string",
});
type: azure:iot:IotHubCertificate
properties:
certificateContent: string
iotDpsName: string
name: string
resourceGroupName: string
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:
- Certificate
Content string - The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
- Iot
Dps stringName - 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 stringName - 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.
- Name string
- Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
- Certificate
Content string - The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
- Iot
Dps stringName - 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 stringName - 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.
- Name string
- Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
- certificate
Content String - The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
- iot
Dps StringName - 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 StringName - 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.
- name String
- Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
- certificate
Content string - The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
- iot
Dps stringName - 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 stringName - 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.
- name string
- Specifies the name of the Iot Device Provisioning Service Certificate resource. 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_ strname - 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_ strname - 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.
- name str
- Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
- certificate
Content String - The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
- iot
Dps StringName - 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 StringName - 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.
- name 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,
name: Optional[str] = None,
resource_group_name: Optional[str] = None) -> IotHubCertificatefunc 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
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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.
- Certificate
Content string - The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
- Iot
Dps stringName - The name of the IoT Device Provisioning Service that this certificate will be attached to. Changing this forces a new resource to be created.
- Name string
- Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
- Resource
Group stringName - 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 string - The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
- Iot
Dps stringName - The name of the IoT Device Provisioning Service that this certificate will be attached to. Changing this forces a new resource to be created.
- Name string
- Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
- Resource
Group stringName - 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 String - The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
- iot
Dps StringName - The name of the IoT Device Provisioning Service that this certificate will be attached to. Changing this forces a new resource to be created.
- name String
- Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
- resource
Group StringName - 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 string - The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
- iot
Dps stringName - The name of the IoT Device Provisioning Service that this certificate will be attached to. Changing this forces a new resource to be created.
- name string
- Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
- resource
Group stringName - 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_ strname - The name of the IoT Device Provisioning Service that this certificate will be attached to. Changing this forces a new resource to be created.
- name str
- Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
- resource_
group_ strname - 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 String - The Base-64 representation of the X509 leaf certificate .cer file or just a .pem file content.
- iot
Dps StringName - The name of the IoT Device Provisioning Service that this certificate will be attached to. Changing this forces a new resource to be created.
- name String
- Specifies the name of the Iot Device Provisioning Service Certificate resource. Changing this forces a new resource to be created.
- resource
Group StringName - 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
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
azurermTerraform Provider.
We recommend using Azure Native.
published on Monday, Mar 9, 2026 by Pulumi
