Closed Delapouite closed 2 years ago
Hi
I cannot reproduce your issue - is there an output flag you have set as a default? Do other CLI commands also give you nothing by default?
If I run:
az iot dps certificate list --dps-name myDPS
, I get the json output by default.az iot dps certificate list --dps-name myDPS -o json
, I get the json outputaz iot dps certifcate list --dps-name myDPS -o table
, I get nothing except for a newline.Other output formats: https://docs.microsoft.com/en-us/cli/azure/format-output-azure-cli
So by default, the json should be returned. You may have set something with az config set
or in your environment variables as described here:
https://docs.microsoft.com/en-us/cli/azure/format-output-azure-cli#set-the-default-output-format
https://docs.microsoft.com/en-us/cli/azure/azure-cli-configuration#cli-configuration-values-and-environment-variables
@vilit1 I think @Delapouite is expecting the table output to work, which you were able to reproduce the issue of no output with table format.
oh ok - will look into that
Found some useful JMES querying:
to have a table output with the current certificate list (and some values), run
az iot dps certificate list --dps-name myDPS --query "value[*].{Name:name, ResourceGroup:resourceGroup, Created:properties.created, Subject:properties.subject, Thumbprint:properties.thumbprint, IsVerified:properties.isVerified}" -o table
I am going to add these transforms into the code so you don't have to write out the jmes queries every time.
Azure CLI 2.38.0 released today should have the table output fix. If after trying it, you have additional feedback, let us know and we can re-open this issue.
Hi
Describe the bug
While attempting to list the certificates of an IotHub DPS I own, I was surprised that the command did not return anything, despite the fact that I was clearly able to obtain this list through the Azure Portal.
But, it turns out that by simply adding
-o json
, the CLI is suddently able to display the certificates! So my guess is that there's something wrong with the default "table" output.To Reproduce
Targeting an IotHub DPS with certificates.
az iot dps certificate list --dps-name=myDPS -g myRG
This command does not print anything after execution
az iot dps certificate list --dps-name=myDPS -g myRG -o json
The same command but with an explicit JSON output does print the certificates array.
Expected behavior
The
az iot dps certificate list --dps-name=myDPS -g myRG
should display an ASCII table of certificates, like any other commands.Environment
Thanks!