Microsoft.DigitalTwins digitalTwinsInstances/endpoints

Bicep resource definition

The digitalTwinsInstances/endpoints resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Usage Examples

Bicep Samples

A basic example of deploying Digital Twins Endpoint.

param resourceName string = 'acctest0001'
param location string = 'westeurope'

resource digitalTwinsInstance 'Microsoft.DigitalTwins/digitalTwinsInstances@2020-12-01' = {
  name: resourceName
  location: location
}

resource namespace 'Microsoft.ServiceBus/namespaces@2022-01-01-preview' = {
  name: resourceName
  location: location
  sku: {
    capacity: 0
    name: 'Standard'
    tier: 'Standard'
  }
  properties: {
    disableLocalAuth: false
    publicNetworkAccess: 'Enabled'
    zoneRedundant: false
  }
}

resource endpoint 'Microsoft.DigitalTwins/digitalTwinsInstances/endpoints@2020-12-01' = {
  name: resourceName
  parent: digitalTwinsInstance
  properties: {
    authenticationType: 'KeyBased'
    deadLetterSecret: ''
    endpointType: 'ServiceBus'
    primaryConnectionString: authorizationRule.listKeys().primaryConnectionString
    secondaryConnectionString: authorizationRule.listKeys().secondaryConnectionString
  }
}

resource topic 'Microsoft.ServiceBus/namespaces/topics@2021-06-01-preview' = {
  name: resourceName
  parent: namespace
  properties: {
    enableBatchedOperations: false
    enableExpress: false
    enablePartitioning: false
    maxSizeInMegabytes: 5120
    requiresDuplicateDetection: false
    status: 'Active'
    supportOrdering: false
  }
}

resource authorizationRule 'Microsoft.ServiceBus/namespaces/topics/authorizationRules@2021-06-01-preview' = {
  name: resourceName
  parent: topic
  properties: {
    rights: [
      'Send'
    ]
  }
}

Resource format

To create a Microsoft.DigitalTwins/digitalTwinsInstances/endpoints resource, add the following Bicep to your template.

resource symbolicname 'Microsoft.DigitalTwins/digitalTwinsInstances/endpoints@2023-01-31' = {
  parent: resourceSymbolicName
  name: 'string'
  properties: {
    authenticationType: 'string'
    deadLetterSecret: 'string'
    deadLetterUri: 'string'
    identity: {
      type: 'string'
      userAssignedIdentity: 'string'
    }
    endpointType: 'string'
    // For remaining properties, see DigitalTwinsEndpointResourceProperties objects
  }
}

DigitalTwinsEndpointResourceProperties objects

Set the endpointType property to specify the type of object.

For EventGrid, use:

{
  accessKey1: 'string'
  accessKey2: 'string'
  endpointType: 'EventGrid'
  TopicEndpoint: 'string'
}

For EventHub, use:

{
  connectionStringPrimaryKey: 'string'
  connectionStringSecondaryKey: 'string'
  endpointType: 'EventHub'
  endpointUri: 'string'
  entityPath: 'string'
}

For ServiceBus, use:

{
  endpointType: 'ServiceBus'
  endpointUri: 'string'
  entityPath: 'string'
  primaryConnectionString: 'string'
  secondaryConnectionString: 'string'
}

Property Values

Microsoft.DigitalTwins/digitalTwinsInstances/endpoints

Name Description Value
name The resource name string

Constraints:
Min length = 2
Max length = 49
Pattern = ^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$ (required)
parent In Bicep, you can specify the parent resource for a child resource. You only need to add this property when the child resource is declared outside of the parent resource.

For more information, see Child resource outside parent resource.
Symbolic name for resource of type: digitalTwinsInstances
properties DigitalTwinsInstance endpoint resource properties. DigitalTwinsEndpointResourceProperties (required)

DigitalTwinsEndpointResourceProperties

Name Description Value
authenticationType Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be specified (at least the primary connection string). If 'IdentityBased' is select, the endpointUri and entityPath properties must be specified. 'IdentityBased'
'KeyBased'
deadLetterSecret Dead letter storage secret for key-based authentication. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter.
deadLetterUri Dead letter storage URL for identity-based authentication. string
endpointType Set to 'EventGrid' for type EventGrid. Set to 'EventHub' for type EventHub. Set to 'ServiceBus' for type ServiceBus. 'EventGrid'
'EventHub'
'ServiceBus' (required)
identity Managed identity properties for the endpoint. ManagedIdentityReference

EventGrid

Name Description Value
accessKey1 EventGrid secondary accesskey. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter. (required)
accessKey2 EventGrid secondary accesskey. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter.
endpointType The type of Digital Twins endpoint 'EventGrid' (required)
TopicEndpoint EventGrid Topic Endpoint. string (required)

EventHub

Name Description Value
connectionStringPrimaryKey PrimaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter.
connectionStringSecondaryKey SecondaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter.
endpointType The type of Digital Twins endpoint 'EventHub' (required)
endpointUri The URL of the EventHub namespace for identity-based authentication. It must include the protocol 'sb://'. string
entityPath The EventHub name in the EventHub namespace for identity-based authentication. string

ManagedIdentityReference

Name Description Value
type The type of managed identity used. 'SystemAssigned'
'UserAssigned'
userAssignedIdentity The user identity ARM resource id if the managed identity type is 'UserAssigned'. string

ServiceBus

Name Description Value
endpointType The type of Digital Twins endpoint 'ServiceBus' (required)
endpointUri The URL of the ServiceBus namespace for identity-based authentication. It must include the protocol 'sb://'. string
entityPath The ServiceBus Topic name for identity-based authentication. string
primaryConnectionString PrimaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter.
secondaryConnectionString SecondaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter.

ARM template resource definition

The digitalTwinsInstances/endpoints resource type can be deployed with operations that target:

Usage Examples

Resource format

To create a Microsoft.DigitalTwins/digitalTwinsInstances/endpoints resource, add the following JSON to your template.

{
  "type": "Microsoft.DigitalTwins/digitalTwinsInstances/endpoints",
  "apiVersion": "2023-01-31",
  "name": "string",
  "properties": {
    "authenticationType": "string",
    "deadLetterSecret": "string",
    "deadLetterUri": "string",
    "identity": {
      "type": "string",
      "userAssignedIdentity": "string"
    },
    "endpointType": "string"
    // For remaining properties, see DigitalTwinsEndpointResourceProperties objects
  }
}

DigitalTwinsEndpointResourceProperties objects

Set the endpointType property to specify the type of object.

For EventGrid, use:

{
  "accessKey1": "string",
  "accessKey2": "string",
  "endpointType": "EventGrid",
  "TopicEndpoint": "string"
}

For EventHub, use:

{
  "connectionStringPrimaryKey": "string",
  "connectionStringSecondaryKey": "string",
  "endpointType": "EventHub",
  "endpointUri": "string",
  "entityPath": "string"
}

For ServiceBus, use:

{
  "endpointType": "ServiceBus",
  "endpointUri": "string",
  "entityPath": "string",
  "primaryConnectionString": "string",
  "secondaryConnectionString": "string"
}

Property Values

Microsoft.DigitalTwins/digitalTwinsInstances/endpoints

Name Description Value
apiVersion The api version '2023-01-31'
name The resource name string

Constraints:
Min length = 2
Max length = 49
Pattern = ^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$ (required)
properties DigitalTwinsInstance endpoint resource properties. DigitalTwinsEndpointResourceProperties (required)
type The resource type 'Microsoft.DigitalTwins/digitalTwinsInstances/endpoints'

DigitalTwinsEndpointResourceProperties

Name Description Value
authenticationType Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be specified (at least the primary connection string). If 'IdentityBased' is select, the endpointUri and entityPath properties must be specified. 'IdentityBased'
'KeyBased'
deadLetterSecret Dead letter storage secret for key-based authentication. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter.
deadLetterUri Dead letter storage URL for identity-based authentication. string
endpointType Set to 'EventGrid' for type EventGrid. Set to 'EventHub' for type EventHub. Set to 'ServiceBus' for type ServiceBus. 'EventGrid'
'EventHub'
'ServiceBus' (required)
identity Managed identity properties for the endpoint. ManagedIdentityReference

EventGrid

Name Description Value
accessKey1 EventGrid secondary accesskey. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter. (required)
accessKey2 EventGrid secondary accesskey. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter.
endpointType The type of Digital Twins endpoint 'EventGrid' (required)
TopicEndpoint EventGrid Topic Endpoint. string (required)

EventHub

Name Description Value
connectionStringPrimaryKey PrimaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter.
connectionStringSecondaryKey SecondaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter.
endpointType The type of Digital Twins endpoint 'EventHub' (required)
endpointUri The URL of the EventHub namespace for identity-based authentication. It must include the protocol 'sb://'. string
entityPath The EventHub name in the EventHub namespace for identity-based authentication. string

ManagedIdentityReference

Name Description Value
type The type of managed identity used. 'SystemAssigned'
'UserAssigned'
userAssignedIdentity The user identity ARM resource id if the managed identity type is 'UserAssigned'. string

ServiceBus

Name Description Value
endpointType The type of Digital Twins endpoint 'ServiceBus' (required)
endpointUri The URL of the ServiceBus namespace for identity-based authentication. It must include the protocol 'sb://'. string
entityPath The ServiceBus Topic name for identity-based authentication. string
primaryConnectionString PrimaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter.
secondaryConnectionString SecondaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter.

Terraform (AzAPI provider) resource definition

The digitalTwinsInstances/endpoints resource type can be deployed with operations that target:

  • Resource groups For a list of changed properties in each API version, see change log.

Usage Examples

Terraform Samples

A basic example of deploying Digital Twins Endpoint.

terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
  }
}

provider "azapi" {
  skip_provider_registration = false
}

variable "resource_name" {
  type    = string
  default = "acctest0001"
}

variable "location" {
  type    = string
  default = "westeurope"
}

resource "azapi_resource" "resourceGroup" {
  type     = "Microsoft.Resources/resourceGroups@2020-06-01"
  name     = var.resource_name
  location = var.location
}

resource "azapi_resource" "namespace" {
  type      = "Microsoft.ServiceBus/namespaces@2022-01-01-preview"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      disableLocalAuth    = false
      publicNetworkAccess = "Enabled"
      zoneRedundant       = false
    }
    sku = {
      capacity = 0
      name     = "Standard"
      tier     = "Standard"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "digitalTwinsInstance" {
  type      = "Microsoft.DigitalTwins/digitalTwinsInstances@2020-12-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "topic" {
  type      = "Microsoft.ServiceBus/namespaces/topics@2021-06-01-preview"
  parent_id = azapi_resource.namespace.id
  name      = var.resource_name
  body = {
    properties = {
      enableBatchedOperations    = false
      enableExpress              = false
      enablePartitioning         = false
      maxSizeInMegabytes         = 5120
      requiresDuplicateDetection = false
      status                     = "Active"
      supportOrdering            = false
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "authorizationRule" {
  type      = "Microsoft.ServiceBus/namespaces/topics/authorizationRules@2021-06-01-preview"
  parent_id = azapi_resource.topic.id
  name      = var.resource_name
  body = {
    properties = {
      rights = [
        "Send",
      ]
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

data "azapi_resource_action" "listKeys" {
  type                   = "Microsoft.ServiceBus/namespaces/topics/authorizationRules@2021-06-01-preview"
  resource_id            = azapi_resource.authorizationRule.id
  action                 = "listKeys"
  response_export_values = ["*"]
}

resource "azapi_resource" "endpoint" {
  type      = "Microsoft.DigitalTwins/digitalTwinsInstances/endpoints@2020-12-01"
  parent_id = azapi_resource.digitalTwinsInstance.id
  name      = var.resource_name
  body = {
    properties = {
      authenticationType        = "KeyBased"
      deadLetterSecret          = ""
      endpointType              = "ServiceBus"
      primaryConnectionString   = data.azapi_resource_action.listKeys.output.primaryConnectionString
      secondaryConnectionString = data.azapi_resource_action.listKeys.output.secondaryConnectionString
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
  lifecycle {
    ignore_changes = [body.properties.primaryConnectionString, body.properties.secondaryConnectionString]
  }
}

Resource format

To create a Microsoft.DigitalTwins/digitalTwinsInstances/endpoints resource, add the following Terraform to your template.

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.DigitalTwins/digitalTwinsInstances/endpoints@2023-01-31"
  name = "string"
  parent_id = "string"
  body = {
    properties = {
      authenticationType = "string"
      deadLetterSecret = "string"
      deadLetterUri = "string"
      identity = {
        type = "string"
        userAssignedIdentity = "string"
      }
      endpointType = "string"
      // For remaining properties, see DigitalTwinsEndpointResourceProperties objects
    }
  }
}

DigitalTwinsEndpointResourceProperties objects

Set the endpointType property to specify the type of object.

For EventGrid, use:

{
  accessKey1 = "string"
  accessKey2 = "string"
  endpointType = "EventGrid"
  TopicEndpoint = "string"
}

For EventHub, use:

{
  connectionStringPrimaryKey = "string"
  connectionStringSecondaryKey = "string"
  endpointType = "EventHub"
  endpointUri = "string"
  entityPath = "string"
}

For ServiceBus, use:

{
  endpointType = "ServiceBus"
  endpointUri = "string"
  entityPath = "string"
  primaryConnectionString = "string"
  secondaryConnectionString = "string"
}

Property Values

Microsoft.DigitalTwins/digitalTwinsInstances/endpoints

Name Description Value
name The resource name string

Constraints:
Min length = 2
Max length = 49
Pattern = ^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$ (required)
parent_id The ID of the resource that is the parent for this resource. ID for resource of type: digitalTwinsInstances
properties DigitalTwinsInstance endpoint resource properties. DigitalTwinsEndpointResourceProperties (required)
type The resource type "Microsoft.DigitalTwins/digitalTwinsInstances/endpoints@2023-01-31"

DigitalTwinsEndpointResourceProperties

Name Description Value
authenticationType Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be specified (at least the primary connection string). If 'IdentityBased' is select, the endpointUri and entityPath properties must be specified. 'IdentityBased'
'KeyBased'
deadLetterSecret Dead letter storage secret for key-based authentication. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter.
deadLetterUri Dead letter storage URL for identity-based authentication. string
endpointType Set to 'EventGrid' for type EventGrid. Set to 'EventHub' for type EventHub. Set to 'ServiceBus' for type ServiceBus. 'EventGrid'
'EventHub'
'ServiceBus' (required)
identity Managed identity properties for the endpoint. ManagedIdentityReference

EventGrid

Name Description Value
accessKey1 EventGrid secondary accesskey. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter. (required)
accessKey2 EventGrid secondary accesskey. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter.
endpointType The type of Digital Twins endpoint 'EventGrid' (required)
TopicEndpoint EventGrid Topic Endpoint. string (required)

EventHub

Name Description Value
connectionStringPrimaryKey PrimaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter.
connectionStringSecondaryKey SecondaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter.
endpointType The type of Digital Twins endpoint 'EventHub' (required)
endpointUri The URL of the EventHub namespace for identity-based authentication. It must include the protocol 'sb://'. string
entityPath The EventHub name in the EventHub namespace for identity-based authentication. string

ManagedIdentityReference

Name Description Value
type The type of managed identity used. 'SystemAssigned'
'UserAssigned'
userAssignedIdentity The user identity ARM resource id if the managed identity type is 'UserAssigned'. string

ServiceBus

Name Description Value
endpointType The type of Digital Twins endpoint 'ServiceBus' (required)
endpointUri The URL of the ServiceBus namespace for identity-based authentication. It must include the protocol 'sb://'. string
entityPath The ServiceBus Topic name for identity-based authentication. string
primaryConnectionString PrimaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter.
secondaryConnectionString SecondaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. string

Constraints:
Sensitive value. Pass in as a secure parameter.