r/AZURE • u/RaccNexus • 12d ago
Question Azure DevOps Server Patching Error TF246017: Is the SQL 'sysadmin' role strictly required?
/r/azuredevops/comments/1xuactk/azure_devops_server_patching_error_tf246017_is/1
u/mequelkramer 12d ago
Confirming the other answer, and adding a few things that matter specifically in an air-gapped setup. Yes, sysadmin is effectively a hard requirement because tfsconfig.exe touches server level objects, not just the collection and configuration databases. db_owner cannot cover that, which is why the failure shows up partway through rather than at the start.
A pattern that keeps auditors happy: create a dedicated SQL login used only for patching, grant it sysadmin with ALTER SERVER ROLE [sysadmin] ADD MEMBER [that login] for the maintenance window, run the patch under that login, then remove the membership in the same change ticket and keep the SQL audit and login logs as evidence. Do not give sysadmin to the day to day ADOS service account to get around this.
Two air-gapped checks before you start. First, verify the patch media you carried in: check the published hash and signature on a connected machine before you transfer it, so a corrupted or incomplete offline package is not what fails halfway. Second, capture the tfsconfig log and a fresh backup of the config and collection databases, and confirm you have a tested way back, such as restoring those backups to a scratch instance, before you run it. If the patch does fail mid run, that log is what tells you whether it stopped before any schema change or in the middle of one, which decides whether you retry or roll back.
1
u/No-Magazine2625 9d ago
In a regulated environment I would make the elevation itself part of the patch artifact: dedicated patch identity, time bounded privilege, pre and post validation, database backup verification, audit evidence, and an explicit revoke step in the same change record. The technical requirement matters, but making the privilege lifecycle reproducible is what keeps it from becoming a standing exception six months later.
1
u/Invokode 12d ago
Yes, in practice it's a hard requirement. The install/upgrade docs for Azure DevOps Server say the account running configuration or upgrades needs to be in the sysadmin server role on the SQL instance, and a patch counts here because it calls tfsconfig.exe to update the collection and configuration databases (schema changes, feature flags, sometimes new database-level objects). db_owner on each database isn't enough, because some of those steps touch server-level things. That's why you get TF246017 halfway through.
How regulated shops usually handle it:
Temporary, ticketed elevation. Add a dedicated patching account (not someone's daily admin account) to sysadmin for the maintenance window only, apply the patch, then remove it. Record it in the change and keep the SQL audit/login logs as evidence.
Let the DBA run it. Some teams have the DBA, who already holds sysadmin, run the patch from the app tier during the window, so nobody else gets elevated.
Check before you start: confirm you have fresh backups of the config and collection DBs, then check that the service account (the one ADO runs as day to day) keeps only its normal roles. Only the account that runs the upgrade needs sysadmin, not the service account.
Since you're still in dev, it's worth writing this into your patch runbook now, including the step that removes sysadmin afterwards, so it isn't improvised in prod. Also good to test the elevation and revoke flow once on this box before prod, since the air-gapped setup means you'll be doing every patch this way.