Azure Let's Encrypt错误

10
我正在尝试使用 Azure Let's Encrypt 网站插件为其中一个 Azure 网站工作,按照以下说明进行操作:https://gooroo.io/GoorooTHINK/Article/16420/Lets-Encrypt-Azure-Web-Apps-the-Free-and-Easy-Way/20047#.VxUIbKgrKUl,但是在运行时出现授权错误。我不知道从哪里开始解决这个问题,任何帮助都将不胜感激。

错误信息如下:

Microsoft.Rest.Azure.CloudException: The client '{id}' with object id '{same id here??}' does not have authorization to perform action 'Microsoft.Web/sites/read' over scope '/subscriptions/{subscription id}/resourceGroups/Default-Web-NorthEurope/providers/Microsoft.Web/sites/{sitename}'. at Microsoft.Azure.Management.WebSites.SitesOperations.d__29.MoveNext()

更新

这是与原则访问 Web 应用程序的问题。

我决定跟随特洛伊亨特的步骤https://www.troyhunt.com/everything-you-need-to-know-about-loading-a-free-lets-encrypt-certificate-into-an-azure-website/,这非常好-他使用旧的 Azure 门户设置活动目录,我发现这更有用,因为我实际上可以看到正在发生什么。

无论如何,我已经完成了整个过程,直到实际证书请求,现在我收到了返回的 403 服务器错误信息:

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

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Net.WebException: The remote server returned an error: (403) Forbidden.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[WebException: The remote server returned an error: (403) Forbidden.]
   System.Net.HttpWebRequest.GetResponse() +1390
   ACMESharp.AcmeClient.RequestHttpPost(Uri uri, Object message) +642

[AcmeWebException: Unexpected error]
   ACMESharp.AcmeClient.AuthorizeIdentifier(String dnsIdentifier) +435
   LetsEncrypt.SiteExtension.Core.CertificateManager.Authorize(Target target) in c:\Projects\LetsEncrypt-SiteExtension\LetsEncrypt-SiteExtension\LetsEncrypt.SiteExtension.Core\CertificateManager.cs:518
   LetsEncrypt.SiteExtension.Core.CertificateManager.Auto(Target binding) in c:\Projects\LetsEncrypt-SiteExtension\LetsEncrypt-SiteExtension\LetsEncrypt.SiteExtension.Core\CertificateManager.cs:441
   LetsEncrypt.SiteExtension.Core.CertificateManager.RequestAndInstallInternal(Target target) in c:\Projects\LetsEncrypt-SiteExtension\LetsEncrypt-SiteExtension\LetsEncrypt.SiteExtension.Core\CertificateManager.cs:244
   LetsEncrypt.SiteExtension.Controllers.HomeController.Install(RequestAndInstallModel model) +604
   lambda_method(Closure , ControllerBase , Object[] ) +104
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +169
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
   System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +22
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +50
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225
   System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +26
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +100
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +36
   System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +12
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +22
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9644037
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

我还没有解决这个问题。你解决了吗? - Judah Gabriel Himango
1
很遗憾,我在使用Azure时遇到了各种问题,因为我的开发者福利计划订阅和另一个订阅同时运行。我得出的结论是,为了解决这个问题已经花费了超过购买证书的成本,而且我不想每次需要https(现在几乎是任何您想要在谷歌排名的东西)时都遇到这些问题。正如特洛伊在他的帖子中提到的那样,这个过程需要大量自动化。 - Andy Roper
“这是与访问Web应用程序的原则有关的问题。” - 你能否澄清一下?这可能是原始问题的答案,很多人会来到这里寻找答案(包括我)。 - Stuart Dobson
不好意思打广告,我写了一个 WebJob,应该比网站扩展更可靠:https://github.com/ohadschn/letsencrypt-webapp-renewer。 - Ohad Schneider
6个回答

11
在添加应用程序注册信息后,需要将其作为“Contributer”角色分配到资源组中。
如果忘记这一步骤,您将会收到上述错误消息。
在此操作之后,请确保在尝试运行Let's Encrypt扩展之前重新启动应用服务。

1
这应该被设置为答案,至少对我有效。 - Nattfrosten
1
非常感谢。这对我有用,但需要等待一分钟才能完成应用服务的重新启动。 - Jie

5

对我来说,当我的ResourceGroup与我的ServicePlanResourceGroup不同时,就会出现这个问题。

所以如果它们不相等,你需要将你创建的应用注册(你为其创建了秘钥的clientId)添加到ServicePlanResourceGroup中,除了ResourceGroup之外。


2

我遇到了完全相同的异常,并按照以下步骤解决了它

  1. 在Azure门户中导航到订阅
  2. 选择托管App Service的订阅
  3. 选择访问控制(IAM)
  4. 添加一个新实体
  5. 选择角色“Contributor”
  6. 搜索服务主体
  7. 添加用户

这立即解决了访问权限不足的异常

更新:按照步骤(5.注册服务主体),确保您已登录到正确的订阅。在我的情况下,我在错误的订阅中创建了服务主体,因此该主体没有被正确地分配给正在使用的App Service。


1
我遇到了一个新的Azure应用服务相同的问题。结果证明,在运行Let's Encrypt向导之前,我必须实际部署Web应用程序。当默认的Azure应用服务着陆页面是内容为空的站点时,向导无法完成其工作。

我不知道为什么向导无法在默认着陆页上施展魔法。感谢您的信息! - Pablo Quemé

0

这是访问问题。请检查您提到的文章中的第5部分“注册服务主体”。当该部分使用Let's Encrypt页面上的ApplicationId时,是否与您当前使用的ApplicationId相同?秘钥也是如此吗?请检查一下,因为看起来该步骤存在问题。

P.S.我刚刚检查了那个教程,没有出现你提到的错误。


0

我遇到了同样的问题。

我通过在Azure Let's Encrypt网站扩展配置中不指定自定义域名(例如lybecker.com),而是使用完整的lybecker.onmicrosoft.com来解决它。


我看不到在Azure Let's Encrypt网站扩展中输入自定义域名的位置。它在哪里? - Judah Gabriel Himango

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接