`az cosmosdb database list` does not list db names in table format
Description
az cosmosdb database list -g MYRG -n MYDB -otable
_colls _etag _rid _self _ts _users
-------- -------------------------------------- -------- ------------- ---------- --------
colls/ "00006003-0000-0000-0000-594da9980000" GBtJAA== dbs/GBtJAA==/ 1498261906 users/
az cosmosdb database list -g MYRG -n MYDB -ojson
[
{
"_colls": "colls/",
"_etag": "\"00006003-0000-0000-0000-594da9980000\"",
"_rid": "GBtJAA==",
"_self": "dbs/GBtJAA==/",
"_ts": 1498261906,
"_users": "users/",
"id": "MyDatabaseName"
}
]
Environment summary
Install Method: How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly)
Answer here: interactive script
CLI Version: What version of the CLI and modules are installed? (Use az --version)
$ az --version
azure-cli (2.0.8)
acr (2.0.6)
acs (2.0.8)
appservice (0.1.8)
batch (3.0.1)
billing (0.1.1)
cdn (0.0.4)
cloud (2.0.4)
cognitiveservices (0.1.4)
command-modules-nspkg (2.0.0)
component (2.0.5)
configure (2.0.8)
consumption (0.1.1)
core (2.0.9)
cosmosdb (0.1.8)
dla (0.0.8)
dls (0.0.8)
feedback (2.0.4)
find (0.2.4)
interactive (0.3.4)
iot (0.1.7)
keyvault (2.0.6)
lab (0.0.6)
monitor (0.0.6)
network (2.0.8)
nspkg (3.0.0)
profile (2.0.6)
rdbms (0.0.3)
redis (0.2.5)
resource (2.0.8)
role (2.0.6)
sf (1.0.3)
sql (2.0.5)
storage (2.0.8)
vm (2.0.8)
Python (Darwin) 2.7.10 (default, Feb 7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)]
Python location '/Users/debekoe/lib/azure-cli/bin/python'
OS Version: What OS and version are you using?
macOS Sierra
Shell Type: What shell are you using? (e.g. bash, cmd.exe, Bash on Windows)
bash
@moderakh : can you please take a look
@derekbekoe the function implementing az cosmosdb database list just returns a json object. And the json format representation is valid.
the conversion of the json to table format, I think is part of azure-cli framework and we didn't code for this. So I am not sure if that's something we should change on our side. @derekbekoe can you please give us any insight if for supporting '-otable' we need to code anything in particular? Shouldn't the azure-cli framework already have support for the representation conversion?
I believe this happens because your DB name is called "id". There's logic in the CLI's table auto-parse which omits anything called "id" because those are usually Azure RM ids, which are extremely long and useless in a table format.
@tjprescott is there any other action we need to do to resolve this issue? It would be confusing if we changed the property name from "id", and scripts that rely on that property name would begin to fail. This is more of a display problem, and other display types correctly show the database id.
@shurd you should be able to provide a custom table format to display the ID. Worst case you alias the column name. Scripts should not be utilizing table format anyways, so it would not break any scripts.
We are tracking this change internally as work item 448974. We expect to deliver this change by the middle of July. The table output for collection and database will show the resource names with the change.