简体   繁体   English

Azure 逻辑应用 HTTP 操作授权失败

[英]Azure Logic App HTTP action authorization fails

So I'm trying to set some custom meta-data for Blobs inside a Logic App.所以我正在尝试为逻辑应用程序中的 Blob 设置一些自定义元数据。 Unfortunately there's currently no Action which is capable of setting custom data on blobs.不幸的是,目前没有能够在 blob 上设置自定义数据的 Action。

So as a workaround I try to set the meta-data by using the REST API and configured the following Action (SharedKey is in Format StorageAccountName:AccessKey1):因此,作为一种解决方法,我尝试使用 REST API 设置元数据并配置以下操作(SharedKey 的格式为 StorageAccountName:AccessKey1):

配置 HTTP Action 以设置元数据

So for the x-ms-date header I use the expression utcNow() but that doesn't seem to do the job as I get the following error message:因此,对于 x-ms-date 标头,我使用表达式 utcNow() 但这似乎不起作用,因为我收到以下错误消息:

"x-ms-date": "2018-09-04T14:20:01.1767834Z" "x-ms-date": "2018-09-04T14:20:01.1767834Z"

AuthenticationFailed Server failed to authenticate the request. AuthenticationFailed服务器未能验证请求。 Make sure the value of Authorization header is formed correctly including the signature.确保 Authorization 标头的值形成正确,包括签名。 RequestId:0c5c817f-101e-00b5-7c5a-44ca3c000000 Time:2018-09-04T14:20:01.2206329ZThe Date header in the request is incorrect. RequestId:0c5c817f-101e-00b5-7c5a-44ca3c000000 Time:2018-09-04T14:20:01.2206329Z请求中的Date头不正确。

Strangely enough, besides the x-ms-date Header also the Date header already seems to be included automatically in the correct format:奇怪的是,除了 x-ms-date 标头之外,Date 标头似乎已经以正确的格式自动包含在内:

完成动作的输出

So does anybody see an error here (wrong utc-date Expression for example)?那么有人在这里看到错误吗(例如错误的 utc-date 表达式)? Maybe it's not even the wrong x-ms-date header and I'm on the wrong track..也许它甚至不是错误的 x-ms-date 标头,而且我走错了路..

Issue could be related to the format of the final value that Authorization header is getting.问题可能与 Authorization 标头获得的最终值的格式有关。

Take a look at this post on MSDN forums看看MSDN 论坛上的这篇文章

I had a silimar issue and figured out how to Authenticate.我有一个 silimar 问题,并想出了如何进行身份验证。 Maybe you can use it for your solution:也许您可以将它用于您的解决方案:

Here is what worked for me:这是对我有用的:

  1. Enabled "Managed Identity" on the Logic App.在逻辑应用程序上启用“托管身份”。

  2. Added Storage-Queue-Contributor permissions on the storage queue.在存储队列上添加了 Storage-Queue-Contributor 权限。

  3. Used utcnow('R') to get this date format ("Tue, 08 Sep 2020 12:03:08 GMT") for x-ms-date HTTP header (no doc from MS about this).使用utcnow('R')x-ms-date HTTP 标头获取此日期格式(“Tue, 08 Sep 2020 12:03:08 GMT”)(MS 没有关于此的文档)。

  4. Inserted JSON data inside在里面插入 JSON 数据

    <QueueMessage> <MessageText> { "car": "Audi", "year": 1983 } </MessageText> </QueueMessage>

Final result in Logic App designer: Logic App 设计器中的最终结果: 在此处输入图片说明

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

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