Skip to content

Latest commit

 

History

History
107 lines (74 loc) · 6.44 KB

quickstart-deploy-connected-registry-iot-edge-cli.md

File metadata and controls

107 lines (74 loc) · 6.44 KB
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

Quickstart: Deploy a connected registry to an IoT Edge device

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]

[!INCLUDE container-registry-connected-import-images]

Retrieve connected registry configuration

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]

Configure a deployment manifest for IoT Edge

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]

Deploy the connected registry and API proxy modules on IoT Edge

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.

Next steps

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