从WebJob / WebApp访问注册表

时间:2015-06-11 14:42:17

标签: powershell azure azure-web-sites azure-webjobs

我一直试图在Azure上禁用RC4密码,但没有成功。我遇到了一个使用Web角色的代码示例:

string[] subKeys = new string[]
{
    "RC4 40/128",
    "RC4 56/128",
    "RC4 64/128",
    "RC4 128/128",
};

RegistryKey parentKey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers", true);

foreach(string keyName in subKeys)
{
    var newKey = parentKey.CreateSubKey(keyName);
    newKey.SetValue("Enabled", 0);
    newKey.Close();
}

当我们使用WebApp时,我创建了一个包含上述代码的WebJob。执行时我得到一个安全例外:

System.Security.SecurityException:不允许请求的注册表访问。

有没有办法在提升的执行上下文中运行WebJob?或者使用PowerShell的方法?

我们目前正在接受审核,这被标记为需要注意的事项。

2 个答案:

答案 0 :(得分:1)

使用WebApp无法实现此目的。由于WebApps在多租户环境中运行,因此对注册表的访问受到限制。此页面包含WebApps和WebRoles之间的功能比较。

contextMenus.create

答案 1 :(得分:1)

就像Alex所说,你无法在Azure Web App上自行禁用RC4 Cipher。但是,在几周之内,Azure将禁用所有站点上的各种弱密码套件,因此您将免费获得它。

他们的公告:

https://social.msdn.microsoft.com/Forums/vstudio/en-US/50f1ab33-c22a-4629-951e-b7510f6b2cbe/upgrading-tlsssl-cryptography-for-azure-web-apps?forum=windowsazurewebsitespreview