IoTHub and Device Connection Strings

Damir Dobric Posts

Next talks:



Follow me on Twitter: #ddobric




IoTHub introduce new kind of connection string called Device Connection string. To create device client instance you can do following:

var client = DeviceClient.Create(“”,
new DeviceAuthenticationWithRegistrySymmetricKey("DEVNAME"
, “uck7p18***pDTIA2”));

However, for practical reasons Device Connection String might more often be used. Here is one example:;DeviceId=DEVICENAME;SharedAccessKey=uck7p18***pDTIA2

Following example shows how the string and client can be built from key and device name:

string connStr = String.Format("HostName={0};DeviceId={1};SharedAccessKey={2}", "daenethub", "D001", m_DeviceKey);


var client = DeviceClient.CreateFromConnectionString(connStr);

Posted Oct 13 2015, 04:06 PM by Damir Dobric is a .Net Community Blog powered by daenet GmbH.