We recommend using Azure Native.
azure.iot.Certificate
Explore with Pulumi AI
Manages an IotHub 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 exampleIoTHub = new azure.iot.IoTHub("example", {
name: "example",
resourceGroupName: example.name,
location: example.location,
sku: {
name: "B1",
capacity: 1,
},
});
const exampleCertificate = new azure.iot.Certificate("example", {
name: "example",
resourceGroupName: example.name,
iothubName: exampleIoTHub.name,
isVerified: true,
certificateContent: std.filebase64({
input: "example.cer",
}).then(invoke => invoke.result),
});
import pulumi
import pulumi_azure as azure
import pulumi_std as std
example = azure.core.ResourceGroup("example",
name="example-resources",
location="West Europe")
example_io_t_hub = azure.iot.IoTHub("example",
name="example",
resource_group_name=example.name,
location=example.location,
sku={
"name": "B1",
"capacity": 1,
})
example_certificate = azure.iot.Certificate("example",
name="example",
resource_group_name=example.name,
iothub_name=example_io_t_hub.name,
is_verified=True,
certificate_content=std.filebase64(input="example.cer").result)
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
}
exampleIoTHub, err := iot.NewIoTHub(ctx, "example", &iot.IoTHubArgs{
Name: pulumi.String("example"),
ResourceGroupName: example.Name,
Location: example.Location,
Sku: &iot.IoTHubSkuArgs{
Name: pulumi.String("B1"),
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.NewCertificate(ctx, "example", &iot.CertificateArgs{
Name: pulumi.String("example"),
ResourceGroupName: example.Name,
IothubName: exampleIoTHub.Name,
IsVerified: pulumi.Bool(true),
CertificateContent: pulumi.String(invokeFilebase64.Result),
})
if err != nil {
return err
}
return nil
})
}
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 exampleIoTHub = new Azure.Iot.IoTHub("example", new()
{
Name = "example",
ResourceGroupName = example.Name,
Location = example.Location,
Sku = new Azure.Iot.Inputs.IoTHubSkuArgs
{
Name = "B1",
Capacity = 1,
},
});
var exampleCertificate = new Azure.Iot.Certificate("example", new()
{
Name = "example",
ResourceGroupName = example.Name,
IothubName = exampleIoTHub.Name,
IsVerified = true,
CertificateContent = Std.Filebase64.Invoke(new()
{
Input = "example.cer",
}).Apply(invoke => invoke.Result),
});
});
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.IoTHub;
import com.pulumi.azure.iot.IoTHubArgs;
import com.pulumi.azure.iot.inputs.IoTHubSkuArgs;
import com.pulumi.azure.iot.Certificate;
import com.pulumi.azure.iot.CertificateArgs;
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 exampleIoTHub = new IoTHub("exampleIoTHub", IoTHubArgs.builder()
.name("example")
.resourceGroupName(example.name())
.location(example.location())
.sku(IoTHubSkuArgs.builder()
.name("B1")
.capacity("1")
.build())
.build());
var exampleCertificate = new Certificate("exampleCertificate", CertificateArgs.builder()
.name("example")
.resourceGroupName(example.name())
.iothubName(exampleIoTHub.name())
.isVerified(true)
.certificateContent(StdFunctions.filebase64(Filebase64Args.builder()
.input("example.cer")
.build()).result())
.build());
}
}
resources:
example:
type: azure:core:ResourceGroup
properties:
name: example-resources
location: West Europe
exampleIoTHub:
type: azure:iot:IoTHub
name: example
properties:
name: example
resourceGroupName: ${example.name}
location: ${example.location}
sku:
name: B1
capacity: '1'
exampleCertificate:
type: azure:iot:Certificate
name: example
properties:
name: example
resourceGroupName: ${example.name}
iothubName: ${exampleIoTHub.name}
isVerified: true
certificateContent:
fn::invoke:
Function: std:filebase64
Arguments:
input: example.cer
Return: result
Create Certificate Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Certificate(name: string, args: CertificateArgs, opts?: CustomResourceOptions);
@overload
def Certificate(resource_name: str,
args: CertificateArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Certificate(resource_name: str,
opts: Optional[ResourceOptions] = None,
certificate_content: Optional[str] = None,
iothub_name: Optional[str] = None,
resource_group_name: Optional[str] = None,
is_verified: Optional[bool] = None,
name: Optional[str] = None)
func NewCertificate(ctx *Context, name string, args CertificateArgs, opts ...ResourceOption) (*Certificate, error)
public Certificate(string name, CertificateArgs args, CustomResourceOptions? opts = null)
public Certificate(String name, CertificateArgs args)
public Certificate(String name, CertificateArgs args, CustomResourceOptions options)
type: azure:iot:Certificate
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 CertificateArgs
- 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 CertificateArgs
- 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 CertificateArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CertificateArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args CertificateArgs
- 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 examplecertificateResourceResourceFromIotcertificate = new Azure.Iot.Certificate("examplecertificateResourceResourceFromIotcertificate", new()
{
CertificateContent = "string",
IothubName = "string",
ResourceGroupName = "string",
IsVerified = false,
Name = "string",
});
example, err := iot.NewCertificate(ctx, "examplecertificateResourceResourceFromIotcertificate", &iot.CertificateArgs{
CertificateContent: pulumi.String("string"),
IothubName: pulumi.String("string"),
ResourceGroupName: pulumi.String("string"),
IsVerified: pulumi.Bool(false),
Name: pulumi.String("string"),
})
var examplecertificateResourceResourceFromIotcertificate = new Certificate("examplecertificateResourceResourceFromIotcertificate", CertificateArgs.builder()
.certificateContent("string")
.iothubName("string")
.resourceGroupName("string")
.isVerified(false)
.name("string")
.build());
examplecertificate_resource_resource_from_iotcertificate = azure.iot.Certificate("examplecertificateResourceResourceFromIotcertificate",
certificate_content="string",
iothub_name="string",
resource_group_name="string",
is_verified=False,
name="string")
const examplecertificateResourceResourceFromIotcertificate = new azure.iot.Certificate("examplecertificateResourceResourceFromIotcertificate", {
certificateContent: "string",
iothubName: "string",
resourceGroupName: "string",
isVerified: false,
name: "string",
});
type: azure:iot:Certificate
properties:
certificateContent: string
iothubName: string
isVerified: false
name: string
resourceGroupName: string
Certificate 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 Certificate 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.
- Iothub
Name string - The name of the IoTHub 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 IotHub Certificate resource has to be created. Changing this forces a new resource to be created.
- Is
Verified bool - Is the certificate verified? Defaults to
false
. - Name string
- Specifies the name of the IotHub 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.
- Iothub
Name string - The name of the IoTHub 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 IotHub Certificate resource has to be created. Changing this forces a new resource to be created.
- Is
Verified bool - Is the certificate verified? Defaults to
false
. - Name string
- Specifies the name of the IotHub 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.
- iothub
Name String - The name of the IoTHub 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 IotHub Certificate resource has to be created. Changing this forces a new resource to be created.
- is
Verified Boolean - Is the certificate verified? Defaults to
false
. - name String
- Specifies the name of the IotHub 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.
- iothub
Name string - The name of the IoTHub 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 IotHub Certificate resource has to be created. Changing this forces a new resource to be created.
- is
Verified boolean - Is the certificate verified? Defaults to
false
. - name string
- Specifies the name of the IotHub 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.
- iothub_
name str - The name of the IoTHub 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 IotHub Certificate resource has to be created. Changing this forces a new resource to be created.
- is_
verified bool - Is the certificate verified? Defaults to
false
. - name str
- Specifies the name of the IotHub 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.
- iothub
Name String - The name of the IoTHub 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 IotHub Certificate resource has to be created. Changing this forces a new resource to be created.
- is
Verified Boolean - Is the certificate verified? Defaults to
false
. - name String
- Specifies the name of the IotHub Certificate resource. Changing this forces a new resource to be created.
Outputs
All input properties are implicitly available as output properties. Additionally, the Certificate 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 Certificate Resource
Get an existing Certificate 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?: CertificateState, opts?: CustomResourceOptions): Certificate
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
certificate_content: Optional[str] = None,
iothub_name: Optional[str] = None,
is_verified: Optional[bool] = None,
name: Optional[str] = None,
resource_group_name: Optional[str] = None) -> Certificate
func GetCertificate(ctx *Context, name string, id IDInput, state *CertificateState, opts ...ResourceOption) (*Certificate, error)
public static Certificate Get(string name, Input<string> id, CertificateState? state, CustomResourceOptions? opts = null)
public static Certificate get(String name, Output<String> id, CertificateState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- Iothub
Name string - The name of the IoTHub that this certificate will be attached to. Changing this forces a new resource to be created.
- Is
Verified bool - Is the certificate verified? Defaults to
false
. - Name string
- Specifies the name of the IotHub Certificate resource. Changing this forces a new resource to be created.
- Resource
Group stringName - The name of the resource group under which the IotHub 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.
- Iothub
Name string - The name of the IoTHub that this certificate will be attached to. Changing this forces a new resource to be created.
- Is
Verified bool - Is the certificate verified? Defaults to
false
. - Name string
- Specifies the name of the IotHub Certificate resource. Changing this forces a new resource to be created.
- Resource
Group stringName - The name of the resource group under which the IotHub 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.
- iothub
Name String - The name of the IoTHub that this certificate will be attached to. Changing this forces a new resource to be created.
- is
Verified Boolean - Is the certificate verified? Defaults to
false
. - name String
- Specifies the name of the IotHub Certificate resource. Changing this forces a new resource to be created.
- resource
Group StringName - The name of the resource group under which the IotHub 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.
- iothub
Name string - The name of the IoTHub that this certificate will be attached to. Changing this forces a new resource to be created.
- is
Verified boolean - Is the certificate verified? Defaults to
false
. - name string
- Specifies the name of the IotHub Certificate resource. Changing this forces a new resource to be created.
- resource
Group stringName - The name of the resource group under which the IotHub 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.
- iothub_
name str - The name of the IoTHub that this certificate will be attached to. Changing this forces a new resource to be created.
- is_
verified bool - Is the certificate verified? Defaults to
false
. - name str
- Specifies the name of the IotHub Certificate resource. Changing this forces a new resource to be created.
- resource_
group_ strname - The name of the resource group under which the IotHub 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.
- iothub
Name String - The name of the IoTHub that this certificate will be attached to. Changing this forces a new resource to be created.
- is
Verified Boolean - Is the certificate verified? Defaults to
false
. - name String
- Specifies the name of the IotHub Certificate resource. Changing this forces a new resource to be created.
- resource
Group StringName - The name of the resource group under which the IotHub Certificate resource has to be created. Changing this forces a new resource to be created.
Import
IoTHub Certificates can be imported using the resource id
, e.g.
$ pulumi import azure:iot/certificate:Certificate example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/iotHubs/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
azurerm
Terraform Provider.