Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3.01k forks source link

logger.warning() doesnt mention required scope argument for granting permission #25982

Open pamelafox opened 1 year ago

pamelafox commented 1 year ago

Describe the bug

The warning in the console gives a command that doesn't work without additional arguments.

Command Name az ad app permission add

Errors:

The output says: "Invoking az ad app permission grant --id {}--api 00000003-0000-0000-c000-000000000000 is needed to make the change effective"

However, if you run that, you'll get an error due to missing argument:

$ az ad app permission grant --id $client_id \
    --api 00000003-0000-0000-c000-000000000000
the following arguments are required: --scope

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

Expected Behavior

I expect it to give me a working command or at least to mention scope is needed.

Environment Summary

Linux-5.15.49-linuxkit-x86_64-with-glibc2.31, Debian GNU/Linux 11 (bullseye)
Python 3.10.10
Installer: DEB

azure-cli 2.46.0

Extensions:
account 0.2.5

Dependencies:
msal 1.20.0
azure-mgmt-resource 21.1.0b1

Additional Context

The line of code generating the warning is https://github.com/Azure/azure-cli/blob/36786c51a5d42ff1b0a197e72a2c12261ff6743b/src/azure-cli/azure/cli/command_modules/role/custom.py#L908

pamelafox commented 1 year ago

It also could use a mention to az ad sp create --id $client_id which the reference does mention. Another approach is to just link to the reference.

yonzhan commented 1 year ago

@jiasli for awareness