Bootstrap FreeKB - ArgoCD - List Accounts using the CLI
ArgoCD - List Accounts using the CLI

Updated:   |  ArgoCD articles

This assumes:

The argocd account list command can be used to list your ArgoCD Accounts.

~]$ argocd account list
NAME   ENABLED  CAPABILITIES
admin  true     login

 

Or on the Kubernetes or OpenShift cluster that ArgoCD is in the kubectl (Kubernetes) or oc (OpenShift) exec command can be used to run the argocd cluster list command in the ArgoCD server pod. It is noteworthy that by default the argocd login command will create the hidden .config file in the root directory of the operating system /.config and only root has permission to create files in the root directory of the operating system thus the --config /home/argocd/.config option is used so that the hidden .config file is create in our users home directory.

~]$ SERVER_POD=$(oc get pod --namespace openshift-gitops --selector=app.kubernetes.io/name=openshift-gitops-server --output custom-columns=POD:.metadata.name --no-headers)
~]$ ADMIN_PASSWD=$(oc get secret openshift-gitops-cluster --namespace openshift-gitops --output jsonpath='{.data.admin\.password}' | base64 --decode)
~]$ URL=$(oc get routes --namespace openshift-gitops --selector=app.kubernetes.io/name=openshift-gitops-server --output jsonpath="{.items[*].spec.host}")

~]$ oc exec $SERVER_POD --namespace openshift-gitops -- /bin/bash -c "argocd login --username admin --password $ADMIN_PASSWD $URL:443 --insecure --grpc-web --config /home/argocd/.config; argocd account list --server $URL:443 --insecure --grpc-web --config /home/argocd/.config"
'admin:login' logged in successfully
NAME   ENABLED  CAPABILITIES
admin  true     login

 

Likewise the argocd account get <name> command can be used to display a bit more details.

~]$ argocd account get admin
Name:               admin
Enabled:            true
Capabilities:       login
Tokens:
NONE


And the argocd account get-user-info command can be used to display information about the currently signed in user.

~]$ argocd account get-user-info
Logged In: true
Username: admin
Issuer: argocd
Groups:

 

The --output json flag can be used to display output as JSON instead of YAML.

~]$ argocd account get-user-info --output json
{
  "loggedIn": true,
  "username": "admin",
  "iss": "argocd"
}

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 6347d3 in the box below so that we can be sure you are a human.