1- using System ;
2- using System . Threading . Tasks ;
1+ using Microsoft . Azure . Storage ;
32using Microsoft . Azure . Storage . Blob ;
4- using Microsoft . Azure . Storage ;
53using Microsoft . Azure . Storage . RetryPolicies ;
4+ using System ;
65
76namespace ImportExportDevices
87{
98 public class Program
109 {
11- //user variables -- add a config file and put these in settings?
1210
1311 //IoT Hub connection string. You can get this from the portal.
1412 // Log into https://azure.portal.com, go to Resources, find your hub and select it.
@@ -26,7 +24,7 @@ public class Program
2624 public static string storageAccountConnectionString = "<your storage account connection string>" ;
2725
2826 // Container used to hold the blob containing the list of import/export files.
29- // This is a module-wide variable.
27+ // This is a module-wide variable. If this project doesn't find this container, it will create it.
3028 public static CloudBlobContainer cloudBlobContainer ;
3129
3230 // Name of blob container holding the work data.
@@ -38,11 +36,11 @@ public class Program
3836
3937 public static void Main ( string [ ] args )
4038 {
41- //To use this sample, uncomment the bits you want to see run.
39+ //To use this sample, uncomment the bits you want to run.
4240
4341 //The size of the hub you are using should be able to manage the number of devices
4442 // you want to create and test with.
45- //For example, if you want to create a million devices, don't use a hub with a Basic sku.
43+ //For example, if you want to create a million devices, don't use a hub with a Basic sku!
4644
4745 // You must run this; it creates the blob storage resource.
4846 string containerURI = PrepareStorageForImportExport ( ) ;
@@ -51,27 +49,31 @@ public static void Main(string[] args)
5149 // Add devices to the hub; specify how many. This creates a number of devices
5250 // with partially random hub names.
5351 // This is a good way to test the import -- create a bunch of devices on one hub,
54- // then use this the Copy feature to copy the devices to the other hub.
52+ // then use this the Copy feature to copy the devices to another hub.
5553 // Number of devices to create and add. Default is 10.
5654 //int NumToAdd = 5;
5755 //IoTHubDevices.GenerateAndAddDevices(IoTHubConnectionString, cloudBlobContainer,
5856 // containerURI, NumToAdd, deviceListFile).Wait();
5957
60- //** you can use this if you want to add a bunch of devices, then dump them and look at them in a file (in blob storage).
58+ // This exports the devices to a file in blob storag.e
59+ // You can use this to add a bunch of new devices, then export them and look at them in a file (in blob storage).
6160 //Console.WriteLine("Read devices from the original hub, write to blob storage.");
6261 // Read the list of registered devices for the IoT Hub.
6362 // Write them to blob storage.
6463 //IoTHubDevices.ExportDevices(containerURI, IoTHubConnectionString).Wait();
6564
66- Console . WriteLine ( "Copy devices from the original hub to the new hub." ) ;
67- // Copy devices from an existing hub to the new hub.
65+ Console . WriteLine ( "Copy devices from the original hub to a new hub." ) ;
66+ // Copy devices from an existing hub to a new hub.
6867 IoTHubDevices . CopyAllDevicesToNewHub ( IoTHubConnectionString , DestIoTHubConnectionString ,
6968 cloudBlobContainer , containerURI , deviceListFile ) . Wait ( ) ;
7069
71- //** uncomment this if you want to delete all the devices registered to the original hub **
70+ //** uncomment this if you want to delete all the devices registered to a hub **
71+
72+ // Delete devices from the source hub.
7273 //Console.WriteLine("Delete all devices from the source hub.");
7374 //IoTHubDevices.DeleteAllDevicesFromHub(IoTHubConnectionString, cloudBlobContainer, containerURI, deviceListFile).Wait();
7475
76+ // Delete devices from the destination hub.
7577 //Console.WriteLine("Delete all devices from the destination hub.");
7678 //IoTHubDevices.DeleteAllDevicesFromHub(DestIoTHubConnectionString, cloudBlobContainer, containerURI, deviceListFile).Wait();
7779
0 commit comments