从Flow调用Azure CDN Purge的REST API返回未授权 [英] Calling Azure CDN Purge's REST API from Flow returns Unauthorized

查看:117
本文介绍了从Flow调用Azure CDN Purge的REST API返回未授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从Microsoft Flow清除Azure CDN终结点. CDN配置文件的定价关系为Standard Verzion.

I want to purge an Azure CDN endpoint from Microsoft Flow. The CDN Profile's Pricing Ties is Standard Verzion.

我用HTTP - HTTP操作创建了Microsoft Flow.

I have created a Microsoft Flow with an HTTP - HTTP action.

我使用了由工具生成的URL,该工具通过单击

I used an URL generated by the tool shown by clicking on Try it on https://docs.microsoft.com/en-us/rest/api/cdn/endpoints/purgecontent and filling the necessary fields.

我想清除所有CDN内容,所以我将以下内容作为一个正文(我希望这是正确的方法,因为官方文档对此用例保持沉默).

I want to purge all CDN content so I put the following as a body (I hope this is the right way as the official docs were silent about this use case).

{
  "contentPaths": [
    "/*"      
  ]
}

我在Azure Active Directory中创建了一个Registered application,并用它来填充HTTP - HTTP操作的Active Directory OAuth字段.我以为OAuth身份验证成功了,好像我在任何字段中输入了错误的值一样,都收到了相应的错误消息.

I have created a Registered application in the Azure Active Directory and used that to fill in Active Directory OAuth fields of the HTTP - HTTP action. I presume that the OAuth authentication is succeeding as if I put wrong values in any of the fields I get a respective error message.

因此,如下图所示,填充了HTTP - HTTP动作.该图像主要显示了我在实际流程中使用的值.

So the HTTP - HTTP action is filled as on the following image. The image mostly shows where I got the values I used on the real flow.

当我运行流时,它失败,并且在失败的HTTP - HTTP操作中仅显示Unauthorized..

When I run the flow it fails and shows just Unauthorized. inside the failed HTTP - HTTP action.

我尝试将应用程序添加为CDN ProfileContributor角色,但错误保持不变.

I have tried to add the app as a Contributor role of the CDN Profile but the error stayed the same.

如何使其正常工作?

推荐答案

根据错误消息,您似乎错过了请求中的访问令牌.

According to the error message, it seems that you missed the access token in the request.

如果要为您的Azure广告应用程序(服务主体)生成令牌,可以参考此通过邮递员生成访问令牌的线程.

If you want to generate the token for your azure ad app(service principal), you could refer to this article and the thread of generating the access token via postman.

此外,您可以尝试将应用添加为逻辑应用中的角色.

Also, you could try to add the app as a role in the logic app.

这篇关于从Flow调用Azure CDN Purge的REST API返回未授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆