@QuantumCache ,
Can you confirm the Azure DPS connection using SAS token is supported in the https://github.com/Azure/azure-sdk-for-c/releases/tag/1.1.0 ? Im seeing connection refuse from the Azure server. Followed the links mentioned in this thread to generate SAS tokens.
DPS SAS token generation not working
Hi All,
I have few questions about Azure DPS connection and registration using SAS tokens. I'm referring to the sample application in the repo https://github.com/Azure/azure-sdk-for-c/blob/master/sdk/samples/iot/paho_iot_provisioning_sample.c
- "provisioning_registration_id", Is registration_id same as the the one mentioned in Azure account Manage enrollments->Individual Enrollments->REGISTRATION ID .
- How to generate SAS tokens for DPS? I'm not using x86 openssl. For HUB type, SAS token can be generated using Visual Studio Code. Similar mechanism is available?
I need SAS token to generate password.
Any support for the above will be of great help!
Thanks,
Arun
6 answers
Sort by: Newest
-
Arun S 1 Reputation point
2021-03-25T09:55:03.487+00:00 -
Arun S 1 Reputation point
2021-03-24T04:08:44.753+00:00 @QuantumCache Trying to connect DPS using SAS tokens and Symmetric key where client as "Azure SDK for C" code..
Used Python script to generate the SAS tokens (def generate_sas_token(uri, key, policy_name, expiry=3600):
uri -> (test-dps.azure-devices-provisioning.net)
key -> Symmetric Key ->primary key
policy_name -> NoneWith above configurations & python script im able to generate below SAS token
SharedAccessSignature sr=test-dps.azure-devices-provisioning.net&sig=daP5K1GGeVFFghkkT2X4SX8iBLaO07rmtsPgMuzSmrc%3D&se=1616557869Username is generated using SDK APi az_iot_provisioning_client_get_user_name()
Above SAS token is used as password during Azure MQTT connectionObservation: Connection refused from the Azure server for MQTT connect request
Query:- Everytime "se" value in the SAS token will change, do we need to link the same in the Azure DPS portal?
- Do symmetric key has to be linked in the application as referenced in prov_dev_set_symmetric_key_info()
-
S Arun (CSTIPL CSS ICW SW PSW 1) 1 Reputation point
2021-03-24T04:05:54.837+00:00 @QuantumCache Trying to connect DPS using SAS tokens and Symmetric key where client as "Azure SDK for C" code..
Used Python script to generate the SAS tokens (def generate_sas_token(uri, key, policy_name, expiry=3600):
uri -> (test-dps.azure-devices-provisioning.net)
key -> Symmetric Key ->primary key
policy_name -> NoneWith above configurations & python script im able to generate below SAS token
SharedAccessSignature sr=test-dps.azure-devices-provisioning.net&sig=daP5K1GGeVFFghkkT2X4SX8iBLaO07rmtsPgMuzSmrc%3D&se=1616557869Username is generated using SDK APi az_iot_provisioning_client_get_user_name()
Above SAS token is used as password during Azure MQTT connectionObservation: Connection refused from the Azure server for MQTT connect request
Query:- Everytime "se" value in the SAS token will change, do we need to link the same in the Azure DPS portal?
- Do symmetric key has to be linked in the application as referenced in prov_dev_set_symmetric_key_info()
-
S Arun (CSTIPL CSS ICW SW PSW 1) 1 Reputation point
2021-03-24T04:02:55.13+00:00 @QuantumCache Trying to connect DPS using SAS tokens and Symmetric key where client as "Azure SDK for C" code..
Used Python script to generate the SAS tokens (def generate_sas_token(uri, key, policy_name, expiry=3600):
uri -> (test-dps.azure-devices-provisioning.net)
key -> Symmetric Key ->primary key
policy_name -> NoneWith above configurations & python script im able to generate below SAS token
SharedAccessSignature sr=test-dps.azure-devices-provisioning.net&sig=daP5K1GGeVFFghkkT2X4SX8iBLaO07rmtsPgMuzSmrc%3D&se=1616557869Username is generated using SDK APi az_iot_provisioning_client_get_user_name()
Above SAS token is used as password during Azure MQTT connectionObservation: Connection refused from the Azure server for MQTT connect request
Query:- Everytime "se" value in the SAS token will change, do we need to link the same in the Azure DPS portal?
- Do symmetric key has to be linked in the application as referenced in prov_dev_set_symmetric_key_info()
-
S Arun (CSTIPL CSS ICW SW PSW 1) 1 Reputation point
2021-03-18T03:56:22.3+00:00 @QuantumCache
Sorry for late response.
Im still facing connection failure for DPS using SAS tokens. I followed the links you shared in this thread.Below is the procedure followed,
- Created IoT hub for SAS tokens. This i'm able to successfully connect and run IoT hub sample applications.
- Created DPS service, linked the IoT hub, Added enrollment.
- Since im not using openssl i generated username and password locally. Here is the example of configuraitons im using it. Port [8883], username [test-dps.azure-devices-provisioning.net/deviceID01/?api-version=2018-06-30] and connection_password [https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-security#security-token-structure] used this link to generate manually.
Query:
- For IoT Hub i'm able to generate SAS tokens using visual code->"generate SAS Token for Device". Is there any similar way to generate the SAS tokens for DPS?
Any support on this will be helpful.