Hello Jan Kubal, As Sander's response has pointed out the recommended way to handle the Automatic deployments in production, please go through that document and do let us know if you have any further queries!
Regarding your initial query, yes, this behavior is intended. When you use the az iot edge set-modules command to remove a module, it only updates the deployment status of the module to "No" in the deployment manifest.
The module is still running on the device, but it's not included in the deployment. If you want to delete a module from an IoT Edge device, you need to use the az iot edge remove-modules command. This command stops and removes the module from the device. Here's an example of how to use the command:
az iot edge remove-modules --device-id [device id] --hub-name [hub name] --module-id [module id]
- The device ID parameter is case-sensitive.
- The module ID parameter is the name of the module that you want to remove.
You can also use Azure IoT Hub Device Twins to manage the modules on your device. You can use the Azure IoT Hub SDK to update the desired properties of the device twin to add or remove modules.
Deploy Azure IoT Edge modules with Azure CLI
Use the Azure CLI with the Azure IoT Extension to push an IoT Edge module from your IoT Hub to your IoT Edge device, as configured by a deployment manifest.