Training
Module
Send and pass data as output from the pipeline - Training
This module explains how to send pipeline data to files and in various output formats.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
This is the Azure Sphere (Legacy) documentation. Azure Sphere (Legacy) is retiring on 27 September 2027, and users must migrate to Azure Sphere (Integrated) by this time. Use the Version selector located above the TOC to view the Azure Sphere (Integrated) documentation.
Azure Sphere CLI 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
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. |
yamlc |
Colorized YAML. |
tsv |
Tab-separated values, with no keys. |
none |
No output other than errors and warnings. |
You can specify the required output format for the command using --output
, --out
, or -o
. If we’re missing a command that you need to script, let us know with azsphere feedback.
It is supported for the following commands:
The table
format is the default format that 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. It is useful for getting a summary of focused information, particularly for list commands.
azsphere tenant list --output table
------------------------------------ --------------------- -------------
Id Name Roles
========================================================================
143adbc9-1bf0-4be2-84a2-084a331d81cb MyTenant Contributor
------------------------------------ --------------------- -------------
768c2cd6-059a-49ad-9f53-89f5271cea15 MyTenant1 Administrator
Contributor
------------------------------------ --------------------- -------------
You can use the --query
parameter to customize the properties and columns you want to show in the output. The following example shows how to select just the TenantID and Role in the list command.
azsphere tenant list --query '[].{TenantID:id, Role:roles}'
------------------------------------ -------------
TenantID Role
==================================================
143adbc9-1bf0-4be2-84a2-084a331d81cb Contributor
------------------------------------ -------------
183adhc9-a5c8-8he2-84a2-c4f00f73a471 Administrator
Contributor
------------------------------------ -------------
Note
azsphere tenant list --output json
command, the output displays the names and values available for that command.JSON output format includes all raw data and nested data in a structured format. We recommend using the JSON output for concise output and scripting purposes. This is only applicable when the command succeeds and returns 0.
The following example displays the list of tenants in the default JSON format.
azsphere tenant list --output json
[
{
"id": "143adbc9-1bf0-4be2-84a2-084a331d81cb",
"name": "MyTenant",
"roles": [
"Contributor"
]
},
{
"id": "768c2cd6-059a-49ad-9f53-89f5271cea15",
"name": "MyTenant1",
"roles": [
"Administrator",
"Contributor"
]
}
]
The yaml
format prints output as YAML, a plain-text data serialization format. YAML tends to be easier to read than JSON.
azsphere tenant list --output yaml
- id: 143adbc9-1bf0-4be2-84a2-084a331d81cb
name: MyTenant
roles:
- Contributor
- id: 768c2cd6-059a-49ad-9f53-89f5271cea15
name: MyTenant1
roles:
- Administrator
- Contributor
The tsv
output format returns tab-separated and newline-separated values without additional formatting, keys, or other symbols.
The tsv
output is similar to the table
output but differs in the following ways:
tsv
output.table
output displays list and tsv
displays the length of a list.tsv
output.tsv
output is tab separated and does not scale to fit the terminal.azsphere tenant list --output tsv
143adbc9-1bf0-4be2-84a2-084a331d81cb MyTenant 1
768c2cd6-059a-49ad-9f53-89f5271cea15 MyTenant1 2
Training
Module
Send and pass data as output from the pipeline - Training
This module explains how to send pipeline data to files and in various output formats.