Azure / Azure/azure-cli

az aks get-credentials always saves credentials as yaml irrespective of --output parameter value

Open
#16,359 4 comments 2 reactions 0 assignees View on GitHub
act-observability-squad AKS Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**Describe the bug**

`az aks get-credentials` command always saves credentials in yaml format irrespective of value of `--output` parameter.

**To Reproduce**

1. Install azure-cli using brew install
2. set required env vars say appAksGroupName and appAksClusterName in my example
3. execute `az aks get-credentials` command with different permitted values of `--output` parameter and observe output saved

**Example**
`
(base) Shubha:mydir sp$ az aks get-credentials --help | grep -A1 output
--output -o : Output format. Allowed values: json, jsonc, none, table, tsv,
yaml, yamlc. Default: json.
(base) Shubha:mydir sp$ az aks get-credentials --output json --resource-group $appAksGroupName --name $appAksClusterName --file /tmp/a.json
Merged "imakscluster" as current context in /tmp/a.json
(base) Shubha:mydir sp$ az aks get-credentials --output yaml --resource-group $appAksGroupName --name $appAksClusterName --file /tmp/a.yaml
Merged "imakscluster" as current context in /tmp/a.yaml
(base) Shubha:mydir sp$ az aks get-credentials --output tsv --resource-group $appAksGroupName --name $appAksClusterName --file /tmp/a.tsc
Merged "imakscluster" as current context in /tmp/a.tsc
(base) Shubha:mydir sp$ az aks get-credentials --output jsonc --resource-group $appAksGroupName --name $appAksClusterName --file /tmp/a.jsonc
Merged "imakscluster" as current context in /tmp/a.jsonc
(base) Shubha:mydir sp$ az aks get-credentials --output none --resource-group $appAksGroupName --name $appAksClusterName --file /tmp/a.none
Merged "imakscluster" as current context in /tmp/a.none
(base) Shubha:mydir sp$ az aks get-credentials --output table --resource-group $appAksGroupName --name $appAksClusterName --file /tmp/a.table
Merged "imakscluster" as current context in /tmp/a.table
(base) Shubha:mydir sp$ az aks get-credentials --output yamlc --resource-group $appAksGroupName --name $appAksClusterName --file /tmp/a.yamlc
Merged "imakscluster" as current context in /tmp/a.yamlc
(base) Shubha:mydir sp$ diff --from-file=/tmp/a.yaml /tmp/a.yamlc /tmp/a.json /tmp/a.jsonc /tmp/a.none /tmp/a.tsc /tmp/a.table
(base) Shubha:mydir sp$
(base) Shubha:mydir sp$ head -n 2 /tmp/a.yaml /tmp/a.yamlc /tmp/a.json /tmp/a.jsonc /tmp/a.none /tmp/a.tsc /tmp/a.table
==> /tmp/a.yaml <==
apiVersion: v1
clusters:

==> /tmp/a.yamlc <==
apiVersion: v1
clusters:

==> /tmp/a.json <==
apiVersion: v1
clusters:

==> /tmp/a.jsonc <==
apiVersion: v1
clusters:

==> /tmp/a.none <==
apiVersion: v1
clusters:

==> /tmp/a.tsc <==
apiVersion: v1
clusters:

==> /tmp/a.table <==
apiVersion: v1
clusters:
`

**Expected behavior**

For given values of `--output` parameter , respective format of contents should be populated/saved in file.

**Environment summary**

Install azure-cli using brew install

**Additional context**

NONE

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.