Skip to content

Commit be997e2

Browse files
Merge pull request #5247 from DeCohen/WI359551-rewrite-configure-dsa-mdi-with-gmsa
Proofread and edit doc structure
2 parents 2de0fbb + 7561a69 commit be997e2

File tree

2 files changed

+82
-54
lines changed

2 files changed

+82
-54
lines changed

defender-for-identity/deploy/create-directory-service-account-gmsa.md

Lines changed: 81 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,56 @@
11
---
2-
title: Configure a DSA for Defender for Identity with a gMSA
3-
description: Learn how to configure a Directory Service Account for Defender for Identity with a group managed service account (gMSA).
4-
ms.date: 12/11/2023
2+
title: Configure a gMSA directory service account for Defender for Identity
3+
description: Create and configure a group managed service account (gMSA) for use as the Directory service account in Microsoft Defender for Identity.
4+
ms.date: 10/12/2025
55
ms.topic: how-to
66
ms.reviewer: rlitinsky
77
---
88

9-
# Configure a Directory Service Account for Defender for Identity with a gMSA
9+
# Configure a gMSA directory service account for Defender for Identity
1010

11-
This article describes how to create a [group managed service account (gMSA)](/windows-server/security/group-managed-service-accounts/getting-started-with-group-managed-service-accounts) for use as a Defender for Identity DSA entry.
11+
This article describes how to create a [group managed service account (gMSA)](/windows-server/security/group-managed-service-accounts/getting-started-with-group-managed-service-accounts) to use as a Microsoft Defender for Identity directory service account entry.
1212

13-
For more information, see [Directory Service Accounts for Microsoft Defender for Identity](../directory-service-accounts.md).
14-
15-
>[!NOTE]
16-
>In multi-forest, multi-domain environments, the sensors that need to use the gMSA need to have their computer accounts trusted by the domain where the gMSA was created.
17-
>We recommend creating a universal group in each domain, containing all sensors' computer accounts so that all sensors can retrieve the gMSAs' passwords, and perform the cross-domain authentications.
18-
>We also recommend creating the gMSAs with a unique name for each forest or domain.
13+
## Prerequisites
1914

20-
## Prerequisites: Grant permissions to retrieve the gMSA account's password
15+
- Make sure you have permissions to create gMSAs and security groups in Active Directory.
2116

22-
Before you create the gMSA account, consider how to assign permissions to retrieve the account's password.
17+
- Assign permissions that allow the sensor to retrieve the gMSA password.
2318

24-
When using a gMSA entry, the sensor needs to retrieve the gMSA's password from Active Directory. This can be done either by assigning to each of the sensors or by using a group.
19+
- Choose how to configure password retrieval:
2520

26-
- **In a single-forest, single-domain deployment**, if you aren't planning to install the sensor on any AD FS / AD CS servers, you can use the built-in Domain Controllers security group.
21+
- Assign the gMSA account directly to each of the sensors.
2722

28-
- **In a forest with multiple domains**, when using a single DSA account, we recommend creating a universal group and adding each of the domain controllers and AD FS / AD CS servers to the universal group.
29-
30-
If you add a computer account to the universal group after the computer received its Kerberos ticket, it won't be able to retrieve the gMSA's password until it receives a new Kerberos ticket. The Kerberos ticket has a list of groups that an entity is a member of when the ticket is issued.
23+
- Use a group that contains all the sensors that need to use the gMSA account.
3124

32-
In such scenarios, do one of the following:
25+
- Choose the appropriate group based on your deployment:
3326

34-
- **Wait for new Kerberos ticket to be issued**. Kerberos tickets are normally valid for 10 hours.
27+
- **Single-forest, single-domain deployment**: Use the built-in Domain Controllers security group if you're not installing sensors on Active Directory Federation Services (AD FS) or Active Directory Certificate Services (AD CS) servers.
3528

36-
- **Reboot the server**. When the server is rebooted, a new Kerberos ticket is requested with the new group membership.
29+
- **Forest with multiple domains**: If you use a single Directory service account (DSA), we recommend creating a universal group and adding each of the domain controllers and AD FS or AD CS servers to the universal group.
3730

38-
- **Purge the existing Kerberos tickets**. This forces the domain controller to request a new Kerberos ticket.
31+
- In multi-forest or multi-domain environments, make sure the domain where you create the gMSA trusts the sensors’ computer accounts.
32+
33+
- Create a universal group in each domain that includes all sensors computer accounts so that all sensors can retrieve the gMSAs' passwords, and perform the cross-domain authentications.
3934

40-
To purge the tickets, from an administrator command prompt on the domain controller, run the following command: `klist purge -li 0x3e7`
4135

4236
## Create the gMSA account
4337

44-
This section describes how to create a specific group that can retrieve the account's password, create a gMSA account, and then test that the account is ready to use.
38+
1. If you've never used a gMSA account before, you might need to generate a new root key for the Microsoft Group Key Distribution Service (KdsSvc) within Active Directory. This step is required only once per forest.
39+
To generate a new root key for immediate use, run the following command:
40+
41+
```powershell
42+
Add-KdsRootKey -EffectiveImmediately
43+
```
4544
46-
>[!NOTE]
47-
> If you have never used gMSA accounts before, you might need to generate a new root key for the Microsoft Group Key Distribution Service (KdsSvc) within Active Directory. This step is required only once per forest.
48-
>
49-
> To generate a new root key for immediate use, run the following command:
50-
> ```powershell
51-
> Add-KdsRootKey -EffectiveImmediately
52-
> ```
45+
1. Run the PowerShell commands as an administrator. This script will:
46+
- Create a gMSA account.
47+
- Create a group for the gMSA account.
48+
- Add the specified computer accounts to that group.
5349
54-
Update the following code with variable values for your environment. Then, run the PowerShell commands as an administrator:
50+
1. Before running the script:
51+
52+
- Update the variable values to match your environment.
53+
- Make sure to give each gMSA a unique name for each forest or domain.
5554
5655
```powershell
5756
# Variables:
@@ -81,46 +80,72 @@ New-ADServiceAccount -Name $gMSA_AccountName -DNSHostName "$gMSA_AccountName.$en
8180
-PrincipalsAllowedToRetrieveManagedPassword $gMSA_HostsGroup
8281
```
8382

84-
## Grant required DSA permissions
83+
84+
## Refresh Kerberos tickets after changing group membership
85+
86+
The Kerberos ticket has a list of groups that an entity is a member of when the ticket is issued. If you add a computer account to the universal group after it already received a Kerberos ticket, it can't retrieve the gMSA's password until it gets a new ticket.
87+
88+
To refresh the Kerberos ticket, you can:
89+
90+
- **Wait for new Kerberos ticket to be issued**. Kerberos tickets are typically valid for 10 hours.
91+
92+
- **Reboot the server** to request a new Kerberos ticket with the new group membership.
93+
94+
- **Purge the existing Kerberos tickets** to force the domain controller to request a new Kerberos ticket. Run the following command to purge the tickets, from an administrator command prompt on the domain controller: `klist purge -li 0x3e7`
95+
96+
## Grant required directory service account permissions
8597

8698
[!INCLUDE [dsa-permissions](../includes/dsa-permissions.md)]
8799

88100
## Verify that the gMSA account has the required rights
89101

90-
The Defender for Identity sensor service, *Azure Advanced Threat Protection Sensor*, runs as a *LocalService* and performs impersonation of the DSA account. The impersonation will fail if the *Log on as a service* policy is configured but the permission hasn't been granted to the gMSA account. In such cases, you'll see the following health issue: **Directory services user credentials are incorrect.**
102+
The Defender for Identity sensor service, *Azure Advanced Threat Protection Sensor*, runs as a *LocalService* that impersonates the DSA account. If the *Log on as a service* policy is configured but the permission wasn't granted to the gMSA account, the impersonation fails. In that case, you see the following health issue: **Directory services user credentials are incorrect.**
103+
104+
If you see this alert, check to see if the *Log on as a service policy* is configured either in a Group Policy setting or in a Local Security Policy.
105+
106+
### Check the Local Security Policy
91107

92-
If you see this alert, we recommend checking to see if the *Log on as a service policy* is configured. If you need to configure the *Log on as a service* policy, do so either in a Group Policy setting or in a Local Security Policy.
108+
1. Run `secpol.msc`
109+
1. Select **Local Policies** > **User Rights Assignment**
110+
1. Open the **Log on as a service policy** setting.
93111

94-
- **To check the Local Policy**, run `secpol.msc` and select **Local Policies**. Under **User Rights Assignment**, go to the **Log on as a service policy** setting. For example:
112+
:::image type="content" source="../media/log-on-as-a-service.png" alt-text="Screenshot of the log on as a service property.":::
95113

96-
:::image type="content" source="../media/log-on-as-a-service.png" alt-text="Screenshot of the log on as a service properties.":::
114+
1. Once the policy is enabled, add the gMSA account to the list of accounts that can log on as a service.
97115

98-
If the policy is enabled, add the gMSA account to the list of accounts that can log on as a service.
116+
### Check the Group Policy setting
117+
118+
1. Run `rsop.msc`
119+
1. Go to **Computer Configuration -> Windows Settings -> Security Settings -> Local Policies -> User Rights Assignment -> Log on as a service.**
99120

100-
- **To check if the setting is configured in a Group Policy**: Run `rsop.msc` and see if the **Computer Configuration -> Windows Settings -> Security Settings -> Local Policies -> User Rights Assignment -> Log on as a service** policy is selected. For example:
101-
102121
:::image type="content" source="../media/log-on-as-a-service-gpmc.png" alt-text="Screenshot of the Log on as a service policy in the Group Policy Management Editor." lightbox="../media/log-on-as-a-service-gpmc.png":::
103122

104-
If the setting is configured, add the gMSA account to the list of accounts that can log on as a service in the Group Policy Management Editor.
123+
1. Once the setting is configured, add the gMSA account to the list of accounts that can log on as a service in the Group Policy Management Editor.
105124

106125
> [!NOTE]
107-
> If you use the Group Policy Management Editor to configure the **Log on as a service** setting, make sure you add both **NT Service\All Services** and the gMSA account you created.
126+
> If you use the Group Policy Management Editor to configure the **Log on as a service** setting, make sure to add both **NT Service\All Services** and the gMSA account you created.
127+
128+
## Configure a Directory service account in Microsoft Defender XDR
108129

109-
## Configure a Directory Service account in Microsoft Defender XDR
130+
To connect your sensors with your Active Directory domains, configure Directory service accounts in Microsoft Defender XDR.
110131

111-
To connect your sensors with your Active Directory domains, you'll need to configure Directory Service accounts in Microsoft Defender XDR.
132+
1. In [Microsoft Defender XDR](https://security.microsoft.com/), go to **Settings > Identities**.
112133

113-
1. In [Microsoft Defender XDR](https://security.microsoft.com/), go to **Settings > Identities**. For example:
134+
:::image type="content" source="../media/settings-identities.png" alt-text="Screenshot that shows the settings page and how to access the Defender for Identity page." lightbox="../media/settings-identities.png":::
114135

115-
[![Screenshot of the Identities settings in Microsoft Defender XDR.](../media/settings-identities.png)](../media/settings-identities.png#lightbox)
136+
1. Select **Directory service accounts** to see which accounts are associated with which domains.
116137

117-
1. Select **Directory Service accounts**. You'll see which accounts are associated with which domains. For example:
138+
:::image type="content" source="../media/directory-service-accounts.png" alt-text="Screenshot that shows the Directory service accounts page in the Defender portal." lightbox="../media/directory-service-accounts.png":::
118139

119-
[![Screenshot of the Directory Service accounts page.](../media/directory-service-accounts.png)](../media/directory-service-accounts.png#lightbox)
120140

121-
1. To add Directory Service account credentials, select **Add credentials** and enter the **Account name**, **Domain**, and **Password** of the account you created earlier. You can also choose if it's a **Group managed service account** (gMSA), and if it belongs to a **Single label domain**. For example:
141+
1. Select **Add credentials**
142+
1. Enter the following details:
143+
- **Account name**
144+
- **Domain**
145+
- **Password**
146+
1. You can choose if it's a **Group managed service account** (gMSA), or if it belongs to a **Single label domain**.
122147

123-
[![Screenshot of the add credentials pane.](../media/new-directory-service-account.png)](../media/new-directory-service-account.png#lightbox)
148+
:::image type="content" source="../media/new-directory-service-account.png" alt-text="Screenshot of the added credentials pane." lightbox="../media/new-directory-service-account.png":::
124149

125150
|Field|Comments|
126151
|---|---|
@@ -130,12 +155,15 @@ To connect your sensors with your Active Directory domains, you'll need to confi
130155
|**Domain** (required)|Enter the domain for the read-only user. For example: **contoso.com**. <br><br>It's important that you enter the complete FQDN of the domain where the user is located. For example, if the user's account is in domain corp.contoso.com, you need to enter `corp.contoso.com` not `contoso.com`. <br><br>For more information, see [Microsoft support for Single Label Domains](/troubleshoot/windows-server/networking/single-label-domains-support-policy).|
131156

132157
1. Select **Save**.
133-
1. (Optional) If you select an account, a details pane will open with the settings for that account. For example:
158+
1. (Optional) Select an account to open the details pane and view its settings.
159+
160+
161+
:::image type="content" source="../media/account-settings.png" alt-text="Screenshot of an account details pane." lightbox="../media/account-settings.png":::
134162

135-
[![Screenshot of an account details pane.](../media/account-settings.png)](../media/account-settings.png#lightbox)
136163

137164
> [!NOTE]
138-
> You can use this same procedure to change the password for standard Active Directory user accounts. There is no password set for gMSA accounts.
165+
> You can use the same procedure to change the password for standard Active Directory user accounts.
166+
> gMSA accounts don't require passwords.
139167
140168
## Troubleshooting
141169

defender-for-identity/troubleshooting-known-issues.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ The domain controller doesn't have permissions to retrieve the password of the g
252252

253253
**Resolution 1**:
254254

255-
Validate that the computer running the sensor has been granted permissions to retrieve the password of the gMSA account. For more information, see [Grant permissions to retrieve the gMSA account's password](deploy/create-directory-service-account-gmsa.md#prerequisites-grant-permissions-to-retrieve-the-gmsa-accounts-password).
255+
Validate that the computer running the sensor has been granted permissions to retrieve the password of the gMSA account. For more information, see [Grant permissions to retrieve the gMSA account's password](deploy/create-directory-service-account-gmsa.md#prerequisites).
256256

257257
### Cause 2
258258

0 commit comments

Comments
 (0)