Edge Agent and Edge Hub Environment Variables

August 26, 2025 ยท View on GitHub

Use the following environment variables to configure the Edge Agent and Edge Hub services. These variables are used in the deployment manifest to configure the Edge Agent and Edge Hub modules.

You can set Edge Agent and Edge Hub environment variables in the Azure portal. In the details page for your IoT Edge device, select Set Modules. In the IoT Edge Modules section, select Runtime Settings. Choose the Edge Agent or Edge Hub tab for the module's environment variable you want to set. Add the variable detail in the Environment Variables section. Apply and create the deployment for the device.

Edge Agent

VariableDescriptionValue RangeDefault Value
BackupConfigFilePathPath to put the backup deployment config filestring
CloseCloudConnectionOnIdleTimeoutWhether the upstream connection should be closed when CloudConnectionIdleTimeoutSecs is reachedboolfalse
CloudConnectionIdleTimeoutSecsIf there are no IoT operations, time span to wait before the upstream connection is considered idleint32300
ConfigRefreshFrequencySecsInterval at which the Edge Agent config is refreshed from upstreamint323600
ConfigSourcetwin / local, specifies where the deployment config should be read fromtwin, localtwin
CoolOffTimeUnitInSecondsTime span to wait between restart attempts on a module0-30010
DisableDeviceAnalyticsMetadataWhether to disable sending basic metadata about the device to Microsoft.boolfalse
EnableK8sServiceCallTracingWhether to enable logging for K8s requests that the Agent makesboolfalse
EnableOrphanedIdentityCleanupWhether to enable removal of any orphaned identities
NOTE: There is an issue with the managedBy tag for module identities that WILL cause this logic to remove Host-Level modules (i.e. managed by something other than IotEdge)
boolfalse
EnableSdkDebugLogsIf set, emits SDK client events to logs. Note that this method will substantially slow down execution.boolfalse
Https_ProxyAddress of the proxy to use for outbound HTTPS requestsstring
IntensiveCareTimeInMinutesTime span for a module to be running before considered completely healthy (restart time / count cleared)int32
K8sNamespaceK8s namespace to use for deploying modulesstring
LocalConfigPathPath to local .json file containing Agent configstring.\config.json
ManagementApiTimeoutSecsTime span to wait before the connection to managament api times outint32300
MaxRestartCountMax number of restarts allowed before a module is considered to have failedint32
MetricsEnabledWhether to enable metrics listenerbooltrue
MetricsHistogramMaxAgeTime interval for the metrics histogramTimeSpan string01:00:00 (1 hour)
MetricScrapeIntervalInterval at which diagnostic metrics are sampledTimeSpan string01:00:00 (1 hour)
MetricUploadIntervalInterval at which diagnostic metrics are uploadedTimeSpan string1.00:00:00 (1 day)
ModuleUpdateModeBehavior for module updates. Either wait for all images to be downloaded, or make a best effort.NonBlocking, WaitForAllPullsNonBlocking
PerformanceMetricsUpdateFrequencyInterval to sample system performance metrics from host. These include CPU, RAM and Disk Space measurements.TimeSpan string00:05:00 (5 minutes)
Modespecifies the mode for module deploymentiotedged, docker, kubernetesiotedged
PersistentVolumeClaimDefaultSizeInMbSize of the PersistedVolumeClaim, must be used with StorageClassNameint32
RequestTimeoutSecsTimeout for handling ping and GetTaskStatus direct methodsint32600
RocksDB_MaxOpenFilesMax number of files to be concurrently opened by RocksDBint32
RocksDB_MaxTotalWalSizeMax size to be used by RocksDB's write-ahead-logulong
RocksDB_MaxManifestFileSizeMax size of a RocksDB MANIFEST file before it's rolled overulong
RunAsNonRootIf set, runs at user = 1000 instead of rootboolfalse
RuntimeLogLevelRuntime diagnostic logging levelfatal, error, warning, info, debug, verboseinfo
SendRuntimeQualityTelemetryWhether to enable sending runtime diagnostics metricbooltrue
Storage_LogLevelRocksDB diagnostic log levelNONE, FATAL, HEADER, ERROR, WARN, INFO, DEBUGNONE
StorageClassNameStorageClassName to be used when creating a PersistedVolumeClaimstring
StorageFolderPath to place the Edge Agent database directorystringTempPath of the current OS
UpstreamProtocolProtocol used to for upstream connectionsAmqp, AmqpWs, Mqtt, MqttWsAmqp w/ fallback to AmqpWs
UseMountSourceForVolumeNameIf set, the k8s conversion will use the volume mount source as persistent volume nameboolfalse
UseOfflineCheckIf set, activate additional logic that can help Edge Agent start without network connectivityboolfalse
UsePersistentStorageWhether to save deployment config and module states to diskbooltrue
UseServerHeartbeatSets the client-side heartbeat interval to 60sec for the Agent's upstream AMQP connectionbooltrue

Edge Hub

VariableDescriptionValuesDefault
AmqpSettings__EnabledWhether the AMQP protocol head should be enabledbooltrue
AmqpSettings__PortThe port for the AMQP protocol head to listen onint325671
AmqpSettings__DelayedBatchingEnabledEnable to wait for subsequent packets to batch them, similar to Nagle for TCPboolfalse
AuthenticationModeDetermines who performs authenticationScope, Cloud, CloudAndScope (Cloud AuthenticationMode not supported in production)Scope
BackupFolderPath to place the backup Edge Hub database directorystringTempPath of the current OS
CacheTokensWhether client authentication tokens are saved to diskboolfalse
CheckEntireQueueOnCleanupPeriodically check all pending messages for TTL expiry, incurs more I/O but saves more storageboolfalse
ClientCertAuthEnabledAllows dev certificates to be used during SSL handshake with upstream and bypass cert validationboolfalse
CloseCloudConnectionOnDeviceDisconnectIf a leaf device disconnections, immediately closes the corresponding upstream connectionbooltrue
CloseCloudConnectionOnIdleTimeoutWhether the upstream connection should be closed when CloudConnectionIdleTimeoutSecs is reachedbooltrue
CloudConnectionHangingTimeoutSecsTime span to wait before the upstream IOT operation is set to timeout in case CloudOperationTimeoutSecs is not honoredint3250
CloudConnectionIdleTimeoutSecsIf there are no IoT operations, time span to wait before the upstream connection is considered idleint323600
CloudOperationTimeoutSecsTime out for any upstream IoT operationint3220
ConfigRefreshFrequencySecsInterval at which the Edge Hub config is refreshed from upstreamint323600
ConfigSourceUses config from either Edge Hub twin, or a local config sourcetwin, localtwin
ConnectivityCheckFrequencySecsInterval at which Edge Hub will ping upstream to ensure connectivity is still presentint32300
DeviceScopeCacheRefreshRateSecsInterval at which leaf and module identities are refreshed from upstreamint323600
EnableRoutingLoggingWhether message routing logs should be enabledboolfalse
EnableSdkDebugLogsIf set, emits SDK client events to logs. Note that this method will substantially slow down execution.boolfalse
EncryptTwinStoreWhether to encrypt the twin data before persisting to diskbooltrue
Https_ProxyAddress of the proxy to use for outbound HTTPS requestsstring
HttpSettings__EnabledWhether the HTTP server should be enabledbooltrue
HttpSettings__PortThe port for the HTTP protocol head to listen onint32443
ApiProxyModuleIdThis is the ApiProxy module name that is authorized to forward the client certificate for client CA certificate authenticationstringIoTEdgeAPIProxy
IotHubConnectionPoolSizePool size for upstream AMQP connectionint32
MaxConnectedClientsMaximum number of downstream clients allowed to connectint32101 (100 clients + 1 Edge Hub)
MaxUpstreamBatchSizeMax number of messages to concurrently send upstreamint3210
MessageAckTimeoutSecsTime span to wait for sending a message downstream to a leaf deviceint3230
MessageCleanupIntervalSecsThis setting defines the time interval for a task that cleans up messages in Edge Hub's store. Note that messages are only removed from the store when this task runs. If you use a Time To Live that is shorter than the default cleanup interval, please adjust the cleanup interval accordingly to ensure timely message removal.int321800
Metrics__Listener__HostHostname of the metrics listener, used to construct the metrics listener URLstring*
Metrics__Listener__MetricsEnabledWhether to enable metrics listenerbooltrue
Metrics__Listener__MetricsHistogramMaxAgeTime interval for the metrics histogramTimeSpan string00:01:00 (1 hour)
Metrics__Listener__PortPort of the metrics listener, used to construct the metrics listener URLint329600
Metrics__Listener__SuffixAppended to the metrics listener URLstringmetrics
MinTwinSyncPeriodSecsMaximum frequency for pull any device/module twinint32120
ModuleRequestThrottleTimeoutTime in seconds for how long internal module request timeout should be, -1 indicates infinite timeout (i.e., the request might never return, use with caution), numbers less than -1 are invalidint 32240s
MqttSettings__EnabledWhether the MQTT broker should be enabledbooltrue
MqttSettings__UsePooledBuffersWhether MQTT protocol head should use pooled buffersboolfalse
OptimizeForPerformanceIncrease RocksDB file I/O usage to speed up message storagebooltrue
ReportedPropertiesSyncFrequencySecsMaximum frequency for pushing reported properties upstreamint325
RocksDB_MaxOpenFilesMax number of files to be concurrently opened by RocksDBint32
RocksDB_MaxTotalWalSizeMax size to be used by RocksDB's write-ahead-logulong
RocksDB_MaxManifestFileSizeMax size of a RocksDB MANIFEST file before it's rolled overulong
RuntimeLogLevelRuntime diagnostic logging levelfatal, error, warning, info, debug, verboseinfo
ShutdownWaitPeriodSeconds to wait on shutdown before hard terminationint3260
SslProtocolsTLS protocol(s) to be supportedany of: tls1.2, tls1.3 (comma separated)tls1.2,tls1.3
Storage_LogLevelRocksDB diagnostic log levelNONE, FATAL, HEADER, ERROR, WARN, INFO, DEBUGNONE
StorageFolderPath to place the Edge Hub databases directorystringTempPath of the current OS
UpstreamFanOutFactorMax number of message groups to concurrently process for sending, grouped by senderint3210
UpstreamProtocolProtocol used to for upstream connectionsAmqp, AmqpWs, Mqtt, MqttWsAmqp w/ fallback to AmqpWs
UseServerHeartbeatSets the client-side heartbeat interval to 60sec for upstream AMQP connectionsbooltrue
UsePersistentStorageIf set, will enable directly persisting messages / twins into the local database before forwarding/processingbooltrue
EnableNonPersistentStorageBackupIf messages / twins are not directly persisted, this will backup twins and any unprocessed messages on shutdown so Edge can resume on next startupboolfalse
ServerCertificateRenewAfterInMsMaximum time duration after which the Edge Hub server certificate will be renewed, irrespective of certificate expiry timeint32int32.max
MaxCheckCertExpiryInMsMaximum time duration after which Edge Hub server certificate expiry should be checked, irrespective of certificate expiry timeint32n/a

Cloud AuthenticationMode not supported in production

Cloud authentication is not supported in production because of several known limitations:

  • Does not work for clients with x509 certitificate authentication (thumbprint or CA)
  • Does not work in offline mode
  • When a device sends telemetry and disconnects before Edge Hub, there is no way for Edge Hub to drain those messages to IoT Hub
  • Token refresh or validation requires dropping connection to the device and may cause stability issues.