"The function requested is not supported" exception when using SmtpClient in Azure role
So apparently the problem was a mismatched NTLM version between servers.
After logging into the Azure roles and disabling the setting "Require NTLMv2 security" for clients, then it worked:
(Thanks to this answer and this answer for inspiration.)
Currently seeing if we can get our SMTP server upgraded to be NTLMv2-compatible. Otherwise we'll have to set up some automated code to somehow disable that setting on each generated role instance.
Apparently this code worked last month. So I'm guessing a recent Azure OS upgrade changed the default settings.
FYI: The registry key for this setting is
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0] "NtlmMinClientSec"=dword:20000000
To automate setting the registry key add a startup task containing a reg add
command like this:
reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0 ^ /v NtlmMinClientSec ^ /t REG_DWORD ^ /d 0x20000000 ^ /f
where /f
forces the current setting to be overwritten and ^
just allows to break the command into multiple lines for better readability. Also make sure to save the command in ASCII encoding to prevent issues during role startup.