logo

What are Active Directory Service Accounts?

Just like human users, computer programs also need access to resources on a network to function properly. There’s a difference in how these two groups—individuals and programs—access these resources, though. While humans utilize user accounts, computer programs use Active Directory service accounts. Active Directory service accounts allow computer services and programs to run without the need for human intervention, which is essential for ensuring that critical processes run uninterrupted behind the scenes. Nonetheless, like user accounts, you still need to manage Active Directory service accounts lest they expose your organization to cyber attacks. 

This guide will explore everything related to Active Directory service accounts — from understanding their importance to the different types of AD service accounts, to how to manage them.

Understanding Service Accounts

A service account is a type of privileged account that allows applications or services to interact with the operating system and other network resources. These non-human accounts work by assigning identities and permissions (privileges) to computer programs and services that try to access system resources, just like user accounts. Generally, there are several types of service accounts, including Managed Service Accounts, Group Managed Service Accounts, Local Service Accounts, and others, but more on this later on in the guide. 

Discover more about service accounts in the following posts:

Differences between user accounts and service accounts

The first and main difference between user accounts and service accounts is how they’re created. While user accounts require a network administrator to create and assign privileges, most (not all—some can be manually created) come pre-installed and configured as part of the service or software.

Another key difference lies in how they run and can be identified. With user accounts, you can identify the individual tied to a specific account because they’re designed to allow humans to access system resources. On the other hand, service accounts aren’t associated with a specific person because they’re created for non-human entities like applications or services. 

Because of how they run and their roles in an Active Directory environment, user accounts and service accounts also differ in their authentication. While user accounts require manual logins via user IDs and passwords, service accounts operate autonomously, so they don’t require permissions to run services.

Importance of Service Accounts

Service accounts are extremely important, especially in enterprise environments, for several reasons. But perhaps the most important reason is the role they play in facilitating the smooth operation of critical processes. Service accounts automate essential (and sometimes repetitive) tasks, like running backups, managing databases, and system updates. This way, enterprises can reduce administrative overhead, increase efficiency, and scale up and down as needed.

Service accounts can also act as proxies for human users to perform tasks that your enterprise might consider sensitive or require elevated permissions. This is vital for maintaining network security. By eliminating the human element from such tasks, your organization can protect its network from security-related incidents because only authorized services and applications can perform certain tasks. 

Some common examples of services and applications that use service accounts include:

Types of Service Accounts in Active Directory

Let’s now explore the different types of AD service accounts in detail, including their use cases:

Local Service Accounts

A (built-in local) user account is a type of Active Directory service account that automatically gets created on a machine or individual server during installation. These service accounts are not usually part of any domain and, thus, are typically used for services that only need access to local resources. 

The most common examples of local user accounts that applications can run under are the Local System account (or System Account), Local Service account, and Network Service Account. 

Domain Service Accounts

These AD service accounts are commonly used and ideal for services that require access to shared resources, such as databases or file servers. They’re created within Active Directory to facilitate access to resources across the network by services or applications. 

Managed Service Accounts (MSAs)

Also known as Standalone Managed Service Accounts (sMSA), Windows Managed Service Accounts (MSAs) are newer account types that Microsoft introduced in Windows Server 2008 R2 or Windows 7. These accounts are similar to domain accounts but with a major improvement—passwords are automatically managed and reset every 30 days. This improvement eliminates the need for an administrator to manage passwords, thus improving security. 

Apart from security, AD managed service accounts provide other administrative benefits, including:

  • You don’t need to manage service principal names (SPNs) as with local user accounts.
  • You don’t have to reset passwords for these accounts manually.
  • You can create domain accounts that facilitate the management of services on local machines. 

How to Create and Manage MSAs:

Before creating an MSA account, you must meet several prerequisites, including:

  • Windows Server 2008 R2 or Windows 7
  • Run ADPrep|Forest Prep
  • Net Framework 3.5
  • Active Directory module for Windows PowerShell

Once you meet the above prerequisites, follow the steps outlined below:

  1. Click the Start menu and open PowerShell. 
  2. In the PowerShell console, run the command “Import-module ActiveDirectory” to import the Active Directory module. 
  3. Next, run the command “New-ADService Account -Name <AccountName> -enable $true” Replace <AccountName> with your desired account name.
  4. This step involves associating the MSA with the computer that will run the service. To do this, run the  command “Add-ADComputerServiceAccount -Identity <ComputerName> -ServiceAccount <AccountName>
  5. Run the command “Install-ADServiceAccount -Identity <AccountName>” to install the MSA on the computer and make it available for use.
  6. Finally, configure the service to use the MSA for authentication. In the service’s properties, specify the MSA as the account under the “Log On” tab. Use the format “DOMAIN\<AccountName>$” when entering the MSA name.

Group Managed Service Accounts (gMSAs)

These service accounts are an extension of Managed Service Accounts—they support the same functionalities but extend them to multiple servers. Additionally, gMSAs are only supported by Windows Server 2012 or later. 

How to Create and Manage gMSAs

You don’t have to meet any functional level or domain requirements to create gMSAs. 

  1. Create the KDS root by running the command “Add-KdsRootKey -EffectiveTime ((Get-Date).AddHours(-10))” on the Active Directory PowerShell module.
  2. Open Powershell and run the following command to import the Active Directory module: “Import-Module ActiveDirectory
  3. Run the following command :”New-ADServiceAccount -Name <AccountName> -DNSHostName <DNSHostName> -PrincipalsAllowedToRetrieveManagedPassword "<GroupName>” to create the gMSA. 

“AccountName” in this case will be the name of the gMSA, while “DNSHostName” is the name of the domain controller, and “GroupName” is the group or computer objects allowed to retrieve the gMSA password.

  1. Install the account on each server that will use the gMSA by running the command, “Install-ADServiceAccount
  2. To verify that you’ve installed the gMSA and it’s functioning correctly on each server, use the following command: “Test-ADServiceAccount <AccountName>” 

If you see the result is true, you have properly installed the gMSA and it’s ready for use. To use the gMSA for a service, open the service’s properties and navigate to the “Log On” tab. Specify the gMSA as the account using the format “DOMAIN\<AccountName>$”

Common Challenges and How to Overcome Them

Managing AD service accounts is not without its fair share of challenges. In this section, we explore what you should expect to face when dealing with service accounts and how to deal with these challenges by incorporating best practices that keep service accounts secure and running as they should. 

Password Management Issues

One of the most common challenge associated with Active Directory service accounts is the lack of password management. Unlike user accounts, service accounts rarely go through management practices like password rotation where you constantly change or reset your passwords after a certain period. The reason why your IT team might be overlooking this is not because they’re careless: quite far from it, actually. It’s because they fear the likely consequence of changing service accounts’ passwords, which is disrupting critical processes.

Auditing and Monitoring Service Account Usage

Monitoring and auditing service accounts pose a huge challenge for IT administrators. There are several reasons for this. For one, the number of service accounts in a single enterprise can be incredibly high that it becomes impossible to keep up. While you may be able to monitor some of these accounts, others may fall through the cracks because you simply don’t know they exist. Moreover, accountability can become an issue because these accounts are inherently not attached to a specific user.

Service Account Security

As with most AD accounts, security remains a challenge for service accounts. Most service accounts have high privileges and permissions, so if a security breach were to occur, they would have access to so many resources across your organization’s network. Additionally, if you have too many service accounts that are unaccounted for, securing each and every single one may be impossible. 

Orphaned or Unused Service Accounts

Left unchecked, your enterprise may be among the many organizations that have so many service accounts that you simply can’t keep track of them. This may occur if employees managing these accounts leave your organization, if you migrate to new systems, or if you forget to remove temporary service accounts. These service accounts often go unnoticed and can end up accumulating on your network. 

Best Practices for Managing Service Accounts

There are several best practices you can implement to prevent and deal with the challenges discussed above. Some of these best practices include: 

  • Principle of Least Privilege (PoLP): This simply means granting service accounts only the (minimum) required permissions to perform the tasks they’re required to do. This best practice minimizes the risk of unauthorized actions and access. Additionally, in the case that a security breach occurs, the amount of damage the unauthorized user can cause is reduced.
  • Regularly Review and Update Permissions: On top of implementing PoLP, you should occasionally revise the permissions that each service account holds. This is because, over time, permissions may change for different applications and services, and you should ensure that they don’t have more access than necessary. 
  • Implement Strong Password Policies: For service accounts that don’t automatically change passwords like traditional domain accounts, strong password policies like using complex and long passwords, regularly changing passwords for service accounts with high privileges, and safely storing passwords can help reduce the possibility of breaches. 
  • Use MSAs and gMSAs to Reduce Administrative Overhead: MSAs and gMSAs automate password management and simplify SPN configuration. This frees up IT staff’s time to focus on other important tasks.
  • Monitor and Audit Service Account Activities: Creating service accounts and forgetting about them is a recipe for disaster (i.e. a security breach). As such, you must implement policies for conducting regular audits on accounts to detect and stop suspicious behavior.

Cleaning Up Unused Service Accounts

Unused service accounts can present security problems for your organization. As already established, some of these accounts may have very high privileges, so if an attacker gained access to one of them, they can do extensive damage. Identifying unused or orphaned service accounts is crucial. There are several ways you can do this, including: 

  • Using Privileged Access Management (PAM) Solutions: You can leverage solutions like Netwrix that scan your entire IT environment to discover all existing service accounts. From the list of accounts, you can find any unused and unnecessary accounts and remove them.
  • Leverage Search Queries: You can use a common query, “Service Accounts not logged in for $days” to identify old service accounts that aren’t used within your AD environment. 

Steps for safely removing unused service accounts

Removing old and unused accounts requires that you follow several steps to ensure that you don’t compromise the entire system. That said, after you’ve identified unused service accounts:

  1. Verify that the identified accounts are no longer needed. To do this, you can use the following PowerShell command: “Get-ADUser -Identity <AccountName> -Properties LastLogonDate”
  2. Instead of immediately deleting the service account, it’s advisable to disable it first. This allows you to verify that disabling the account does not affect any critical services.
  3. Once you have confirmed that disabling the service account will not cause any issues, you can delete it by running the following PowerShell command: “Remove-ADUser -Identity <AccountName>”

Tools and Techniques for Managing Service Accounts

PowerShell has proven to be a powerful tool for managing service accounts in your AD environment. It provides several commands that you can use to create, modify, and delete accounts easily and quickly. You can also use it to manage permissions and automate routine tasks. 

How Netwrix Can Help

Active Directory service accounts, while useful, can also pose security risks for your entire organization if not properly managed. That’s why relying on a solution that can help you create, manage, and maintain AD service accounts best practices is essential. At Netwrix, Active Directory is our specialty, so you can count on us to keep your service accounts secure. Our end-to-end Active Directory Security Solution works by performing risk assessments, implementing safeguards to protect your AD environment, responding to threats immediately, and supporting comprehensive AD recovery. 

FAQ

What is a service account in Active Directory?

A service account is a non-human account created in Active Directory to run applications or services without the need for manual intervention.  

How do I create an Active Directory service account?

You can create an Active Directory service account by using PowerShell or Active Directory Users and Computers (ADUC) management console. 

What is the difference between a user account and a service account in Active Directory?

The main difference between user accounts and service accounts is that user accounts are associated with a single user, while service accounts don’t have a specific user (they’re non-human). 

What is the difference between a computer account and a service account?

It’s easy to mix up computer and service accounts, but the two are different. While a computer account is tied to the identity of a machine, a service account is tied to the identity of a particular service or application running on that machine.

How do I create a service account for AD?

There are two main ways you can create a service account in Active Directory—PowerShell or Active Directory Users and Computers (ADUC). 

What is the difference between ad user account and service account?

User accounts allow human users to access resources located in AD environments, while service accounts allow programs or services to access system resources without needed management from a human administrator. 

What is an example of a service account?

Examples of service accounts include Local User Accounts, Domain, Managed Service Accounts, and group Managed Service Accounts. 

What are Active Directory managed service accounts?

Active Directory Managed Service Accounts (MSAs) are special types of service accounts that are managed by the domain, meaning that the domain controller automatically handles tasks like password management and delegation of access rights.

Dirk Schrader is a Resident CISO (EMEA) and VP of Security Research at Netwrix. A 25-year veteran in IT security with certifications as CISSP (ISC²) and CISM (ISACA), he works to advance cyber resilience as a modern approach to tackling cyber threats. Dirk has worked on cybersecurity projects around the globe, starting in technical and support roles at the beginning of his career and then moving into sales, marketing and product management positions at both large multinational corporations and small startups. He has published numerous articles about the need to address change and vulnerability management to achieve cyber resilience.