如何从ARM模板创建具有事件网格订阅的Logic App [英] How do I create Logic App with Event Grid subscription from ARM-template

查看:58
本文介绍了如何从ARM模板创建具有事件网格订阅的Logic App的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经制作了一个可以监听事件网格主题的Logic应用程序,它可以正常工作,但是如果我删除它并尝试从模板中创建它,将无法正常工作.它永远不会运行.

I have made a Logic app that listens to an Event Grid Topic and it works fine, but if I delete it and try to create from the template it doesn't work. It never runs.

问题在于,尽管它确实创建了与事件网格的API连接,但未授权它,并且也未创建对事件网格主题的任何预订.任何时候都不会显示任何错误.一切都成功了,但并没有创造出应有的一切.

The problem is that while it does create the API connection to the event grid, it leaves it unauthorized and it doesn't create any subscription to the event grid topic either. At no point are any errors displayed. Everything succeeds, but it just doesn't create everything it is supposed to.

要解决此问题,我向Powershell脚本添加了命令以对其进行身份验证.这可以正常工作,但是这当然不会创建订阅.

To get around this, I added commands to the Powershell script to authenticate it. This works fine, but this of course does not create the subscription.

如果我再次运行ARM模板,我希望它现在可以创建它,因为连接无效,但是无效.我想Azure意识到模板中没有任何变化,什么也没有做?如果我编辑ARM模板并更改订阅名称,然后再次部署它,那么将创建该订阅并开始工作.

If I run the ARM-template again, I expected it to create it now as connection is not valid, but no, it doesn't. I suppose Azure realizes nothing has changed in the template and does nothing? If I edit the ARM-template and change the subscription name, and deploy it again, then the subscription is created and it starts working.

我当然可以使用2个不同的订阅名称作为参数两次调用模板,但这听起来很愚蠢.必须有更好的方法.

I could of course call the template twice with 2 different subscription names as parameter but that sounds silly. There has to be some better way.

那么从模板和脚本创建这种逻辑应用程序的最佳方法是什么?

So what would be the best way to create that kind of logic app from templates and scripts?

推荐答案

我认为,第一次部署后,无法解决所需的授权问题.因此,最简单的解决方案是拥有2个单独的模板-一个用于API连接,另一个用于Logic App.

I believe there isn't a way to workaround the authorization required after the first time you deploy. So the simplest solution would be to have 2 separate templates - one for the API connection and the other for the Logic App.

您的PowerShell脚本将首先部署API连接,对其进行授权,然后再部署Logic App.

Your PowerShell script would deploy the API Connection first, authorize it and then deploy the Logic App.

您也可以将它们放在同一模板中,并通过使用

You could also have them in the same template too and control which is deployed by using a condition on each resource.

这篇关于如何从ARM模板创建具有事件网格订阅的Logic App的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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