Skip to main content

certificates

Creates, updates, deletes, gets or lists a certificates resource.

Overview

Namecertificates
TypeResource
Idazure.iot_hub.certificates

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
certificatestringThe certificate content.
createdstring (date-time)The certificate's create date and time.
etagstringThe entity tag.
expirystring (date-time)The certificate's expiration date and time.
isVerifiedbooleanDetermines whether certificate has been verified.
policyResourceIdstringThe reference to policy stored in Azure Device Registry (ADR).
subjectstringThe certificate's subject name.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
thumbprintstringThe certificate's thumbprint.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
updatedstring (date-time)The certificate's last update date and time.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, resource_name, certificate_name, subscription_idGet the certificate. Returns the certificate.
list_by_iot_hubselectresource_group_name, resource_name, subscription_idGet the certificate list. Returns the list of certificates.
create_or_updateinsertresource_group_name, resource_name, certificate_name, subscription_idUpload the certificate to the IoT hub. Adds new or replaces existing certificate.
create_or_updatereplaceresource_group_name, resource_name, certificate_name, subscription_idUpload the certificate to the IoT hub. Adds new or replaces existing certificate.
deletedeleteresource_group_name, resource_name, certificate_name, subscription_idDelete an X509 certificate. Deletes an existing X509 certificate or does nothing if it does not exist.
generate_verification_codeexecresource_group_name, resource_name, certificate_name, subscription_idGenerate verification code for proof of possession flow. Generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate.
verifyexecresource_group_name, resource_name, certificate_name, subscription_idVerify certificate's private key possession. Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
certificate_namestringThe name of the certificate. Required.
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
resource_namestringThe name of the IoT hub. Required.
subscription_idstring

SELECT examples

Get the certificate. Returns the certificate.

SELECT
id,
name,
certificate,
created,
etag,
expiry,
isVerified,
policyResourceId,
subject,
systemData,
thumbprint,
type,
updated
FROM azure.iot_hub.certificates
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND resource_name = '{{ resource_name }}' -- required
AND certificate_name = '{{ certificate_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;

INSERT examples

Upload the certificate to the IoT hub. Adds new or replaces existing certificate.

INSERT INTO azure.iot_hub.certificates (
properties,
resource_group_name,
resource_name,
certificate_name,
subscription_id
)
SELECT
'{{ properties }}',
'{{ resource_group_name }}',
'{{ resource_name }}',
'{{ certificate_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
etag,
properties,
systemData,
type
;

REPLACE examples

Upload the certificate to the IoT hub. Adds new or replaces existing certificate.

REPLACE azure.iot_hub.certificates
SET
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND resource_name = '{{ resource_name }}' --required
AND certificate_name = '{{ certificate_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
etag,
properties,
systemData,
type;

DELETE examples

Delete an X509 certificate. Deletes an existing X509 certificate or does nothing if it does not exist.

DELETE FROM azure.iot_hub.certificates
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND resource_name = '{{ resource_name }}' --required
AND certificate_name = '{{ certificate_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;

Lifecycle Methods

Generate verification code for proof of possession flow. Generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate.

EXEC azure.iot_hub.certificates.generate_verification_code 
@resource_group_name='{{ resource_group_name }}' --required,
@resource_name='{{ resource_name }}' --required,
@certificate_name='{{ certificate_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;