Skip to content

Commit c2dcdde

Browse files
committed
Edits to connection string sections
1 parent c6d01b1 commit c2dcdde

File tree

4 files changed

+22
-19
lines changed

4 files changed

+22
-19
lines changed

includes/iot-hub-howto-file-upload-dotnet.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ Follow this procedure to upload a file from a device to IoT hub:
3131

3232
### Connect to IoT hub
3333

34-
Call [CreateFromConnectionString](/dotnet/api/microsoft.azure.devices.client.deviceclient.createfromconnectionstring?#microsoft-azure-devices-client-deviceclient-createfromconnectionstring(system-string)) method to connect to IoT hub. See the prerequisites section for how to look up the IoT hub primary connection string.
34+
Call [CreateFromConnectionString](/dotnet/api/microsoft.azure.devices.client.deviceclient.createfromconnectionstring?#microsoft-azure-devices-client-deviceclient-createfromconnectionstring(system-string)) to connect to IoT hub. See the prerequisites section for how to look up the device primary connection string.
3535

3636
`AMQP` is the default transport protocol.
3737

3838
``` csharp
39-
static string connectionString = "{IoT hub primary connection string}";
39+
static string connectionString = "{device primary connection string}";
4040
deviceClient = DeviceClient.CreateFromConnectionString(connectionString);
4141
```
4242

@@ -53,7 +53,7 @@ var fileUploadSasUriRequest = new FileUploadSasUriRequest
5353
BlobName = fileName
5454
};
5555

56-
FileUploadSasUriResponse sasUri = await _deviceClient.GetFileUploadSasUriAsync(fileUploadSasUriRequest);
56+
FileUploadSasUriResponse sasUri = await _deviceClient.GetFileUploadSasUriAsync(fileUploadSasUriRequest, System.Threading.CancellationToken cancellationToken = default);
5757
Uri uploadUri = sasUri.GetBlobUri();
5858
```
5959

@@ -63,15 +63,15 @@ To upload a file to Azure storage:
6363

6464
* Create a [blockBlobClient](/dotnet/api/azure.storage.blobs.specialized.blockblobclient) object, passing a file upload URI
6565

66-
* Use the [UploadAsync](/dotnet/api/azure.storage.blobs.specialized.blockblobclient.uploadasync?#azure-storage-blobs-specialized-blockblobclient-uploadasync(system-io-stream-azure-storage-blobs-models-blobuploadoptions-system-threading-cancellationtoken)) method to upload a file to Blob Storage, passing the SAS URI
66+
* Use the [UploadAsync](/dotnet/api/azure.storage.blobs.specialized.blockblobclient.uploadasync?#azure-storage-blobs-specialized-blockblobclient-uploadasync(system-io-stream-azure-storage-blobs-models-blobuploadoptions-system-threading-cancellationtoken)) method to upload a file to Blob Storage, passing the SAS URI. You can optionally add Blob upload options and cancellation token parameters.
6767

6868
The Azure Blob client always uses HTTPS as the protocol to upload the file to Azure Storage.
6969

7070
In this example, `BlockBlobClient` is passed the SAS URI to create an Azure Storage block Blob client and uploads the file:
7171

7272
```csharp
7373
var blockBlobClient = new BlockBlobClient(uploadUri);
74-
await blockBlobClient.UploadAsync(fileStreamSource, new BlobUploadOptions());
74+
await blockBlobClient.UploadAsync(fileStreamSource, null, null);
7575
```
7676

7777
### Notify IoT hub of the file upload status
@@ -111,9 +111,12 @@ The [ServiceClient](/dotnet/api/microsoft.azure.devices.serviceclient) class con
111111

112112
To receive file upload notification:
113113

114-
* Create a [CancellationToken](/dotnet/api/azure.core.httpmessage.cancellationtoken?#azure-core-httpmessage-cancellationtoken)
115-
* Call [GetFileNotificationReceiver](/dotnet/api/microsoft.azure.devices.serviceclient.getfilenotificationreceiver?#microsoft-azure-devices-serviceclient-getfilenotificationreceiver) to create a notification receiver
116-
* Use a loop with [ReceiveAsync](/dotnet/api/microsoft.azure.devices.receiver-1.receiveasync?#microsoft-azure-devices-receiver-1-receiveasync(system-threading-cancellationtoken)) to wait for the file upload notification
114+
* Call [CreateFromConnectionString](/dotnet/api/microsoft.azure.devices.serviceclient.createfromconnectionstring?view=azure-dotnet&branch=main) to connect to IoT hub. Pass the IoT hub connection string. See the prerequisites section for how to look up the IoT hub primary connection string.
115+
* Create a [CancellationToken](/dotnet/api/azure.core.httpmessage.cancellationtoken?#azure-core-httpmessage-cancellationtoken).
116+
* Call [GetFileNotificationReceiver](/dotnet/api/microsoft.azure.devices.serviceclient.getfilenotificationreceiver?#microsoft-azure-devices-serviceclient-getfilenotificationreceiver) to create a notification receiver.
117+
* Use a loop with [ReceiveAsync](/dotnet/api/microsoft.azure.devices.receiver-1.receiveasync?#microsoft-azure-devices-receiver-1-receiveasync(system-threading-cancellationtoken)) to wait for the file upload notification.
118+
119+
For example:
117120

118121
```csharp
119122
using Microsoft.Azure.Devices;

includes/iot-hub-howto-file-upload-java.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This section describes how to upload a file from a device to an IoT hub using th
2424

2525
Follow this procedure to upload a file from a device to IoT hub:
2626

27-
* Connect to IoT hub
27+
* Connect to the device
2828
* Get a SAS URI from IoT hub
2929
* Upload the file to Azure Storage
3030
* Send file upload status notification to IoT hub
@@ -37,9 +37,9 @@ File upload operations always use HTTPS, but [DeviceClient](/java/api/com.micros
3737
IotHubClientProtocol protocol = IotHubClientProtocol.MQTT;
3838
```
3939

40-
### Connect to IoT hub
40+
### Connect to the device
4141

42-
Instantiate the `DeviceClient` to connect to IoT hub using the IoT hub primary connection string. See the prerequisites section for how to look up the IoT hub primary connection string.
42+
Instantiate the `DeviceClient` to connect to the device using the device primary connection string. See the prerequisites section for how to look up the device primary connection string.
4343

4444
```java
4545
String connString = "{IoT hub connection string}";
@@ -127,10 +127,10 @@ The [ServiceClient](/java/api/com.azure.core.annotation.serviceclient) class con
127127

128128
Create a `IotHubServiceClientProtocol` object. The connection uses the `AMQPS` protocol.
129129

130-
Call `createFromConnectionString` to connect to IoT hub.
130+
Call `createFromConnectionString` to connect to IoT hub. Pass the IoT hub primary connection string. See the prerequisites section for how to look up the IoT hub primary connection string.
131131

132132
```java
133-
private static final String connectionString = "{IoT hub service connection string}";
133+
private static final String connectionString = "{IoT hub primary connection string}";
134134
private static final IotHubServiceClientProtocol protocol = IotHubServiceClientProtocol.AMQPS;
135135
ServiceClient sc = ServiceClient.createFromConnectionString(connectionString, protocol);
136136
```

includes/iot-hub-howto-file-upload-node.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const path = require('path');
5151

5252
### Get a SAS URI from IoT hub
5353

54-
Use [getBlobSharedAccessSignature](/javascript/api/azure-iot-device/client?#azure-iot-device-client-getblobsharedaccesssignature) to get the linked storage account SAS token from IoT hub.
54+
Use [getBlobSharedAccessSignature](/javascript/api/azure-iot-device/client?#azure-iot-device-client-getblobsharedaccesssignature) to get the linked storage account SAS token from IoT hub. As described in prerequisites, the IoT hub is linked to the Blob Storage.
5555

5656
For example:
5757

includes/iot-hub-howto-file-upload-python.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This section describes how to upload a file from a device to an IoT hub using th
3131

3232
Follow this procedure to upload a file from a device to IoT hub:
3333

34-
* Connect to IoT hub
34+
* Connect to the device
3535
* Get Blob Storage information
3636
* Upload the file to Blob Storage
3737
* Notify IoT hub of upload status
@@ -45,17 +45,17 @@ from azure.core.exceptions import AzureError
4545
from azure.storage.blob import BlobClient
4646
```
4747

48-
### Connect to IoT hub
48+
### Connect to the device
4949

50-
Call [create_from_connection_string](/python/api/azure-iot-device/azure.iot.device.iothubdeviceclient?#azure-iot-device-iothubdeviceclient-create-from-connection-string) to add the IoT hub primary connection string. See the prerequisites section for how to look up the IoT hub primary connection string.
50+
Call [create_from_connection_string](/python/api/azure-iot-device/azure.iot.device.iothubdeviceclient?#azure-iot-device-iothubdeviceclient-create-from-connection-string) to add the device primary connection string. See the prerequisites section for how to look up the device primary connection string.
5151

52-
Then call [connect](/python/api/azure-iot-device/azure.iot.device.iothubdeviceclient?#azure-iot-device-iothubdeviceclient-connect) to connect the device client to an Azure IoT hub.
52+
Then call [connect](/python/api/azure-iot-device/azure.iot.device.iothubdeviceclient?#azure-iot-device-iothubdeviceclient-connect) to connect the device client.
5353

5454
For example:
5555

5656
```python
5757
# Add your IoT hub primary connection string
58-
CONNECTION_STRING = "{IoT hub connection string}"
58+
CONNECTION_STRING = "{Device primary connection string}"
5959
device_client = IoTHubDeviceClient.create_from_connection_string(CONNECTION_STRING)
6060

6161
# Connect the client

0 commit comments

Comments
 (0)