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:

The body contains the certificate.

NameDatatypeDescription
idstringThe resource identifier.
namestringThe name of the certificate.
etagstringThe entity tag.
propertiesobjectThe description of an X509 CA Certificate.
typestringThe resource type.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectsubscriptionId, resourceGroupName, resourceName, certificateNameapi-versionReturns the certificate.
list_by_iot_hubselectsubscriptionId, resourceGroupName, resourceNameapi-versionReturns the list of certificates.
create_or_updateinsertsubscriptionId, resourceGroupName, resourceName, certificateNameapi-version, If-MatchAdds new or replaces existing certificate.
deletedeletesubscriptionId, resourceGroupName, resourceName, certificateName, If-Matchapi-versionDeletes an existing X509 certificate or does nothing if it does not exist.
generate_verification_codeexecsubscriptionId, resourceGroupName, resourceName, certificateName, If-Matchapi-versionGenerates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate.
verifyexecsubscriptionId, resourceGroupName, resourceName, certificateName, If-Matchapi-versionVerifies 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
If-MatchstringETag of the Certificate.
certificateNamestringThe name of the certificate
resourceGroupNamestringThe name of the resource group that contains the IoT hub.
resourceNamestringThe name of the IoT hub.
subscriptionIdstringThe subscription identifier.
If-MatchstringETag of the Certificate. Do not specify for creating a brand new certificate. Required to update an existing certificate.
api-versionstringThe version of the API.

SELECT examples

Returns the certificate.

SELECT
id,
name,
etag,
properties,
type
FROM azure.iot_hub.certificates
WHERE subscriptionId = '{{ subscriptionId }}' -- required
AND resourceGroupName = '{{ resourceGroupName }}' -- required
AND resourceName = '{{ resourceName }}' -- required
AND certificateName = '{{ certificateName }}' -- required
AND api-version = '{{ api-version }}'
;

INSERT examples

Adds new or replaces existing certificate.

INSERT INTO azure.iot_hub.certificates (
data__properties,
subscriptionId,
resourceGroupName,
resourceName,
certificateName,
api-version,
If-Match
)
SELECT
'{{ properties }}',
'{{ subscriptionId }}',
'{{ resourceGroupName }}',
'{{ resourceName }}',
'{{ certificateName }}',
'{{ api-version }}',
'{{ If-Match }}'
RETURNING
id,
name,
etag,
properties,
type
;

DELETE examples

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

DELETE FROM azure.iot_hub.certificates
WHERE subscriptionId = '{{ subscriptionId }}' --required
AND resourceGroupName = '{{ resourceGroupName }}' --required
AND resourceName = '{{ resourceName }}' --required
AND certificateName = '{{ certificateName }}' --required
AND If-Match = '{{ If-Match }}' --required
AND api-version = '{{ api-version }}'
;

Lifecycle Methods

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 
@subscriptionId='{{ subscriptionId }}' --required,
@resourceGroupName='{{ resourceGroupName }}' --required,
@resourceName='{{ resourceName }}' --required,
@certificateName='{{ certificateName }}' --required,
@If-Match='{{ If-Match }}' --required,
@api-version='{{ api-version }}'
;