{"id":400,"date":"2024-04-29T10:18:12","date_gmt":"2024-04-29T10:18:12","guid":{"rendered":"https:\/\/blog.ngocha.biz\/?p=400"},"modified":"2024-04-29T10:18:12","modified_gmt":"2024-04-29T10:18:12","slug":"create-a-new-account-in-argo-cd","status":"publish","type":"post","link":"https:\/\/blog.ngocha.biz\/?p=400","title":{"rendered":"How to Create a New Account in Argo CD and Configure RBAC"},"content":{"rendered":"<p>In this guide, we will learn about Argo CD Accounts, RBAC, creating a new account in Argo CD, and configuring RBAC for the account.<\/p>\n<h2 id=\"what-are-accounts-on-argo-cd\">What are Accounts on Argo CD?<\/h2>\n<p>In Argo CD, accounts refer to the identities of users who have permission to access the Argo CD server through the UI or CLI.<\/p>\n<p>Initially, Argo CD only had an admin user with full permission on Argo CD, then user accounts are created for every user with limited permissions by the admin user.<\/p>\n<p>During the user account creation, the admin can assign two types of permissions:<\/p>\n<ol>\n<li>login &#8211; which gives UI access to users<\/li>\n<li>apikey &#8211; this allows users to create their own API tokens for access.<\/li>\n<\/ol>\n<p>We can create and disable accounts using the <strong>argocd-cm<\/strong> configmap, where every account&#8217;s details are stored; we can even disable the admin user using the <strong>argocd-cm<\/strong> configmap.<\/p>\n<h2 id=\"what-is-argo-cd-rbac\">What is Argo CD RBAC?<\/h2>\n<p>Argo CD RBAC is used to provide granular permissions for every user and group available on Argo CD.<\/p>\n<p>By giving the least permission to a user according to their task helps to increase the security of Argo CD.<\/p>\n<p>With the help of RBAC, only users with permission can access the resources on Argo CD.<\/p>\n<p>For example, if an application is deployed using Argo CD, the user who has permission on the application can only make changes to the application.<\/p>\n<p>If a user without permission on the application tries to make any changes, they will receive an unauthorized error.<\/p>\n<p>Argo CD RBAC provides permission for the following<\/p>\n<ol>\n<li>Users &#8211; Assign every user with specific permissions on Argo CD.<\/li>\n<li>Groups &#8211; Using this you can add multiple users to the group and the permissions given to the group are applied for every user in the group.<\/li>\n<li>Argo CD Resources &#8211; Gives permission to Argo CD resources like applications, projects, etc.<\/li>\n<li>Actions on Argo CD &#8211; Allow users to perform specific actions on Argo CD like creating an application or deleting it.<\/li>\n<\/ol>\n<h2 id=\"argo-cd-new-account-rbac-workflow\">Argo CD New Account &amp; RBAC Workflow<\/h2>\n<p>The diagram given below is the workflow for creating new account in Argo CD and RBAC<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/argocd-accounts-rbac-1.gif\" class=\"kg-image\" alt=\"Argo CD New Account &amp; RBAC Workflow\" loading=\"lazy\" width=\"800\" height=\"1040\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/argocd-accounts-rbac-1.gif 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/argocd-accounts-rbac-1.gif 800w\" sizes=\"auto, (min-width: 720px) 720px\"><\/figure>\n<p>Let me explain the diagram<\/p>\n<ol>\n<li>Let&#8217;s start with the bottom block in which a user creates a new account on Argo CD and add RBAC rules to the new account via Argo CD CLI using configmaps.<\/li>\n<li>You will learn about creating accounts and adding RBAC to the user account in the below example.<\/li>\n<li>The top block shows how RBAC works when a user performs any actions using the new account.<\/li>\n<li>In the diagram, a user tries to delete an application on Argo CD using the new account.<\/li>\n<li>If the account has RBAC policy to delete the application the application will get deleted or else the user will get a permission denied message.<\/li>\n<\/ol>\n<p>First, let&#8217;s start with creating a new account on Argo CD.<\/p>\n<h2 id=\"create-a-new-account-in-argo-cd\">Create a New Account in Argo CD<\/h2>\n<p>Before starting the process, make sure you have installed <a href=\"https:\/\/argo-cd.readthedocs.io\/en\/stable\/cli_installation\/?ref=devopscube.com\">argocd-cli<\/a> on your system.<\/p>\n<p>If you have installed Argo CD CLI run the following command to log in to Argo CD.<\/p>\n<pre><code>argocd login &lt;url&gt;:&lt;port&gt; --username &lt;username&gt; --password &lt;password&gt;<\/code><\/pre>\n<p>Make sure to replace the bolded letters in the above command with your Argo CD URL, port, username, and password.<\/p>\n<p>As an initial step let&#8217;s list every account in Argo CD using the command given below<\/p>\n<pre><code>argocd account list<\/code><\/pre>\n<p>You will get every available account on your Argo CD as shown below, my Argo CD only has an admin account so it&#8217;s only showing it<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-146-4.png\" class=\"kg-image\" alt=\"listing available users on argocd using argocd account list cli command\" loading=\"lazy\" width=\"491\" height=\"253\"><\/figure>\n<p>Now add a new account using Argo CDs configmap, to do that get the configmap <strong>argocd-cm<\/strong> by running the following command<\/p>\n<pre><code>kubectl get configmap argocd-cm -n argocd -o yaml &gt; argocd-cm.yaml<\/code><\/pre>\n<p>To add a new account, open the configmap file <strong>argocd-cm.yaml<\/strong> and add the following line under data<\/p>\n<pre><code>data:\n  accounts.crunchops: login<\/code><\/pre>\n<p>Now run the following command to apply the changes made in Argo CDs configmap<\/p>\n<pre><code>kubectl apply -n argocd  -f argocd-cm.yaml<\/code><\/pre>\n<p>Once it is executed, you can verify if your account has been added to Argo CD using the account list command<\/p>\n<pre><code>argocd account list<\/code><\/pre>\n<p>You can see your account has been successfully added to Argo CD<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-148-6.png\" class=\"kg-image\" alt=\"listing available users on argocd using argocd account list cli command\" loading=\"lazy\" width=\"428\" height=\"239\"><\/figure>\n<p>For more information on Argo CD Account creation refer <a href=\"https:\/\/argo-cd.readthedocs.io\/en\/stable\/operator-manual\/user-management\/?ref=devopscube.com#create-new-user\">this<\/a> document.<\/p>\n<h2 id=\"configure-rbac-for-the-account\">Configure RBAC for the Account<\/h2>\n<p>We are going to use the <strong>argocd-rbac-cm<\/strong> configmap file of Argo CD to configure RBAC, to get the RBAC configmap file run the following command<\/p>\n<pre><code>kubectl get configmap argocd-rbac-cm -n argocd -o yaml &gt; argocd-rbac-cm.yml<\/code><\/pre>\n<p>Now open the configmap file, for the newly created account I am only going to give <strong>read-only<\/strong> access, to do that add the following line in the <strong>argocd-rbac-cm<\/strong> file under <strong>data<\/strong><\/p>\n<pre><code>data:\n  policy.csv: |\n    p, role:readonly, applications, get, *, allow\n    g, crunchops, role:readonly<\/code><\/pre>\n<p>If you want to give other permission to the account you can replace <strong>readonly<\/strong> with readwrite, readexecute, or specify admin to give admin permissions.<\/p>\n<p>Run the following command to update RBAC<\/p>\n<pre><code>kubectl apply -n argocd -f argocd-rbac-cm.yml<\/code><\/pre>\n<p>The final step is to create a new password for the account, to create a new password run the following command<\/p>\n<pre><code>argocd account update-password --account &lt;new-account-name&gt; --current-password &lt;admin-password&gt; --new-password &lt;new-account-password&gt;<\/code><\/pre>\n<p>Make sure to replace the bolded letters in the above command with the admin password, new account name, and new password for the account.<\/p>\n<p>Once you have updated the password, you can use the username and password to log in to your Argo CD UI and CLI.<\/p>\n<p>If you go to <strong>Setting\/Accounts<\/strong> on your Argo CD UI, you can see the accounts as shown below<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-118-8.png\" class=\"kg-image\" alt=\"Viewing accounts on Argo CD UI\" loading=\"lazy\" width=\"1338\" height=\"666\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/image-118-8.png 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w1000\/2025\/03\/image-118-8.png 1000w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-118-8.png 1338w\" sizes=\"auto, (min-width: 720px) 720px\"><\/figure>\n<p>In my Argo CD, the account <strong>crunchops<\/strong> only has <strong>read access<\/strong> and permission to perform get action on applications, if I try to create a new application using the account <strong>crunchops<\/strong> I get the following permission denied message<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-119-9.png\" class=\"kg-image\" alt=\"Permission denied error beacuse of no permission to create application on Argo CD\" loading=\"lazy\" width=\"1262\" height=\"602\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/image-119-9.png 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w1000\/2025\/03\/image-119-9.png 1000w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-119-9.png 1262w\" sizes=\"auto, (min-width: 720px) 720px\"><\/figure>\n<p>For more information on Argo CD RBAC Configuration refer <a href=\"https:\/\/argo-cd.readthedocs.io\/en\/stable\/operator-manual\/rbac\/?ref=devopscube.com#basic-built-in-roles\">this<\/a> document.<\/p>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>In summary, we discussed creating a new account, configuring RBAC for that account, and creating a new password for the account.<\/p>\n<p>I hope this blog helps you understand how to create and attach certain permissions to an account in Argo CD.<\/p>\n<p>Also, here is a free study guide on <a href=\"https:\/\/devopscube.com\/certified-argo-project-associate\/\">Certified Argo Project Associate (CAPA)<\/a>.<\/p>\n<hr>\n<p><strong>Ngu\u1ed3n:<\/strong> <a href=\"https:\/\/devopscube.com\/create-a-new-account-in-argo-cd\/\" target=\"_blank\" rel=\"noopener noreferrer\">How to Create a New Account in Argo CD and Configure RBAC \u2014 DevOpsCube<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Source: https:\/\/devopscube.com\/create-a-new-account-in-argo-cd\/<\/p>\n","protected":false},"author":1,"featured_media":401,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-400","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops"],"_links":{"self":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts\/400","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=400"}],"version-history":[{"count":0,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts\/400\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/media\/401"}],"wp:attachment":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=400"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}