azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

"az aks get-credentials" does not return exit code 3 when the cluster does not exist

Open connec opened this issue 6 years ago • 4 comments

Describe the bug

The az aks get-credentials command errors with exit code 1 when no cluster exists with the given --name. https://github.com/Azure/azure-cli/issues/6612 suggests that all CLI commands should error with exist code 3 when the target resource is missing.

To Reproduce

Attempt to get credentials for a cluster that does not exist and observe that the exit code is 1:

$ az aks get-credentials --resource-group real-group --name fake-cluster
The Resource 'Microsoft.ContainerService/managedClusters/fake-cluster' under resource group 'real-group' was not found.
$ echo $?
1

Expected behavior

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

$ az aks get-credentials --resource-group real-group --name fake-cluster
The Resource 'Microsoft.ContainerService/managedClusters/fake-cluster' under resource group 'real-group' was not found.
$ echo $?
3

Environment summary

$ az --version
azure-cli                         2.0.81

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

Extensions:
azure-devops                      0.16.0

connec avatar Feb 10 '20 18:02 connec

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/aks-pm

ghost avatar Feb 11 '20 01:02 ghost

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/aks-pm

ghost avatar Feb 11 '20 01:02 ghost

@connec , thanks for reporting, we are looking at this.

arrownj avatar Feb 11 '20 01:02 arrownj

Hello! Please try again with the latest Azure CLI version. Feel free to reopen an issue if it still doesn't work.

https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest

Jen7714 avatar May 29 '20 16:05 Jen7714