az storage entity merge outputs invalid warning message
Describe the bug
Command Name
az storage entity merge
Errors:
az: error: unrecognized arguments: --auth-mode login
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
az storage entity merge --entity PartitionKey=foo RowKey=bar SomethingElse=whatever --table-name MyTable --account-name MyAccount
Note warning that is output:
No connection string, account key or sas token found, we will query account keys for your storage account. Please try to use --auth-mode login or provide one of the following parameters: connection string, account key or sas token for your storage account.
Try to follow suggestion in warning message:
az storage entity merge --auth-mode login --entity PartitionKey=foo RowKey=bar SomethingElse=whatever --table-name MyTable --account-name MyAccount
Expected Behavior
Either the warning should not be emitted, or the auth-mode parameter should work.
Environment Summary
macOS-10.15.2-x86_64-i386-64bit
Python 3.8.1
Shell: bash
azure-cli 2.0.81
Additional Context
hi @Juliehzl could you pls help to have a look? Thanks.
Additional context: the same thing happens for az storage entity insert and az storage entity delete, I just happened to notice it when running a script that used merge
add to S167.
Ran into this yesterday with az storage blob generate-sas. Makes it difficult to handle output from the az commands.
I ran into this as well, I had to hack around it and put 2>/dev/null to use the generate-sas subcommand in a script.
Additional context: the same thing happens for
az storage entity insertandaz storage entity delete, I just happened to notice it when running a script that usedmerge
Yes. Currently all commands in storage entity may have the same warning message, because there will be a breaking change for such data plane operations. Please provide your credentials as suggested to avoid the message and breaking change in the future.
Ran into this yesterday with az storage blob generate-sas. Makes it difficult to handle output from the az commands.
Hi @tkoestler and @LouisKottmann, we are working on a new feature --only-show-errors to provide a way to avoid warning message. But you may lose some important warning information, because we may announce some potential changes in the future.
In addition, please try to provide credentials as shown in your script, because we may make it required in the future.
Yes. Currently all commands in
storage entitymay have the same warning message, because there will be a breaking change for such data plane operations. Please provide your credentials as suggested to avoid the message and breaking change in the future.
In Azure DevOps/VSTS: Isn't the Azure Service Principal connection the credential?
Ran into this today with the new warning breaking pipelines with seemingly benign output in sterr. Seems wrong....
Yes. Currently all commands in
storage entitymay have the same warning message, because there will be a breaking change for such data plane operations. Please provide your credentials as suggested to avoid the message and breaking change in the future.In Azure DevOps/VSTS: Isn't the Azure Service Principal connection the credential?
Ran into this today with the new warning breaking pipelines with seemingly benign output in sterr. Seems wrong....
You need to specify --auth-mode login to utilize login credentials. and currently we already support --only-show-errors to make sure warning will not show up.
Because there is no response for several days, I will close this issue and if there is any problem, feel free to let me know.
I don't understand why this has been closed. The problem I reported hasn't changed at all - i.e. az storage entity commands don't support --auth-mode login and output an invalid warning message to do so. I have updated to 2.3.1 and this hasn't changed.
$ az storage entity merge --entity PartitionKey=foo RowKey=bar other=baz --table-name mytable --account-name myaccount
No connection string, account key or sas token found, we will query account keys for your storage account. Please try to use --auth-mode login or provide one of the following parameters: connection string, account key or sas token for your storage account.
"W/\"datetime'2020-04-20T03%3A38%3A44.3988472Z'\""
$ az storage entity merge --auth-mode login --entity PartitionKey=foo RowKey=bar other=baz --table-name mytable --account-name myaccount
az: error: unrecognized arguments: --auth-mode login
usage: az [-h] [--verbose] [--debug] [--only-show-errors] [--output {json,jsonc,yaml,yamlc,table,tsv,none}] [--query JMESPATH] {storage} ...
You need to add --only-show-errors in your command.
In addition, for your command, --auth-mode login is not supported as you can see in az storage entity merge -h, and you need to use credentials like account key, or others as shown in help.
I don't think you understand what I am saying. I have no problem with a warning being shown, but the thing that the warning says is wrong. The --auth-mode login option doesn't work.
If --auth mode login doesn't work, then I shouldn't get a warning message that says to use it!
If
--auth mode logindoesn't work, then I shouldn't get a warning message that says to use it!
Currently we only throw warning message for all possible credentials missing scenarios. And thanks you feedback. We will consider refining the warning message to let users find the suitable way by themselves.
If
--auth mode logindoesn't work, then I shouldn't get a warning message that says to use it!Currently we only throw warning message for all possible credentials missing scenarios.
Outputting informational message to stderr is in violation of decades of expected behavior of stderr. Informational messages typically belong in stdout.
If you are not sure how to fix this or authentication is upstream provider out of your control: A wrapper function that will try/catch each auth method and only outputs to stderr if none of the authentication methods were successful could handle this for you.
--only-show-errors implies only showing errors, no informational output. I (and everyone else) can add this but it is a backwards workaround for a problem that shouldn't exist. This flag really shouldn't exist.
Hi @Juliehzl - This issue should probably be reopened as the problem that was mentioned has not been resolved (unless I'm missing an update). I only ended up finding this issue because of the mentioned error message - only to find out that --auth-mode login is not supported. Having an accurate error message would have saved this investigative time for myself and others.