Azure / Azure/azure-cli

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

Open
#25,982 2 comments 0 reactions 1 assignee Claimed by @jiasli View on GitHub
act-identity-squad Auto-Assign Azure CLI Team Graph question
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## 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.

- Create an app registration
- `az ad app permission add --id {} --api {} --api-permissions {}`

## 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.