Supported output formats for Azure Sphere CLI V2 Beta
Azure Sphere CLI v2 Beta supports several formats in which the data can be viewed. By default, it uses table
as the default format for displaying the CLI output, but also supports other formats.
Note
Using machine-readable structured output format is supported only in Azure Sphere CLI v2 Beta. Azure Sphere CLI v1 only supports human-readable output and not machine-readable structured format such as JSON.
The argument values and the output types are:
Output format | Description |
---|---|
table | ASCII table with keys as column headings. This is the default format. |
json | JSON string. |
jsonc | Colorized JSON. |
yaml | YAML, a machine-readable alternative to JSON. |
tsv | Tab-separated values, with no keys. |
none | No output other than errors and warnings. |
Supported commands
You can specify the required output format for the command using --output
or -o
. It is supported for the following commands:
- azsphere show-version
- azsphere ca-certificate list
- azsphere ca-certificate download
- azsphere ca-certificate download-chain
- azsphere ca-certificate download-proof
- azsphere device list
- azsphere device show-count
- azsphere device-group create
- azsphere device-group list
- azsphere device-group show
- device-group update
- device-group deployment create
- azsphere device-group deployment list
- azsphere device-group device show-count
- azsphere device-group device list
- azsphere image show
- azsphere image download
- azsphere product create
- azsphere product list
- azsphere product show
- azsphere product update
- azsphere product device list
- azsphere product device show-count
- azsphere product device-group list
- azsphere product device-group create-defaults
- azsphere role list
- azsphere role add
- azsphere role delete
- azsphere role remove-legacy-access
- azsphere role show
- azsphere role show-types
- azsphere tenant list
- azsphere tenant select
- azsphere tenant show-selected
- azsphere device sideload set-deployment-timeout
- azsphere device sideload show-deployment-timeout
Table output format
The table
format prints output as an ASCII table, making it easy to read and scan. This format is best when you want a quick, human-searchable overview of data. This is the default format and the only format supported in both Azure Sphere CLI v1 and Azure Sphere CLI v2 Beta.
azsphere tenant list --output table
------------------------------------ --------------------- -------------
Id Name Roles
========================================================================
a323c263-2aa3-2559-aabb-a3fc32631900 Tenant1 Contributor
------------------------------------ --------------------- -------------
183adhc9-a5c8-8he2-84a2-c4f00f73a471 Tenant2 Administrator
Contributor
------------------------------------ --------------------- -------------
JSON output format
The following example displays the list of tenants in the default JSON format.
azsphere tenant list --output json
[
{
"id": "a323c263-2aa3-2559-aabb-a3fc32631900",
"name": "Tenant1",
"roles": [
"Contributor"
]
},
{
"id": "183adhc9-a5c8-8he2-84a2-c4f00f73a471",
"name": "Tenant2",
"roles": [
"Administrator",
"Contributor"
]
}
]
YAML output format
The yaml
format prints output as YAML, a plain-text data serialization format. YAML tends to be easier to read than JSON, and easily maps to that JSON format. Some applications and CLI commands take YAML as configuration input, instead of JSON.
azsphere tenant list --output yaml
- id: a323c263-2aa3-2559-aabb-a3fc32631900
name: Tenant1
roles:
- Contributor
- id: 183adhc9-a5c8-8he2-84a2-c4f00f73a471
name: Tenant2
roles:
- Administrator
- Contributor
TSV output format
The tsv
output format returns tab- and newline-separated values without additional formatting, keys, or other symbols. This format makes it easy to consume the output into other commands and tools that need to process the text in some form. Like the table
format, tsv
doesn't print nested objects.
azsphere tenant list --output tsv
a323c263-2aa3-2559-aabb-a3fc32631900 Tenant1 1
183adhc9-a5c8-8he2-84a2-c4f00f73a471 Tenant2 2