Azure / Azure/azure-cli-extensions

How can we replace a deployment?

Open
#1,988 5 comments 0 reactions 0 assignees View on GitHub
customer-reported extension/iot IotHub Service Attention
Dominant language
Python
Stars
454
Forks
1.7k
Avg merge
2d 19h
Merged PRs (30d)
64

Description

Hi, we use layered deployments and are wondering how to best handle the replacement of a deployment.

Context:
- we build images from Azure DevOps, and set a tag with the build number. We have to do that because when using 'latest', the edge agent doesn't detect the update unless we do a manual 'docker pull' on the device;
- we put the build number in the layered deployment manifest;
- we then deploy using '_az iot edge deployment create_' (the DevOps template that uses iotedgedev doesn't support layered deployments);

This works fine the first time, then the next, we have an error stating that the ID is already used. So we ended up deleting the deployment with this ID, and we create a new one just after.
Problem is, the deletion triggers a deactivation of the module on the device, then the creation triggers a download of the updated image. Thus for a few minutes, the module has "disappeared"... This is a different behaviour than the one we have with a full deployment, where the module is only replaced after being successfully downloaded by the edge agent.

It would make our life easier if there was an "overwrite existing" option to the create deployment command, or if the update command could accept a new deployment manifest. Deployments are stated as immutable in the doc, could you add more info why this is so?

Unless we do not do things properly? Would you recommend doing otherwise? What are the best practices for such case?

Thanks a lot!
Cheers

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: bbcd4f3e-cbf7-49a6-55f4-8f1aa4bb9995
* Version Independent ID: 4ebb9187-5e18-49b5-85eb-1e9d7a6e57cc
* Content: [az iot edge deployment](https://docs.microsoft.com/en-us/cli/azure/ext/azure-cli-iot-ext/iot/edge/deployment?view=azure-cli-latest)
* Content Source: [latest/docs-ref-autogen/ext/azure-cli-iot-ext/iot/edge/deployment.yml](https://github.com/MicrosoftDocs/azure-docs-cli/blob/live/latest/docs-ref-autogen/ext/azure-cli-iot-ext/iot/edge/deployment.yml)
* Service: **iot-hub**
* GitHub Login: @rloutlaw
* Microsoft Alias: **routlaw**

Contributor guide

Open the contributing guide

Research direction

Start with latest/docs-ref-autogen/ext/azure-cli-iot-ext/iot/edge/deployment.yml and the `az iot edge deployment create` workflow described in the issue. Clarify why layered deployments are immutable, whether create or update supports replacement, and document the recommended workflow and its expected module behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, docker
Domain
cli, cloud, documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.