I think now you need to use sp_xp_cmdshell_proxy_account to let SQL Server know the proxy credential to use for xp_cmdshell
. For example, try running
EXEC sp_xp_cmdshell_proxy_account
'UserNameForB',
'PasswordForB';
And then see if it xp_cmdshell works when EXECUTE AS LOGIN = 'B'