"az aks get-credentials" does not return exit code 3 when the cluster does not exist
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
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/aks-pm
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/aks-pm
@connec , thanks for reporting, we are looking at this.
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