通过 ARM 模板将现有混合连接链接到 azure web 应用程序 [英] Link existing hybrid connection to an azure web app through ARM-template

查看:35
本文介绍了通过 ARM 模板将现有混合连接链接到 azure web 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 azure 中有一个资源组,其中包含一个包含混合连接的中继.我正在尝试部署另一个包含 Web 应用程序的资源组,该应用程序应该链接另一个资源组中的现有混合连接.

I have a resource group in azure which contains a Relay which contains a hybrid connection. I'm trying to deploy another resourcegroup containing a web app which should link the existing hybrid connection in the other resourcegroup.

在 azure 门户中执行此任务很简单,但由于我想在 ARM 模板部署期间运行完整模式",因此我需要在部署期间执行此操作.

Performing this task in the azure portal is trivial but since I want to run "complete mode" during my ARM-template deploy I need to do this during deployment.

我找不到任何好的文档,而且很多答案似乎已经过时.这可能吗,如果可能,如何实现?

I cannot find any good documentation for this and lots of answers seems outdated. Is this possible, and if then, how can it be accomplished?

推荐答案

您可以使用此代码在 Relay 上创建混合连接:

You can use this code to create hybrid connection on Relay:

{
  "name": "[concat(relayName, '/', hybridConnectionName]",
  "type": "Microsoft.Relay/namespaces/hybridConnections",
  "apiVersion": "2017-04-01",      
  "dependsOn": [
    "relayName"
  ],
  "properties": {
    "requiresClientAuthorization": true,
    "userMetadata": [
       {
          "key": "endpoint",
          "value": "google.com:443"
       }
    ]
  },
  "resources": []
}

然后将其连接到网络应用程序:

And then connect it to the web app:

"variables": { 
   "hybridConnectionResourceId": "[resourceId(relayResourceGroup, 'Microsoft.Relay/Namespaces/Hybridconnections', relayName, hybridConnectionName)]"
},
{
  "name": "[concat(webAppName, '/', relayName, '/', hybridConnectionName)]",
  "type": "Microsoft.Web/sites/hybridConnectionNamespaces/relays",
  "apiVersion": "2018-02-01",
  "dependsOn": [
    "webAppName"
  ],
  "location": "[resourceGroup().location]",
  "properties": {
    "serviceBusNamespace": "relayName",
    "relayName": "hybridConnectionName",
    "relayArmUri": "[variables('hybridConnectionResourceId')]",
    "hostName": "[split(json(reference(variables('hybridConnectionResourceId'), '2017-04-01').userMetadata)[0].value, ':')[0]]",
    "port": "[split(json(reference(variables('hybridConnectionResourceId'), '2017-04-01').userMetadata)[0].value, ':')[1]]",
    "sendKeyName": "defaultSender",
    "sendKeyValue": "[listkeys(concat(variables('hybridConnectionResourceId'), '/authorizationRules/defaultSender'), '2017-04-01').primaryKey]"
  }
}

希望这会有所帮助.

这篇关于通过 ARM 模板将现有混合连接链接到 azure web 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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