简体   繁体   English

对Azure订阅日志使用证书-禁止使用403

[英]Using a certificate for Azure subscription logs - 403 forbidden

Background: 背景:

I have a Windows Service which polls Azure subscription logs (API: http://msdn.microsoft.com/en-us/library/windowsazure/gg715318.aspx ) 我有一个Windows服务,可轮询Azure订阅日志(API: http : //msdn.microsoft.com/en-us/library/windowsazure/gg715318.aspx

On my local development machine the service is set to log on as my account. 在我的本地开发计算机上,该服务设置为以我的帐户登录。 The X509 certificate was imported under CurrentUser\\Personal and in the source code where I check the cert store I have: X509证书已在CurrentUser \\ Personal下导入,并在我检查证书存储的源代码中导入:

X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);

Issue: 问题:

The service works fine on my dev machine, it can retrieve data from the API. 该服务在我的开发机上运行良好,可以从API检索数据。 On the testing machine I get this error: 在测试机上,我收到此错误:

The remote server returned an error: (403) Forbidden.

The service is set to log on as a specific user, dmz\\aaseclg1 and the current user\\personal cert store has the required certificate. 该服务设置为以特定用户dmz \\ aaseclg1身份登录,并且当前用户\\个人证书存储区具有必需的证书。

Any ideas? 有任何想法吗?

Thanks in advance. 提前致谢。

Edit: image of password prompt: 编辑:密码提示图像:

在此处输入图片说明

I have seen this error when I export the certificate from the machine on which it is created and while exporting, I choose to import it in .cer format (ie without exporting private keys). 从创建证书的计算机中导出证书时,并且在导出时,我选择以.cer格式导入证书(即不导出私钥)时,我已经看到此错误。 Can you try by exporting the certificate from your dev box in pfx format and then copy the file on your test box and import it again in your test box by selecting the file and installing the certificate? 您可以尝试以pfx格式从开发箱中导出证书,然后将文件复制到测试箱中,然后通过选择文件并安装证书将其再次导入测试箱中吗?

UPDATE UPDATE

I was able to reproduce this. 我能够重现这一点。 When you import the certificate, please make sure that you have unchecked the checkbox which reads "Enable strong private key protection" as shown in the screenshot below. 导入证书时,请确保取消选中“启用强私钥保护”复选框,如下面的屏幕截图所示。

在此处输入图片说明

When I check this checkbox, every time I use this certificate it prompts me to enter a password. 选中此复选框时,每次使用此证书时,它都会提示我输入密码。 Now I was using a GUI application so I could see that box. 现在,我正在使用GUI应用程序,因此可以看到该框。 In your case since you are consuming the certificate through a Windows Service (a non UI thingie), this box never shows and you think the service is hanging. 在您的情况下,由于您是通过Windows服务(非UI东西)使用证书的,因此此框永远不会显示,并且您认为服务已挂起。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM