问题描述
最近使用Windows Azure Management Libraries (Nuget:https://www.nuget.org/packages/Microsoft.WindowsAzure.Management.Libraries)管理Mooncake 里的Azure Service, 发现一直出现以下错误:
ForbiddenError: The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription.
解决方案
在网上找了寻求帮助时,发现有很多朋友碰到同样的问题,解决方法各异,但是在我的机器上都不奏效。今天早晨终于一番尝试,成功地解决问题,记录如下:
ForbiddenError 显然是认证问题,我尝试过两种认证方式:
- AAD。 参考 https://msdn.microsoft.com/en-us/library/azure/dn722415.aspx
- 使用 Azure Management Certificate。 (稍后详述)
通过Fiddler 抓包发现,尽管以上两种方法都是抛出 ForbiddenError, 但是