<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Abhinav Dadhich</title>
    <description>The latest articles on DEV Community by Abhinav Dadhich (@abhinav_dadhich_ef260da4f).</description>
    <link>https://dev.to/abhinav_dadhich_ef260da4f</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1837634%2Faf72fe2a-8bcb-4c03-98ef-075ea49b2d67.jpg</url>
      <title>DEV Community: Abhinav Dadhich</title>
      <link>https://dev.to/abhinav_dadhich_ef260da4f</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abhinav_dadhich_ef260da4f"/>
    <language>en</language>
    <item>
      <title>Simplifying Access Control in EKS: A Guide to AWS EKS Cluster Access Management</title>
      <dc:creator>Abhinav Dadhich</dc:creator>
      <pubDate>Tue, 17 Sep 2024 08:19:05 +0000</pubDate>
      <link>https://dev.to/abhinav_dadhich_ef260da4f/simplifying-access-control-in-eks-a-guide-to-aws-eks-cluster-access-management-3n5a</link>
      <guid>https://dev.to/abhinav_dadhich_ef260da4f/simplifying-access-control-in-eks-a-guide-to-aws-eks-cluster-access-management-3n5a</guid>
      <description>&lt;p&gt;Previously Providing access to an EKS cluster or specific application-based access can be a complex process. Kubernetes leverages Role-Based Access Control (RBAC) to manage these permissions, allowing cluster administrators to assign access based on user roles within the organization. EKS integrates RBAC with AWS IAM roles, which makes it highly effective for handling authorization.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Consider this scenario&lt;/strong&gt;: different teams may require various levels of access to the cluster—like the monitoring team needing access to the monitoring namespace, or the development team requiring read-only access to the dev namespace. In such cases, the administrator defines these permissions using RBAC, mapping AWS IAM identities to Kubernetes roles. This mapping is achieved through a ConfigMap called aws-auth, located in the kube-system namespace, where AWS roles are linked to Kubernetes users and groups.&lt;/p&gt;

&lt;p&gt;This combination of RBAC and AWS IAM provides a flexible, scalable, but a complex process to manage fine-grained access control in EKS clusters, simplifying how permissions are handled for multiple teams with distinct access needs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F666sdeo1i46d3i1x7qiv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F666sdeo1i46d3i1x7qiv.png" alt="Image description" width="630" height="262"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Historically, cluster creation was handled via Amazon EKS APIs, but administrators had to switch to the Kubernetes API to define mappings between AWS IAM users and their Kubernetes permissions. This approach introduced complexity, making the process of granting access to EKS clusters cumbersome and leaving “shadow administrator” (root-level) permissions with the principal who created the cluster.&lt;/p&gt;

&lt;p&gt;In December 2023, AWS launched a new feature called &lt;strong&gt;EKS Cluster Access Management&lt;/strong&gt;. This simplifies the process of granting and managing access within EKS clusters. Instead of relying on the aws-auth ConfigMap, access can now be managed through the &lt;strong&gt;AWS API directly&lt;/strong&gt;. This new feature is supported in EKS versions starting from v1.23.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnrq4cnssy84uq126pgor.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnrq4cnssy84uq126pgor.png" alt="Image description" width="800" height="316"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Shadow administrator&lt;/strong&gt;: In Amazon EKS, the user who initially creates the cluster is automatically granted administrative privileges, although this access isn't explicitly visible in the usual permission settings. This user, often referred to as a "shadow administrator," has full control over the cluster by default. EKS Cluster Access Management introduces a solution for identifying and managing these shadow administrators, making their presence visible within the IAM access entries on the cluster’s access management page. This feature allows administrators to audit, modify, or revoke these hidden privileges, enhancing transparency and control over cluster access.&lt;/p&gt;

&lt;h2&gt;
  
  
  two key concepts—'access entries' and 'access policies'—form the foundation for managing permissions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Access Entries&lt;/strong&gt;: When you grant access to an AWS principal (such as a user or service), you create an access entry specific to that principal. This entry serves as a gateway for assigning permissions through Kubernetes groups or by linking it to access policies. The access entry centralizes control over what an AWS principal can do within the EKS cluster.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxmnxpguj99srqmx85njr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxmnxpguj99srqmx85njr.png" alt="Image description" width="800" height="443"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Access Policies&lt;/strong&gt;: These are EKS-specific policies designed to control Kubernetes permissions for access entries. Unlike AWS IAM policies, they are defined within Amazon EKS and offer flexibility in how permissions are granted. You can apply an access policy either at the cluster level (similar to a Kubernetes ClusterRole) or the namespace level (analogous to a Role). Each policy defines a set of Kubernetes permissions curated by AWS, simplifying the assignment of access rights.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F73ox0h097i000x92kinz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F73ox0h097i000x92kinz.png" alt="Image description" width="800" height="637"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kubernetes access management in Amazon EKS is governed by a cluster-wide setting known as the authentication mode. In EKS, there are three distinct authentication modes that determine how access permissions are managed:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;API_AND_CONFIG_MAP&lt;/strong&gt;: Both the aws-auth ConfigMap and Access Entries are considered in this mode. However, if an AWS principal is defined in both the ConfigMap and an Access Entry, the Access Entry takes precedence, and the permissions granted in the ConfigMap are ignored. This mode provides a hybrid approach, combining traditional ConfigMap-based access with Access Entries for more flexibility. By default, API_AND_CONFIG_MAP is selected for clusters using the latest versions of EKS, offering an optimal balance of control and convenience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CONFIG_MAP&lt;/strong&gt;: In this mode, the control plane solely relies on the aws-auth ConfigMap to manage access. No Access Entries can be created within the cluster, and all permissions must be explicitly defined in the ConfigMap.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;API&lt;/strong&gt;: This mode bypasses the aws-auth ConfigMap entirely, relying exclusively on Access Entries to manage permissions. This is ideal for organizations looking to centralize access control directly within the EKS environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkqnti0b9wjfchqshdo37.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkqnti0b9wjfchqshdo37.png" alt="Image description" width="800" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  CLI Commands for Managing AWS EKS Access
&lt;/h2&gt;

&lt;p&gt;To ensure compatibility with AWS EKS commands, make sure you're using the latest version of the AWS CLI. Some commands may not work with older versions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Modify the Authentication Mode&lt;/strong&gt;:&lt;br&gt;
&lt;code&gt;aws eks update-cluster-config --name &amp;lt;CLUSTER_NAME&amp;gt; --access-config authenticationMode=API&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;List Access Policies&lt;/strong&gt;:&lt;br&gt;
&lt;code&gt;aws eks list-access-policies&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;List Access Entries in Your Cluster&lt;/strong&gt;:&lt;br&gt;
&lt;code&gt;aws eks list-access-entries --cluster-name &amp;lt;cluster-name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create an Access Entry for an IAM User&lt;/strong&gt;:&lt;br&gt;
&lt;code&gt;aws eks create-access-entry --cluster-name demo-cluster \&lt;br&gt;
  --principal-arn arn:aws:iam::${ACCOUNT_ID}:user/cluster-admin&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Associate AmazonEKSClusterAdminPolicy to the Access Entry&lt;/strong&gt;:&lt;br&gt;
&lt;code&gt;aws eks associate-access-policy --cluster-name  demo-cluster \&lt;br&gt;
  --principal-arn arn:aws:iam::${ACCOUNT_ID}:user/cluster-admin \&lt;br&gt;
  --policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy \&lt;br&gt;
  --access-scope type=cluster&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;When creating access entries in Amazon EKS, you have several options tailored to different types of IAM principals:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;STANDARD&lt;/strong&gt;: This is the default type, used for IAM users and roles. You can also utilize Kubernetes RBAC authorization with STANDARD access entries, allowing you to assign one or more Kubernetes group names to the entry.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EC2 Linux, EC2 Windows, and FARGATE_LINUX&lt;/strong&gt;: These types are specific to different compute environments.&lt;/p&gt;

&lt;p&gt;However, there are important considerations to keep in mind:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Service Linked Roles&lt;/strong&gt;: Access entries cannot be created for service-linked roles.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Unique IAM Principal&lt;/strong&gt;: Each access entry must include the Amazon Resource Name (ARN) of a single, unique IAM principal. An IAM principal cannot be associated with more than one access entry.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Immutability&lt;/strong&gt;: Once an access entry is created, you cannot change its IAM principal or type.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deletion of IAM Principals&lt;/strong&gt;: If an IAM principal is deleted, the associated access entry will not be automatically removed. You must manually delete the access entry.&lt;/p&gt;

&lt;p&gt;Understanding these constraints ensures effective management of access entries and helps maintain a secure and organized cluster environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Switching authentication modes
&lt;/h2&gt;

&lt;p&gt;on an existing EKS cluster is a one-way operation, with specific pathways for transition:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CONFIG_MAP&lt;/strong&gt; to &lt;strong&gt;API_AND_CONFIG_MAP&lt;/strong&gt;: You can move from the &lt;strong&gt;CONFIG_MAP&lt;/strong&gt; mode to &lt;strong&gt;API_AND_CONFIG_MAP&lt;/strong&gt;, which allows for a combined approach using both the aws-auth ConfigMap and Access Entries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;API_AND_CONFIG_MAP&lt;/strong&gt; to &lt;strong&gt;API&lt;/strong&gt;: You can also transition from &lt;strong&gt;API_AND_CONFIG_MAP&lt;/strong&gt; to &lt;strong&gt;API&lt;/strong&gt;, which focuses solely on Access Entries and ignores the aws-auth ConfigMap.&lt;/p&gt;

&lt;p&gt;However, once you make these transitions, reverting to a previous mode is not permitted:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;API&lt;/strong&gt; to &lt;strong&gt;CONFIG_MAP&lt;/strong&gt; or &lt;strong&gt;API_AND_CONFIG_MAP&lt;/strong&gt;: You cannot switch back to CONFIG_MAP or API_AND_CONFIG_MAP after moving to API.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;API_AND_CONFIG_MAP&lt;/strong&gt; to &lt;strong&gt;CONFIG_MAP&lt;/strong&gt;: Similarly, once you have transitioned from CONFIG_MAP to API_AND_CONFIG_MAP, reverting directly to CONFIG_MAP is not allowed.&lt;/p&gt;

&lt;p&gt;This one-way nature of authentication mode changes ensures that once a new access management approach is adopted, it cannot be reversed, allowing for a consistent and predictable security posture.&lt;/p&gt;

&lt;h2&gt;
  
  
  Note
&lt;/h2&gt;

&lt;p&gt;Access entries and access policies take precedence over configurations in the aws-auth ConfigMap. For example, if a user has read-only access assigned in the aws-auth ConfigMap but has been granted ClusterAdmin access via the AWS API, the user will be granted ClusterAdmin privileges.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Configure &amp; Setup Azure DevOps Self Hosted Linux Runner as a Systemd service</title>
      <dc:creator>Abhinav Dadhich</dc:creator>
      <pubDate>Thu, 25 Jul 2024 15:19:35 +0000</pubDate>
      <link>https://dev.to/abhinav_dadhich_ef260da4f/how-to-configure-setup-azure-devops-self-hosted-linux-runner-as-a-systemd-service-2kl0</link>
      <guid>https://dev.to/abhinav_dadhich_ef260da4f/how-to-configure-setup-azure-devops-self-hosted-linux-runner-as-a-systemd-service-2kl0</guid>
      <description>&lt;p&gt;To build your code or deploy your software using Azure Pipelines, you need at least one agent. As you add more code and people, you'll eventually need more.&lt;/p&gt;

&lt;p&gt;When your pipeline runs, the system begins one or more jobs. An agent is computing infrastructure with installed agent software that runs one job at a time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Azure Pipelines provides several different types of agents.&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;u&gt;Microsoft-hosted agents&lt;/u&gt; (Agents hosted and managed by Microsoft).&lt;/li&gt;
&lt;li&gt;
&lt;u&gt;Self-hosted agents&lt;/u&gt; (Agents that you configure and manage, hosted on your VMs).&lt;/li&gt;
&lt;li&gt;
&lt;u&gt;Azure Virtual Machine Scale Set agents&lt;/u&gt; (A form of self-hosted agents, using Azure Virtual Machine Scale Sets, that can be auto-scaled to meet demands).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In this document, we will cover how to set up a self-hosted runner on an Ubuntu machine, configuring it to run as a systemd service.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Microsoft Account: Ensure you have a Microsoft account set up.&lt;/li&gt;
&lt;li&gt;Azure Account and Subscription: Set up your Azure account and ensure you have an active subscription.&lt;/li&gt;
&lt;li&gt;Azure Virtual Machine: Create a VM running Ubuntu 22.04 in the Azure Cloud.&lt;/li&gt;
&lt;li&gt;Personal Access Token: Generate a Personal Access Token (PAT) in Azure DevOps.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Steps to Configure Self Hosted in Ubuntu Machine&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In your web browser, navigate to Agent pools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sign in to your organization (&lt;a href="https://dev.azure.com/%7Byourorganization%7D" rel="noopener noreferrer"&gt;https://dev.azure.com/{yourorganization}&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Choose Azure DevOps, Organization settings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5uohx8hzq9sx2wagkzrp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5uohx8hzq9sx2wagkzrp.png" alt="Image description" width="514" height="1474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose Agent pools.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0c2i712rk8m0vrnsuwtb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0c2i712rk8m0vrnsuwtb.png" alt="Image description" width="480" height="1370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ADD a new Agent pool (Click on ADD Pool and then select Self Hosted)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffzxyvyelyuyy56jn69ge.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffzxyvyelyuyy56jn69ge.png" alt="Image description" width="800" height="1182"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Setup a New Agent &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcg451amg7nmye7ytyjeg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcg451amg7nmye7ytyjeg.png" alt="Image description" width="800" height="339"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on Linux (As we are using Linux Machine), and then copy the URL to download the agent in your Ubuntu Machine.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5gdczb7rr7ipjuy5dko5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5gdczb7rr7ipjuy5dko5.png" alt="Image description" width="800" height="713"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Login to your Azure VM and then execute these following commands to download and setup your agent&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;mkdir myagent &amp;amp;&amp;amp; cd myagent&lt;/li&gt;
&lt;li&gt;wget &lt;a href="https://vstsagentpackage.azureedge.net/agent/3.242.1/vsts-agent-linux-x64-3.242.1.tar.gz" rel="noopener noreferrer"&gt;https://vstsagentpackage.azureedge.net/agent/3.242.1/vsts-agent-linux-x64-3.242.1.tar.gz&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;tar zxvf vsts-agent-linux-x64-3.242.1.tar.gz&lt;/li&gt;
&lt;li&gt;./config.sh&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fouobrsn5vhnyajtcfgfc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fouobrsn5vhnyajtcfgfc.png" alt="Image description" width="800" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note : Configure your Agent by Answering these following questions &lt;br&gt;
"&lt;u&gt;Enter server URL&lt;/u&gt;" &amp;gt; &lt;a href="https://dev.azure.com/%7Byourorganization%7D/" rel="noopener noreferrer"&gt;https://dev.azure.com/{yourorganization}/&lt;/a&gt;&lt;br&gt;
"&lt;u&gt;Enter authentication type (press enter for PAT)&lt;/u&gt;" &amp;gt; &lt;br&gt;
"&lt;u&gt;Enter personal access token&lt;/u&gt;" &amp;gt; &lt;br&gt;
"&lt;u&gt;Enter agent pool (press enter for default)&lt;/u&gt;" &amp;gt; &lt;br&gt;
"&lt;u&gt;Enter agent name (press enter for AZDevops-test-runner)&lt;/u&gt;" &amp;gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configure the Agent to run as a Service&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;sudo ./svc.sh install &amp;amp;&lt;/li&gt;
&lt;li&gt;./runsvc.sh &amp;amp;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Now Follow these steps to run this service as a systemd service &lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Create a file called /etc/systemd/system/MyTestAgent.service
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Unit]
Description=Runner_AD
After=network.target
StartLimitIntervalSec=0
[Service]
#User=root
User=azureuser
#Restart=on-failure
ExecStart=/home/azureuser/myagent/runsvc.sh
StandardOutput=syslog
StandardError=syslog
#Change this to find app logs in /var/log/syslog
SyslogIdentifier=adrunner
[Install]
WantedBy=multi-user.target
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Your runsvc.sh should look like this (Make the changes accordingly)
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

# convert SIGTERM signal to SIGINT
# for more info on how to propagate SIGTERM to a child process see: http://veithen.github.io/2014/11/16/sigterm-propagation.html
trap 'kill -INT $PID' TERM INT

if [ -f ".path" ]; then
    # configure
    export PATH=`cat .path`
    echo ".path=${PATH}"
fi

# insert anything to setup env when running as a service

# fallback on Node16 if Node20 is not supported by the host
./externals/node20_1/bin/node --version
if [ $? == 0 ]; then
    NODE_VER="node20_1"
else
    NODE_VER="node16"
fi

# run the host process which keep the listener alive
./externals/"$NODE_VER"/bin/node ./bin/AgentService.js &amp;amp;
PID=$!
wait $PID
trap - TERM INT
wait $PID
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;sudo systemctl daemon-reload&lt;/li&gt;
&lt;li&gt;sudo systemctl enable MyTestAgent.service &lt;/li&gt;
&lt;li&gt;sudo systemctl start MyTestAgent.service &lt;/li&gt;
&lt;li&gt;sudo systemctl status MyTestAgent.service&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6n8lcava94v6n65g7nxe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6n8lcava94v6n65g7nxe.png" alt="Image description" width="800" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw4bucqv3zndks7b6b4eo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw4bucqv3zndks7b6b4eo.png" alt="Image description" width="800" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Voila! We have successfully Configured &amp;amp; Setup Azure DevOps Self Hosted Linux Runner as a Systemd service.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
