SQL Server – Azure key vault Error – Msg 15507, Level 16, State 1, Line 6 A key required by this operation appears to be corrupted.

One of our SQL Server which is part of Always On got restarted from Azure side. Once server back online, the Availability group is not coming online. When we look at the SQL error log, we found that an error saying that “Failed to obtain or decrypt for secret for credential < credential name>”

When I tried to re-create credential in TSQL, I was getting another error,

Msg 15507, Level 16, State 1, Line 6

A key required by this operation appears to be corrupted.

 

Solution:

The reason for this error is due to master key got corrupted, the same can be regenerate by the following command.

ALTER SERVICE MASTER KEY FORCE REGENERATE