Link the device to a feed
After you prepare a device for OTA updates, you link it to a feed that delivers your application. This operation involves:
- Adding the application image to a component
- Creating or specifying a feed
- Adding the feed to the device group you specified in the previous step
- Creating an image set that represents the application
- Adding the image set to the feed
The azsphere device link-feed operation is the easiest way to do this. You can create a new feed or link to an existing feed.
Create and link to a new feed
If you have not previously deployed this component, create a new feed. Use a command in the following form:
azsphere device link-feed --dependentfeedid 3369f0e1-dedf-49ec-a602-2aa98669fd61 --imagepath <path-to-image> --newfeedname <unique-feed-name>
By default, the command applies to the Azure Sphere device that is attached to the PC. To set up a different device, use the --deviceid parameter instead and specify the ID of the device to set up. The device ID is used to infer the product SKU and chip SKU that the new feed should target. The new feed is associated with the device group that contains the device.
The --dependentfeedid parameter supplies the ID of the Azure Sphere OS feed on which the application depends. To create a new feed, you must supply the ID of the dependent feed. All application feeds depend on an Azure Sphere OS feed. Currently, the Azure Sphere OS feed is named Retail Azure Sphere and the feed ID is 3369f0e1-dedf-49ec-a602-2aa98669fd61.
The --imagepath parameter provides the path to the image package file for the application that the newly created feed will distribute. As a result, the image package file is uploaded to the Azure Sphere Security Service and is added to the new image set that the command creates. If the component ID of the image package does not match the component ID that the feed delivers, the command returns an error. By default, the command creates a unique name for the image set, based on the name of the image package. To override the default, use the --newimagesetname parameter and specify a unique name.
The --newfeedname parameter provides a name for the new feed that the command creates. The feed name must be unique within your Azure Sphere tenant. The feed distributes the component whose component ID is specified in the image package file.
azsphere displays progress information about each step, as the following example shows:
azsphere device link-feed --dependentfeedid 3369f0e1-dedf-49ec-a602-2aa98669fd61 --imagepath "C:\Users\Test\Documents\Visual Studio 2017\Projects\Mt3620BlinkTestImage\Mt3620BlinkTestImage\bin\ARM\Debug\Mt3620BlinkTestImage.imagepackage" --newfeedname POTestFeed Getting the details for device with ID 'device-id'. Uploading image from file 'C:\Users\Test\Documents\Visual Studio 2017\Projects\Mt3620BlinkTestImage\Mt3620BlinkTestImage\bin\ARM\Debug\Mt3620BlinkTestImage.imagepackage': --> Image ID: deee01f7-e636-45a3-8faa-a6c75694b241 --> Component ID: d89a72b5-8481-45f9-99b6-58cf3cc93a5b --> Component name: 'Mt3620BlinkTestImage' Removing temporary state for uploaded image. Create a new feed with name 'POTestFeed'. Adding feed with ID 'f1cd9099-1bd2-46ca-b523-774298823d86' to device group with ID 'b2f63faf-5bb3-4f75-b4f1-a4f0ba698fc2'. Creating new image set with name 'ImageSet-Mt3620BlinkTestImage-2018.07.22-18.29.35+01:00' for image with ID 'deee01f7-e636-45a3-8faa-a6c75694b241'. Adding image set with ID 'c0c2c974-f84d-44fa-a74f-b31227db5c43' to feed with ID 'f1cd9099-1bd2-46ca-b523-774298823d86'. Successfully linked device 'device-id' to feed with ID 'f1cd9099-1bd2-46ca-b523-774298823d86'. Command completed successfully in 00:00:34.1718633.
Link to an existing feed
If you already have a feed for this component, use a command like the following:
azsphere device link-feed --imagepath <path-to-image> --feedid <GUID>
This command links the feed identified by the GUID to the device group that contains the attached device and uploads the specified image package.
The next time the device checks for updates, the Azure Sphere Security Service downloads and starts the application.