title | description | ms.topic | ms.date | ms.author | author | ms.custom | ms.devlang |
---|---|---|---|---|---|---|---|
Quickstart - Deploy a connected registry to an IoT Edge device |
Use Azure CLI commands and Azure portal to deploy a connected Azure container registry to an Azure IoT Edge device. |
quickstart |
10/21/2021 |
memladen |
toddysm |
ignite-fall-2021, mode-other, devx-track-azurecli |
azurecli |
In this quickstart, you use the Azure CLI to deploy a connected registry as a module on an Azure IoT Edge device. The IoT Edge device can access the parent Azure container registry in the cloud.
For an overview of using a connected registry with IoT Edge, see Using connected registry with Azure IoT Edge. This scenario corresponds to a device at the top layer of an IoT Edge hierarchy.
[!INCLUDE Prepare Azure CLI environment]
-
Azure IoT Hub and IoT Edge device. For deployment steps, see Quickstart: Deploy your first IoT Edge module to a virtual Linux device.
[!IMPORTANT] For later access to the modules deployed on the IoT Edge device, make sure that you open the ports 8000, 5671, and 8883 on the device. For configuration steps, see How to open ports to a virtual machine with the Azure portal.
-
Connected registry resource in Azure. For deployment steps, see quickstarts using the Azure CLI or Azure portal.
- A connected registry in either
ReadWrite
orReadOnly
mode can be used in this scenario. - In the commands in this article, the connected registry name is stored in the environment variable CONNECTED_REGISTRY_RW.
- A connected registry in either
[!INCLUDE container-registry-connected-import-images]
Before deploying the connected registry to the IoT Edge device, you need to retrieve configuration settings from the connected registry resource in Azure.
Use the az acr connected-registry get-settings command to get the settings information required to install a connected registry. The following example specifies HTTPS as the parent protocol. This protocol is required when the parent registry is a cloud registry.
az acr connected-registry get-settings \
--registry $REGISTRY_NAME \
--name $CONNECTED_REGISTRY_RW \
--parent-protocol https
By default, the settings information doesn't include the sync token password, which is also needed to deploy the connected registry. Optionally, generate one of the passwords by passing the --generate-password 1
or generate-password 2
parameter. Save the generated password to a safe location. It cannot be retrieved again.
Warning
Regenerating a password rotates the sync token credentials. If you configured a device using the previous password, you need to update the configuration.
[!INCLUDE container-registry-connected-connection-configuration]
A deployment manifest is a JSON document that describes which modules to deploy to the IoT Edge device. For more information, see Understand how IoT Edge modules can be used, configured, and reused.
To deploy the connected registry and API proxy modules using the Azure CLI, save the following deployment manifest locally as a manifest.json
file. You will use the file path in the next section when you run the command to apply the configuration to your device.
[!INCLUDE container-registry-connected-iot-edge-manifest]
Use the following command to deploy the connected registry and API proxy modules on the IoT Edge device, using the deployment manifest created in the previous section. Provide the ID of the IoT Edge top layer device and the name of the IoT Hub where indicated.
# Set the IOT_EDGE_TOP_LAYER_DEVICE_ID and IOT_HUB_NAME environment variables for use in the following Azure CLI command
IOT_EDGE_TOP_LAYER_DEVICE_ID=<device-id>
IOT_HUB_NAME=<hub-name>
az iot edge set-modules \
--device-id $IOT_EDGE_TOP_LAYER_DEVICE_ID \
--hub-name $IOT_HUB_NAME \
--content manifest.json
For details, see Deploy Azure IoT Edge modules with Azure CLI.
To check the status of the connected registry, use the following az acr connected-registry show command. The name of the connected registry is the value of $CONNECTED_REGISTRY_RW.
az acr connected-registry show \
--registry $REGISTRY_NAME \
--name $CONNECTED_REGISTRY_RW \
--output table
After successful deployment, the connected registry shows a status of Online
.
In this quickstart, you learned how to deploy a connected registry to an IoT Edge device. Continue to the next guides to learn how to pull images from the newly deployed connected registry or to deploy the connected registry on nested IoT Edge devices.
[!div class="nextstepaction"] Pull images from a connected registry
[!div class="nextstepaction"] Tutorial: Deploy connected registry on nested IoT Edge devices