DNS Error 9017 Bad Key: What It Means and How to Fix It
In this article
Error 9017, "DNS bad key," means the DNS server rejected a key used to sign or authenticate a DNS operation — usually a mismatched TSIG key on a zone transfer or a stale DNSSEC key. Reload the zone with the correct key and re-sync keys between servers to clear it.
Time 30 min · Steps 6 · Level Advanced
Fixing DNS Error 9017 in Six Steps
- Read the full log entry. Note which zone, which server, and which operation (zone transfer, dynamic update, or DNSSEC signing) was in progress when 9017 appeared; the fix depends on that context.
- Compare the TSIG keys on both servers. Open the key configuration on the primary and secondary and confirm the shared secret, algorithm, and key name match character for character.
- Regenerate and redistribute the key if it differs. Create a new key, copy the identical secret to every server that uses it, and restart the DNS service on each one.
- Check DNSSEC key rollover state. If the zone is signed, confirm the current key is published and the old key is only removed after its signatures have expired.
- Reload the affected zone. Reload the zone from its stored file rather than restarting the whole service, so other zones keep serving queries.
- Watch the logs for one full transfer cycle. A clean zone transfer after the key change confirms the fix; a repeat of 9017 points to a third server still holding the old key.
What Error 9017 Actually Means
Windows DNS defines error 9017 as "the specified key is not valid." It is not a client-side problem — a browser or phone almost never produces this code on its own. It shows up in server logs when one DNS server tries to prove its identity to another using a cryptographic key, and the receiving server does not accept that key. The two operations that rely on those keys are TSIG-authenticated zone transfers (secondary servers pulling zone data from a primary) and DNSSEC signing, where keys sign the zone's records. So when you see 9017, the real question is which of those two broke, and the log entry usually tells you.
TSIG Key Mismatch: The Most Common Cause
A TSIG (transaction signature) key is a shared secret that a primary and secondary DNS server both hold, so the secondary can prove transfers come from the real primary. Error 9017 fires when the secrets differ — typically because someone changed the key on one server and forgot the other, or a trailing character or whitespace crept in when the key was pasted.
How to confirm it
Trigger a manual zone transfer on the secondary and check its log. If 9017 appears at the moment the transfer request is authenticated, and the same entry names the TSIG key, the key is the problem. Compare the key on both servers byte for byte — a single wrong character is enough. Paste the key into a plain text editor first; word processors and terminals can add invisible characters.
How to fix it
Generate one fresh key, then place the identical secret, key name, and algorithm (HMAC-SHA256 is a common choice) on every server involved. Restart the DNS service on each server after the change so the new key is loaded, then run a manual transfer to verify. Menu and dialog names differ slightly between DNS server versions, so follow your server's own documentation for the exact screens.
Stale or Broken DNSSEC Keys
When a signed zone rolls its keys, the new key must be published in the zone before it is used, and the old key must stay until signatures made with it have expired. If a server tries to sign or validate with a key the other side does not yet know about — or has already removed — you get a bad-key failure.
How to confirm it
Look for 9017 alongside other DNSSEC events in the log, and check whether the error started right after a key rollover or a zone re-signing. Query the zone's DNSKEY records and confirm the key that appears in the error is actually present in the published set.
How to fix it
Re-import or re-publish the current key set so all servers agree, and let the rollover timing complete rather than forcing it — signatures from the old key need their full validity period to expire before the key is retired. If the zone's signing state is corrupted, re-sign the zone from scratch with the current key. This is the one cause where patience is part of the fix: removing a key too early is what caused the mismatch in the first place.
Corrupted Zone Data or a Half-Finished Configuration Change
A partially applied configuration change — a key edited on one server but not its partner, or a zone file saved mid-edit — can leave the server holding a key that no longer matches anything. This often follows a rushed change or an interrupted deployment.
How to confirm it
Check whether the error began immediately after a configuration change, and look for other errors in the log around the same timestamp. Compare the zone's stored file against what the server is serving; a mismatch means the zone needs reloading from disk.
How to fix it
Reload the zone from its stored file rather than restarting the whole service — other zones keep answering queries that way. If the stored file itself is damaged, restore it from your last good backup, then reapply the key change cleanly on both servers before restarting the service.
Could Error 9017 Be Coming From Your Client Instead?
Almost never, but a few apps and VPN clients surface DNS error codes that look similar. If you saw "9017" in a desktop or mobile app rather than a server log, the number is usually that app's own error code, not the Windows DNS error, and it means something different — often a connection or authentication failure inside the app. Check the app's own documentation for its error list before assuming it is a DNS key problem. The giveaway is location: a genuine 9017 appears in DNS server logs, not in a client app's error dialog.
Keeping DNS Keys From Drifting Again
Most 9017 errors trace back to keys that were changed on one server and not the others, so the prevention is procedural. Keep a single master copy of every TSIG key and its key name in your configuration records, and change it on all servers in one maintenance window. When you do roll a key, add the new one everywhere first, verify a transfer succeeds, and only then remove the old one. For DNSSEC, follow your server's rollover schedule rather than skipping steps — the timing exists so every server and resolver sees the new key before the old one disappears. Finally, review the DNS logs after any planned change; a 9017 that appears within minutes of an edit is far easier to trace than one discovered days later.
Official source: Microsoft Support