Share via


az iot ops asset event

Note

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

Manage events in an asset.

Commands

Name Description Type Status
az iot ops asset event add

Add an event to an asset.

Extension GA
az iot ops asset event export

Export events in an asset.

Extension GA
az iot ops asset event import

Import events in an asset.

Extension GA
az iot ops asset event list

List events in an asset.

Extension GA
az iot ops asset event remove

Remove an event in an asset.

Extension GA

az iot ops asset event add

Add an event to an asset.

az iot ops asset event add --asset
                           --en
                           --resource-group
                           [--name]
                           [--observability-mode]
                           [--qs]
                           [--replace {false, true}]
                           [--sampling-interval]

Examples

Add an event to an asset.

az iot ops asset event add --asset myasset -g myresourcegroup --event-notifier eventId --name eventName

Add an event to an asset with event name, observability mode, custom queue size, and custom sampling interval.

az iot ops asset event add --asset MyAsset -g MyRG --event-notifier eventId --name eventName --observability-mode log --queue-size 2 --sampling-interval 500

Required Parameters

--asset -a

Asset name.

--en --event-notifier

Event notifier.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--name -n

Event name.

--observability-mode --om

Observability mode. Must be none or log.

--qs --queue-size

Custom queue size.

--replace

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

Accepted values: false, true
--sampling-interval --si

Custom sampling interval (in milliseconds).

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--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.

az iot ops asset event export

Export events in an asset.

The file name will be {asset_name}_events.{file_type}.

az iot ops asset event export --asset
                              --resource-group
                              [--format {csv, json, yaml}]
                              [--od]
                              [--replace {false, true}]

Examples

Export all events in an asset in JSON format.

az iot ops asset event export --asset myasset -g myresourcegroup

Export all events in an asset in CSV format in a specific output directory that can be uploaded to the Digital Operations Experience.

az iot ops asset event export --asset myasset -g myresourcegroup --format csv --output-dir myAssetFiles

Export all events in an asset in YAML format. Replace the file if one is present already.

az iot ops asset event export --asset myasset -g myresourcegroup --format yaml --replace

Required Parameters

--asset -a

Asset name.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--format -f

File format.

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

Output directory for exported file.

--replace

Replace the local file if present.

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

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--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.

az iot ops asset event import

Import events in an asset.

For examples of file formats, please see aka.ms/aziotops-assets.

az iot ops asset event import --asset
                              --if
                              --resource-group
                              [--replace {false, true}]

Examples

Import all events from a file. These events will be appended to the asset's current events. Events with duplicate names will be ignored.

az iot ops asset event import --asset myasset -g myresourcegroup --input-file myasset_events.yaml

Import all events from a file. These events will appended the asset's current events. Events with duplicate names will replace the current asset events.

az iot ops asset event import --asset myasset -g myresourcegroup --input-file myasset_events.csv --replace

Required Parameters

--asset -a

Asset name.

--if --input-file

File path for the file containing the events. The following file types are supported: json, csv, yaml.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--replace

Replace duplicate asset events with those from the file. If false, the file events will be ignored. Duplicate asset events will be determined by name.

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

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--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.

az iot ops asset event list

List events in an asset.

az iot ops asset event list --asset
                            --resource-group

Examples

List all events in an asset.

az iot ops asset event list --asset myasset -g myresourcegroup

Required Parameters

--asset -a

Asset name.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--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.

az iot ops asset event remove

Remove an event in an asset.

az iot ops asset event remove --asset
                              --name
                              --resource-group

Examples

Remove an event from an asset via the event name.

az iot ops asset event remove --asset myasset -g myresourcegroup --name myevent

Required Parameters

--asset -a

Asset name.

--name -n

Event name.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--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.