Skip to content

"az ad sp show" does not return exit code 3 when the sp does not exist #11712

@connec

Description

@connec

Describe the bug

The az ad sp show command errors with exit code 1 when no service principal exists with the given --id. #6612 suggests that all CLI commands should error with exist code 3 when the target resource is missing.

To Reproduce

Attempt to show a service principal that does not exist and observe that the exit code is 1:

$ az ad sp show --id blah
service principal 'blah' doesn't exist
$ echo $?
1

Expected behavior

Attempt to show a service principal that does not exist and observe that the exit code is 3:

$ az ad sp show --id blah
service principal 'blah' doesn't exist
$ echo $?
3

Environment summary

$ az --version
azure-cli                         2.0.78

command-modules-nspkg              2.0.3
core                              2.0.78
nspkg                              3.0.4
telemetry                          1.0.4

Extensions:
azure-devops                      0.16.0

Metadata

Metadata

Assignees

Labels

Graph(doesn't work with label-triggered comments; use Graph.Microsoft instead) az ad

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions