Closed F-Joachim closed 1 month ago
Hi @F-Joachim can you please try using the device-twin update command? Example:
az iot hub device-twin update \
--device-id my-edge-device \
--hub-name my-iot-hub \
--tags '{ "my-tag": null }'
Hi @digimaun,
thanks for your reply. Yes, the update
command works as expected. Is the replace
command not intended for the deletion of certain tags?
Replace is intended to set the device-twin properties and tags, which cannot be set to null. Thus, replace cannot be used to delete specific tags. Please use update if you want to delete specific tags.
Describe the bug I am trying to remove a specific tag from the
tags
object by setting it tonull
. But theazure-cli
throws an error, that the property cannot be null.Error
{'Message': 'ErrorCode:ArgumentInvalid;Value of Property or Tag cannot be null. Error in Property/Tag my-tag', 'ExceptionMessage': 'Tracking ID:<tracking-id>-G:0-TimeStamp:11/28/2023 11:47:44'}
To Reproduce Steps to reproduce the behavior:
Expected behavior The tag is set to
null
and therefore the whole tag will be removed from the Device Twin...in the same way as it works in the Azure Portal.Environment: