I wanted a workstation admin group that can rename PCs without anyone touching Domain Admin. The group should be local admin on every computer in the Workstations OU, able to rename those computers in AD, and have no rights anywhere else. It took two permission fixes and one missing Entra device to get there.

Domain Admin is the wrong tool for a rename

Domain Admin is Tier 0, the control plane for the whole domain. Microsoft’s tier model says to keep Tier 0 as small as possible, and gives fewer than five people with Domain Admin-level access as a common target [1]. Every time a Tier 0 account signs in to a workstation, it leaves credentials on a machine that is far easier to compromise than a domain controller. The Enterprise Access Model’s answer is to enforce the hierarchy, so lower planes can’t take control of higher ones [2].

Renaming PCs is routine help desk work. If Domain Admin is the only account that can do it, the help desk either gets Domain Admin, or every rename turns into a ticket for the identity team. Delegating the exact rights avoids both. It also lines up with Microsoft cloud security benchmark control PA-1, “Separate and limit highly privileged/administrative users”, which maps to CIS Controls 5.4 and NIST SP 800-53 AC-6 [3]. That’s the kind of mapping auditors ask for.

Making the group local admin

I started with a Workstation-Admins group and a workstation admin account, both in the Tier 2 OU. A GPO linked to the Workstations OU adds the group to the local Administrators group on every computer there. It uses Group Policy Preferences, Local Users and Groups, with the Update action.

To check it on a workstation:

gpupdate /force
net localgroup administrators

Signed in as the workstation admin, in a normal non-elevated window:

whoami /groups | findstr /i "Workstation-Admins Administrators"

BUILTIN\Administrators shows as “Group used for deny only”. That’s the UAC split token. The admin rights are there, but they stay off until you choose Run as administrator.

Being local admin still doesn’t let you rename the PC. Before delegating anything, I ran the rename as the workstation admin to make sure it failed:

Rename-Computer -NewName <new-computer-name> -DomainCredential <DOMAIN>\<workstation-admin-account>

It came back with access denied. A rename changes the computer object in AD, and local admin on a PC gives you no rights in Active Directory. Testing the failure first also matters: if the rename had worked at this point, the account would have had rights I didn’t know about.

The rights AD actually needs

Microsoft lists three permissions for renaming a computer account: write description, write display name, and write sAMAccountName [4]. A rename also rewrites the DNS host name and SPNs, which need the two validated writes from the same page [4].

I granted those with the Delegation of Control wizard in Active Directory Users and Computers: a custom task, Computer objects only, and no create or delete rights. (Group Policy Management has a Delegation tab too, but that one only covers GPO permissions, like who can link a GPO.)

The rename still failed with access denied. C:\Windows\debug\netsetup.log showed where:

Get-Content C:\Windows\debug\netsetup.log -Tail 40
NetpManageMachineAccountWithSid: status of NetUserSetInfo on '\\<domain-controller>' for '<old-computer-name>$': 0x5

NetUserSetInfo is the step that renames the account itself, from <old-computer-name>$ to <new-computer-name>$. Windows does it through SAMR, not LDAP. It got past that step once I added Write account restrictions, which is on Microsoft’s domain join list but not the rename list [4]. I added it through the OU’s Security > Advanced settings, applied to descendant computer objects. Write display name, on the other hand, turned out not to be needed.

That grant should stay on the Workstations OU and nowhere else. The account restrictions property set includes msDS-AllowedToActOnBehalfOfOtherIdentity [5], the attribute behind resource-based constrained delegation (RBCD) attacks. On workstations where the group is already local admin, that adds nothing. On servers or Tier 0, it would be a real escalation path.

The final set, on the Workstations OU, for descendant computer objects only:

Right Why
Read all properties Read the object
Write sAMAccountName The new account name
Write description On Microsoft’s rename list
Write account restrictions The SAMR account rename step
Validated write to DNS host name dNSHostName
Validated write to service principal name HOST/ and RestrictedKrbHost/ SPNs

To see what the group actually has:

dsacls "OU=Workstations,OU=Corp,DC=<domain>,DC=<tld>" | findstr /i "Workstation-Admins"

Hybrid-joined PCs need one more check

With the AD rights in place, the rename failed again, this time with a different error:

Unable to update hostname in Azure AD.

On a hybrid-joined PC, Windows also updates the device in Entra ID, and if that fails it rolls back the whole rename. netsetup.log showed the AD side succeeding, then DsrDeviceHostNameUpdate returned 0x801c03f3 and “Rolled back the machine name successfully”. That code isn’t in Microsoft’s error tables. The User Device Registration log (event 252) had the real reason: HTTP 404, error_missing_device.

dsregcmd confirmed it [6]:

dsregcmd /status | findstr /i "AzureAdJoined DomainJoined DeviceAuthStatus"
DeviceAuthStatus : FAILED. Device is either disabled or deleted

The PC believed it was hybrid joined, but Entra had no record of it. Sentinel already had the Entra audit logs, so finding out what happened took one query:

AuditLogs
| where TimeGenerated > ago(90d)
| where OperationName has "device"
| where tostring(TargetResources) has "<device-id>"
    or tostring(TargetResources) has "<computer-name>"
| project TimeGenerated, OperationName, Result, InitiatedBy = tostring(InitiatedBy)
| order by TimeGenerated desc

The Delete device event was initiated by Microsoft.Azure.SyncFabric, the Cloud Sync service. Cloud Sync doesn’t recreate a device it deleted unless the AD object changes. Microsoft gives three ways back: restore it from Entra ID > Devices > Deleted devices, change the AD object, or run provision on demand [7]. I restored it, DeviceAuthStatus went back to SUCCESS, and the rename went through:

Rename-Computer -NewName <new-computer-name> -DomainCredential <DOMAIN>\<workstation-admin-account>
Restart-Computer
Get-ADComputer <new-computer-name> | Select-Object Name,SamAccountName,DistinguishedName

One more trap. In the Cloud Sync blade, my Security Administrator account showed the configuration as “Error: Invalid configuration”. An account with Hybrid Identity Administrator, the role Microsoft lists for managing Cloud Sync [7], showed it as Healthy. Check which account you’re using before you trust that status.

References

  1. Tier model for Active Directory Domain Services
  2. Enterprise access model
  3. Microsoft cloud security benchmark: Privileged access
  4. Active Directory domain join permissions
  5. User-Account-Restrictions property set
  6. Troubleshoot devices by using the dsregcmd command
  7. Configure device sync with Microsoft Entra Cloud Sync

Comment section

Sorry babes, you have to sign into Github to comment. Feel free to let me know what's on your mind!