Azure Messaging Hybrid Connection

This page shows how to write Terraform and Azure Resource Manager for Messaging Hybrid Connection and write them securely.

azurerm_relay_hybrid_connection (Terraform)

The Hybrid Connection in Messaging can be configured in Terraform with the resource name azurerm_relay_hybrid_connection. The following sections describe 3 examples of how to use the resource and its parameters.

Example Usage from GitHub

relays.tf#L2
resource "azurerm_relay_hybrid_connection" "hc" {
  name = "name"
  resource_group_name = "resource_group"
  relay_namespace_name = azurerm_relay_namespace.example.name
  user_metadata = "metadata"
}
main.tf#L7
resource "azurerm_relay_hybrid_connection" "this" {
  name                          = var.name
  relay_namespace_name          = var.relay_namespace_name
  requires_client_authorization = var.requires_client_authorization
  resource_group_name           = var.resource_group_name
  user_metadata                 = var.user_metadata
main.tf#L7
resource "azurerm_relay_hybrid_connection" "this" {
  name                          = var.name
  relay_namespace_name          = var.relay_namespace_name
  requires_client_authorization = var.requires_client_authorization
  resource_group_name           = var.resource_group_name
  user_metadata                 = var.user_metadata

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages an Azure Relay Hybrid Connection.

Microsoft.Relay/namespaces/hybridConnections (Azure Resource Manager)

The namespaces/hybridConnections in Microsoft.Relay can be configured in Azure Resource Manager with the resource name Microsoft.Relay/namespaces/hybridConnections. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

test-resource-template.json#L37
            "type": "Microsoft.Relay/namespaces/hybridConnections",
            "name": "[concat(parameters('relay_namespace'), '/a1')]",
            "apiVersion": "[variables('apiVersion')]",
            "properties": {
                "requiresClientAuthorization": true
            },
azuredeploy.json
{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "AppServiceName": {
create-hc.json
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "connectionName": {
HcExampleTemplate.json
{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "resource_prefix": {
Microsoft.Relay.tests.json#L85
        "type": "Microsoft.Relay/namespaces/hybridConnections",
        "apiVersion": "2017-04-01",
        "name": "hybridConnectiontiontest",
        "properties": {
          "requiresClientAuthorization": true,
          "userMetadata": "usermetadata is a placeholder to store user-defined string data for the HybridConnection endpoint.e.g. it can be used to store  descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored."
hybridconnections.json#L3
  "type": "Microsoft.Relay/namespaces/hybridConnections",
  "apiVersion": "2017-04-01",
  "properties": {
    "requiresClientAuthorization": "boolean",
    "userMetadata": "string"
  },
Microsoft.Relay.tests.json#L119
        "type": "Microsoft.Relay/namespaces/hybridConnections",
        "apiVersion": "2017-04-01",
        "name": "hybridConnectiontiontest",
        "properties": {
          "requiresClientAuthorization": true,
          "userMetadata": "usermetadata is a placeholder to store user-defined string data for the HybridConnection endpoint.e.g. it can be used to store  descriptive data, such as list of teams and their contact information also user-defined configuration settings can be stored."
template.json
{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "namespaces_HybridConnectorNameSpace_name": {
hybrid-connection.json#L30
        "type": "Microsoft.Relay/namespaces/hybridConnections",
        "name": "[concat(parameters('serviceBusName'), '/', parameters('hybridConnectionName'))]",
        "properties": {
            "requiresClientAuthorization": true,
            "userMetadata": "[concat('[{\"key\":\"endpoint\",\"value\":\"', parameters('listenerHostname'), ':', parameters('listenerHostPort'), '\"}]')]"
        }
hybrid-connections.json#L24
        "type": "Microsoft.Relay/namespaces/hybridConnections",
        "name": "[concat(parameters('serviceBusName'), '/', parameters('hybridConnectionEndpoints')[copyIndex()].name)]",
        "copy": {
            "name": "hybridConnectionEndpoints",
            "count": "[length(parameters('hybridConnectionEndpoints'))]"
          },

Parameters

  • apiVersion required - string
  • name required - string

    The hybrid connection name.

  • properties required
      • requiresClientAuthorization optional - boolean

        Returns true if client authorization is needed for this hybrid connection; otherwise, false.

      • userMetadata optional - string

        The usermetadata is a placeholder to store user-defined string data for the hybrid connection endpoint. For example, it can be used to store descriptive data, such as a list of teams and their contact information. Also, user-defined configuration settings can be stored.

  • type required - string

Frequently asked questions

What is Azure Messaging Hybrid Connection?

Azure Messaging Hybrid Connection is a resource for Messaging of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure Messaging Hybrid Connection?

For Terraform, the dmaxim/wimc-net, kevinhead/azurerm and niveklabs/azurerm source code examples are useful. See the Terraform Example section for further details.

For Azure Resource Manager, the Azure/azure-relay-bridge, Lagler-Gruener/AzureTemplates and caseywatson/AutomatedHcmSetup source code examples are useful. See the Azure Resource Manager Example section for further details.