Issue in addition of environment variables in the module settings of IoT EdgeDevice

Athira Gopinath(UST,IN) 101 Reputation points
2025-02-03T08:11:44.57+00:00

Hi Team,

As part of a requirement, we needs to add a 4.52kb size of environment variable to enable the module functionality. But while adding this as environment variable. This is throwing an error as follows

Set Modules

A problem occurred attempting to set device modules on device xxxx.  The request contained incorrectly formatted information. Details: ErrorCode:ArgumentInvalid;Property or Tag value should be maximum 4096 bytes. Error in Property/Tag{xxx:xxxx} ,``Error: Tracking ID:b10469d0f12146c982a908723ddf4845-G:0-

Is there any limitation for the environment variable? If so, what is the size limit of a single environment variable .Also Is there any limitation of number of environment variables and its size.

Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
587 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Manas Mohanty (Quadrant Resource LLC) 135 Reputation points Microsoft Vendor
    2025-02-03T13:24:30.24+00:00

    Hi Athira Gopinath(UST,IN)!

    Welcome to Azure IOT Q and A Forum. Thank you for posting your query here.

    Error is suggesting that maximum size of properties can be only 4096 kb and cannot exceed that.

    Here is the answer to your queries.

    1. Each individual property/tag in every section cannot exceed maximum size of 4 KB.
    2. Maximum size of tags/properties section is 8 KB.
    3. Maximum size of desired properties and reported properties sections are 32 KB each
    4. You can use environment variables up to above size limit only Kindly refer below document.

    limits and restrictions

    Thank you.

    0 comments No comments

  2. Sander van de Velde | MVP 34,536 Reputation points MVP
    2025-02-03T20:50:31.7766667+00:00

    Hello @Athira Gopinath(UST,IN) ,

    welcome to this moderated Azure community forum.

    The environment variables are stored in the deployment manifest, sent to the edge device when updated.

    Here is an example showing how environment variables are used for Grafana:

    "grafana": {
      "settings": {
        "image": "grafana/grafana:latest-ubuntu",
        "createOptions": ""
      },
      "type": "docker",
      "version": "1.0",
      "env": {
        "GF_INSTALL_PLUGINS": {
          "value": "grafana-clock-panel 1.0.1,grafana-simple-json-datasource 1.3.5"
        },
        "GF_SECURITY_ADMIN_PASSWORD": {
          "value": ""
        }
    }
    

    As @Manas Mohanty (Quadrant Resource LLC) mentioned already, there are several limitations for the IoT hub device twin and module twins.

    I have not found a reference about the maximum size limit of the deployment manifest, the place these variables live in, but the error speaks for itself.

    Personally, I would not use an environment variable for providing data of that size, using a volume binding and reading a file in there would have been my approach (or, if this is a custom module a blob storage file can be exchanged via the module twin).


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.