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 output displayed for a command may vary for different output type.
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. |
Supported commands
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.
Table output format
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
- Run the command in the JSON format to view the available property names to be used in the query. For example, when you run the
azsphere tenant list --output json
command, the output displays the names and values available for that command. - Nested objects, some keys, and fields are not printed in the table output by default. If you need to see these in your output, you can use the JMESPath re-keying feature to change the key name and avoid filtering. For more information about using queries to filter data, see Query CLI command output.
JSON output format
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"
]
}
]
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.
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
TSV output format
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:
- Column headers are not displayed in the
tsv
output. - The
table
output displays list andtsv
displays the length of a list. - Nested objects are not printed in the
tsv
output. - The
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