英文:
Namespace "Microsoft.Web/sites/hybridConnectionNamespaces" missing?
问题
我们正在使用Visual Studio Code和Bicep插件。
在定义新的混合连接时,我们想使用父属性。但是我们收到了BCP036错误,期望一个对“Microsoft.Web/sites/hybridConnectionNamespaces”实例的引用。但我们找不到任何关于此资源的文档。有什么建议吗?
英文:
We are using Visual Studio Code and the Bicep plugin.
When we define a new hybrid connection using "Microsoft.Web/sites/hybridConnectionNamespaces/relays@2022-09-01" we want to use the parent property. But we got a BCP036 error expecting a reference to an "Microsoft.Web/sites/hybridConnectionNamespaces" instance. But we cannot find any documentation regarding this resource. Any suggestions?
答案1
得分: 1
这是一个非常好的问题...尝试在 bicep 中执行你描述的操作确实会导致与父级关系出现问题。如果没有可用的类型或者资源提供程序中存在某些过于复杂的内容,那么我的建议是在资源名称中使用 '/' 分隔来设置父级关系。
我拿了一个现有的应用程序并启用了 HybridConnections,然后回到资源组查看了发生了什么变化。(这是我尝试捕获发生了什么的首选方法)。
不幸的是,这不是可以导出 ARM 模板的资源;
接下来的步骤是留在 Azure 门户中,启用浏览器开发工具,切换到网络选项卡,然后添加一个新的 HybridConnection,查看发送出去的 API 调用。通常这是一种了解资源提供程序在文档中未记录情况下发生了什么的好方法。
从这里,我可以看到我在 bicep 资源中需要使用的资源名称表示法,以正确设置父级名称,当我检查有效负载时,可以看到正在发送的属性。
英文:
This is a really good question... Trying to do what you've described in bicep, does indeed cause problems with the parenting. Where there aren't types available or if there's something overly complex in the Resource Provider then falling back to setting the parent lineage seperated with '/' just in the Resource Name would be my advice.
I took an existing app and enabled HybridConnections and then went back to the resource group to see what's changed. (This is my go-to for trying to capture what's going on).
Unfortunately it's not a resource that can have the ARM template exported;
Next step is to stay in the Azure Portal,enable browser developer tools, switch to the network tab and then add a new HybridConnection to see what API calls are being sent out. Often this is a great way to see what's happening with the resource providers when things aren't documented.
From here i can see exactly the Resource Name notation that i'll need to use in my bicep resource in order to set the name parent properly, and when i check the Payload i can see exactly what properties are being sent.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论