bba2267a15
* Partial fixes for -Wstrict-prototypes * Adding strict-prototypes gate check. * Updating submodules. * Update CMakeLists.txt Co-authored-by: Eric Wolz <ericwol@microsoft.com> Co-authored-by: Eric Wolz <ericwol@microsoft.com> |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
prov_sc_enrollment_group_sample.c | ||
readme.md |
readme.md
Provisioning Service Client Sample for Enrollment Group
Overview
This is a quick tutorial with the steps to create, update, get, and delete an Enrollment Group on the Microsoft Azure IoT Hub Device Provisioning Service using the C SDK.
References
How to run the sample on Linux or Windows
-
Clone the C SDK repository
-
Compile the C SDK as shown here, using the
-Duse_prov_client=ON
flag. -
Edit
provisioning_enrollment_group_sample.c
to add your provisioning service information:- Replace the
[Connection String]
with the Provisioning Connection String copied from your Device Provisiong Service on the Portal.const char* connectionString = "[Connection String]";
- Replace the
[Group Id]
with your chosen Group Id. - For using a Signing Certificate (as shown in the sample):
- Replace the
[Signing Certificate]
with your signing certificate. You can use a physical device with DICE, or use a certificate you generate yourself. One possible way to do this is to use the included CA Certificates Tool.
Note that a certificate format can be just the Base 64 encoding, or can include theconst char* signingCertificate = "[Signing Certificate]";
-----BEGIN CERTIFICATE-----
and-----END CERTIFICATE-----
tags, either works.
- Replace the
- For using a CA Certificate Reference (not shown in this sample):
-
Define a variable
caReference
, and set it to the name of the CA Certificate you have generated on the Portal.const char* caReference = "[CA Reference]"
-
Replace the Signing Certificate x509 Attestation Mechanism in the sample with a CA Reference x509 Attestation Mechanism
Replace
if ((am_handle = attestationMechanism_createWithX509SigningCert(signingCertificate, NULL)) == NULL) { printf("Failed calling attestationMechanism_createX509SigningCert\n"); result = MU_FAILURE; }
With
if ((am_handle = attestationMechanism_createWithX509CAReference(caReference, NULL)) == NULL) { printf("Failed calling attestationMechansim_createX509CAReference\n"); result = MU_FAILURE; }
-
- Replace the
-
Build as shown here and run the sample.