az iot ops ns asset event

Note

This reference is part of the azure-iot-ops extension for the Azure CLI (version 2.70.0 or higher). The extension will automatically install the first time you run an az iot ops ns asset event command. Learn more about extensions.

Manage events for asset event-groups in IoT Operations namespaces.

The connector type is detected automatically from the existing asset. For connector-specific parameters use --event-config (inline JSON or file). Use --show-template to discover the supported configuration schema for the asset's connector type.

Commands

Name Description Type Status
az iot ops ns asset event add

Add an event to an asset event-group in an IoT Operations namespace.

Extension Preview
az iot ops ns asset event export

Export events to file.

Extension Preview
az iot ops ns asset event import

Import events from file.

Extension Preview
az iot ops ns asset event list

List events for an asset event-group in an IoT Operations namespace.

Extension Preview
az iot ops ns asset event remove

Remove an event from an asset event-group in an IoT Operations namespace.

Extension Preview

az iot ops ns asset event add

Preview

This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Add an event to an asset event-group in an IoT Operations namespace.

The connector type is detected from the asset's device endpoint. Connector-specific configuration (queue size, sampling interval, etc.) and destinations can be supplied via --event-config. Use --show-template to discover the supported config schema. For non-OPC UA connectors, a connector template must exist in the instance.

az iot ops ns asset event add --asset
                              --eg --event-group
                              --instance
                              --name
                              --resource-group
                              [--acquire-policy-token]
                              [--change-reference]
                              [--data-source --ds]
                              [--ec --event-config]
                              [--replace {false, true}]
                              [--show-template {config, schema}]
                              [--tr --type-ref]

Examples

Add a basic event to any asset type

az iot ops ns asset event add --asset myasset --instance myInstance -g myInstanceResourceGroup --event-group alarmGroup --name severity --data-source "alarm.severity"

Show the event config template for the asset's connector type

az iot ops ns asset event add --asset myasset --instance myInstance -g myInstanceResourceGroup --event-group alarmGroup --name severity --data-source "alarm.severity" --show-template config

Add an event with connector-specific configuration from inline JSON

az iot ops ns asset event add --asset myasset --instance myInstance -g myInstanceResourceGroup --event-group alarmGroup --name severity --data-source "alarm.severity" --event-config '{"eventConfiguration": {"samplingInterval": 1000, "queueSize": 5}}'

Add an event with configuration from a file

az iot ops ns asset event add --asset myasset --instance myInstance -g myInstanceResourceGroup --event-group alarmGroup --name severity --data-source "alarm.severity" --event-config ./event_config.json

Add an event with an MQTT destination

az iot ops ns asset event add --asset myasset --instance myInstance -g myInstanceResourceGroup --event-group alarmGroup --name severity --data-source "alarm.severity" --event-config '{"destinations": [{"target": "Mqtt", "configuration": {"topic": "factory/alarms", "retain": "Keep", "qos": "Qos1", "ttl": 3600}}]}'

Replace an existing event

az iot ops ns asset event add --asset myasset --instance myInstance -g myInstanceResourceGroup --event-group alarmGroup --name severity --data-source "alarm.severity.updated" --replace

Required Parameters

--asset -a

Asset name.

--eg --event-group

Event-group name.

--instance -i

The name of the Azure IoT Operations instance.

--name -n

Event name.

--resource-group -g

The resource group of the Azure IoT Operations instance.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--data-source --ds

Data source for the event.

--ec --event-config

Inline JSON string or path to a JSON/YAML file (.json, .yaml, .yml) containing connector-specific event configuration and/or destinations. Accepted keys are 'eventConfiguration' (connector-specific config object) and 'destinations' (list of destination objects). Use --show-template to discover the supported keys and schema for the asset's connector type. Cannot be combined with --show-template. For non-OPC UA connectors, a connector template must exist in the instance.

--replace

Replace the event if another event with the same name is already present.

Property Value
Default value: False
Accepted values: false, true
--show-template

Show a starter event configuration template for the asset's connector type and exit without modifying the event. The connector type is read from the existing asset. config: fields shown with their default values (null if no default); output is directly usable as --event-config input. schema: every field includes type, default, and constraints (min, max, enum, pattern). Draft-07 $ref pointers (#/definitions/...) are resolved inline in both modes.

Property Value
Accepted values: config, schema
--tr --type-ref

Type definition ID or URI.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az iot ops ns asset event export

Preview

This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Export events to file.

az iot ops ns asset event export --asset
                                 --eg --event-group
                                 --instance
                                 --resource-group
                                 [--acquire-policy-token]
                                 [--change-reference]
                                 [--format {csv, json, yaml}]
                                 [--od --output-dir]
                                 [--replace {false, true}]

Examples

Export events to JSON

az iot ops ns asset event export --asset myasset --instance myInstance -g myInstanceResourceGroup --event-group alarmGroup

Required Parameters

--asset -a

Asset name.

--eg --event-group

Event-group name.

--instance -i

The name of the Azure IoT Operations instance.

--resource-group -g

The resource group of the Azure IoT Operations instance.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--format -f

Export file format.

Property Value
Default value: json
Accepted values: csv, json, yaml
--od --output-dir

Output directory for export.

Property Value
Default value: .
--replace

Replace the local file if present.

Property Value
Default value: False
Accepted values: false, true
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az iot ops ns asset event import

Preview

This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Import events from file.

az iot ops ns asset event import --asset
                                 --eg --event-group
                                 --if --input-file
                                 --instance
                                 --resource-group
                                 [--acquire-policy-token]
                                 [--change-reference]
                                 [--replace {false, true}]

Examples

Import events from a JSON file

az iot ops ns asset event import --asset myasset --instance myInstance -g myInstanceResourceGroup --event-group alarmGroup --input-file ./events.json

Required Parameters

--asset -a

Asset name.

--eg --event-group

Event-group name.

--if --input-file

Path to import file (JSON, YAML, or CSV).

--instance -i

The name of the Azure IoT Operations instance.

--resource-group -g

The resource group of the Azure IoT Operations instance.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--replace

Replace existing events that share a name with an imported event.

Property Value
Default value: False
Accepted values: false, true
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az iot ops ns asset event list

Preview

This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

List events for an asset event-group in an IoT Operations namespace.

az iot ops ns asset event list --asset
                               --eg --event-group
                               --instance
                               --resource-group

Examples

List all events for an event-group

az iot ops ns asset event list --asset myasset --instance myInstance -g myInstanceResourceGroup --event-group alarmGroup

Required Parameters

--asset -a

Asset name.

--eg --event-group

Event-group name.

--instance -i

The name of the Azure IoT Operations instance.

--resource-group -g

The resource group of the Azure IoT Operations instance.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False

az iot ops ns asset event remove

Preview

This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Remove an event from an asset event-group in an IoT Operations namespace.

az iot ops ns asset event remove --asset
                                 --eg --event-group
                                 --instance
                                 --name
                                 --resource-group
                                 [--acquire-policy-token]
                                 [--change-reference]

Examples

Remove an event from an event-group

az iot ops ns asset event remove --asset myasset --instance myInstance -g myInstanceResourceGroup --event-group alarmGroup --name severity

Required Parameters

--asset -a

Asset name.

--eg --event-group

Event-group name.

--instance -i

The name of the Azure IoT Operations instance.

--name -n

Event name.

--resource-group -g

The resource group of the Azure IoT Operations instance.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

Property Value
Default value: False