Event Sources - Create Or Update

Create or update an event source under the specified environment.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TimeSeriesInsights/environments/{environmentName}/eventSources/{eventSourceName}?api-version=2020-05-15

URI Parameters

Name In Required Type Description
environmentName
path True

string

The name of the Time Series Insights environment associated with the specified resource group.

eventSourceName
path True

string

Name of the event source.

Regex pattern: ^[-\w\._\(\)]+$

resourceGroupName
path True

string

Name of an Azure Resource group.

subscriptionId
path True

string

Azure Subscription ID.

api-version
query True

string

Version of the API to be used with the client request.

Request Body

The request body can be one of the following:

Name Description
EventHubEventSourceCreateOrUpdateParameters

Parameters supplied to the Create or Update Event Source operation for an EventHub event source.

IoTHubEventSourceCreateOrUpdateParameters

Parameters supplied to the Create or Update Event Source operation for an IoTHub event source.

EventHubEventSourceCreateOrUpdateParameters

Parameters supplied to the Create or Update Event Source operation for an EventHub event source.

Name Required Type Description
eventSourceResourceId True

string

The resource id of the event source in Azure Resource Manager.

kind True string:

Microsoft.EventHub

The kind of the event source.

location True

string

The location of the resource.

properties.consumerGroupName True

string

The name of the event hub's consumer group that holds the partitions from which events will be read.

properties.eventHubName True

string

The name of the event hub.

properties.keyName True

string

The name of the SAS key that grants the Time Series Insights service access to the event hub. The shared access policies for this key must grant 'Listen' permissions to the event hub.

properties.serviceBusNamespace True

string

The name of the service bus that contains the event hub.

properties.sharedAccessKey True

string

The value of the shared access key that grants the Time Series Insights service read access to the event hub. This property is not shown in event source responses.

ingressStartAt.time

string

ISO8601 UTC datetime with seconds precision (milliseconds are optional), specifying the date and time that will be the starting point for Events to be consumed.

ingressStartAt.type

IngressStartAtType

The type of the ingressStartAt, It can be "EarliestAvailable", "EventSourceCreationTime", "CustomEnqueuedTime".

localTimestamp

LocalTimestamp

An object that represents the local timestamp property. It contains the format of local timestamp that needs to be used and the corresponding timezone offset information. If a value isn't specified for localTimestamp, or if null, then the local timestamp will not be ingressed with the events.

tags

object

Key-value pairs of additional properties for the resource.

timestampPropertyName

string

The event property that will be used as the event source's timestamp. If a value isn't specified for timestampPropertyName, or if null or empty-string is specified, the event creation time will be used.

IoTHubEventSourceCreateOrUpdateParameters

Parameters supplied to the Create or Update Event Source operation for an IoTHub event source.

Name Required Type Description
eventSourceResourceId True

string

The resource id of the event source in Azure Resource Manager.

kind True string:

Microsoft.IoTHub

The kind of the event source.

location True

string

The location of the resource.

properties.consumerGroupName True

string

The name of the iot hub's consumer group that holds the partitions from which events will be read.

properties.iotHubName True

string

The name of the iot hub.

properties.keyName True

string

The name of the Shared Access Policy key that grants the Time Series Insights service access to the iot hub. This shared access policy key must grant 'service connect' permissions to the iot hub.

properties.sharedAccessKey True

string

The value of the Shared Access Policy key that grants the Time Series Insights service read access to the iot hub. This property is not shown in event source responses.

ingressStartAt.time

string

ISO8601 UTC datetime with seconds precision (milliseconds are optional), specifying the date and time that will be the starting point for Events to be consumed.

ingressStartAt.type

IngressStartAtType

The type of the ingressStartAt, It can be "EarliestAvailable", "EventSourceCreationTime", "CustomEnqueuedTime".

localTimestamp

LocalTimestamp

An object that represents the local timestamp property. It contains the format of local timestamp that needs to be used and the corresponding timezone offset information. If a value isn't specified for localTimestamp, or if null, then the local timestamp will not be ingressed with the events.

tags

object

Key-value pairs of additional properties for the resource.

timestampPropertyName

string

The event property that will be used as the event source's timestamp. If a value isn't specified for timestampPropertyName, or if null or empty-string is specified, the event creation time will be used.

Responses

Name Type Description
200 OK EventSourceResource:

The existing event source definition was successfully updated.

201 Created EventSourceResource:

The event source was successfully created.

Other Status Codes

CloudError

HTTP 400 (Bad Request): The given event source request body is invalid; See the error code and message in the response for details.

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

CreateEventHubEventSource
EventSourcesCreateEventHubWithCustomEnquedTime

CreateEventHubEventSource

Sample Request

PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.TimeSeriesInsights/environments/env1/eventSources/es1?api-version=2020-05-15

{
  "location": "West US",
  "kind": "Microsoft.EventHub",
  "properties": {
    "eventSourceResourceId": "somePathInArm",
    "serviceBusNamespace": "sbn",
    "consumerGroupName": "cgn",
    "eventHubName": "ehn",
    "keyName": "managementKey",
    "sharedAccessKey": "someSecretvalue",
    "timestampPropertyName": "someTimestampProperty",
    "localTimestamp": {
      "format": "TimeSpan",
      "timeZoneOffset": {
        "propertyName": "someEventPropertyName"
      }
    },
    "ingressStartAt": {
      "type": "EarliestAvailable"
    }
  }
}

Sample Response

{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.TimeSeriesInsights/Environments/env1/eventSources/es1",
  "location": "West US",
  "name": "es1",
  "type": "Microsoft.TimeSeriesInsights/Environments/EventSources",
  "tags": {},
  "kind": "Microsoft.EventHub",
  "properties": {
    "eventSourceResourceId": "somePathInArm",
    "serviceBusNamespace": "sbn",
    "consumerGroupName": "cgn",
    "eventHubName": "ehn",
    "keyName": "managementKey",
    "provisioningState": "Succeeded",
    "creationTime": "2017-04-18T19:20:33.2288820Z",
    "localTimestamp": {
      "format": "TimeSpan",
      "timeZoneOffset": {
        "propertyName": "someEventPropertyName"
      }
    },
    "ingressStartAt": {
      "type": "EarliestAvailable"
    }
  }
}
{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.TimeSeriesInsights/Environments/env1/eventSources/es1",
  "location": "West US",
  "name": "es1",
  "type": "Microsoft.TimeSeriesInsights/Environments/EventSources",
  "tags": {},
  "kind": "Microsoft.EventHub",
  "properties": {
    "eventSourceResourceId": "somePathInArm",
    "serviceBusNamespace": "sbn",
    "consumerGroupName": "cgn",
    "eventHubName": "ehn",
    "keyName": "managementKey",
    "provisioningState": "Succeeded",
    "creationTime": "2017-04-18T19:20:33.2288820Z",
    "localTimestamp": {
      "format": "TimeSpan",
      "timeZoneOffset": {
        "propertyName": "someEventPropertyName"
      }
    },
    "ingressStartAt": {
      "type": "EarliestAvailable"
    }
  }
}

EventSourcesCreateEventHubWithCustomEnquedTime

Sample Request

PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.TimeSeriesInsights/environments/env1/eventSources/es1?api-version=2020-05-15

{
  "location": "West US",
  "kind": "Microsoft.EventHub",
  "properties": {
    "eventSourceResourceId": "somePathInArm",
    "serviceBusNamespace": "sbn",
    "consumerGroupName": "cgn",
    "eventHubName": "ehn",
    "keyName": "managementKey",
    "sharedAccessKey": "someSecretvalue",
    "timestampPropertyName": "someTimestampProperty",
    "ingressStartAt": {
      "type": "CustomEnqueuedTime",
      "time": "2017-04-01T19:20:33.2288820Z"
    }
  }
}

Sample Response

{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.TimeSeriesInsights/Environments/env1/eventSources/es1",
  "location": "West US",
  "name": "es1",
  "type": "Microsoft.TimeSeriesInsights/Environments/EventSources",
  "tags": {},
  "kind": "Microsoft.EventHub",
  "properties": {
    "eventSourceResourceId": "somePathInArm",
    "serviceBusNamespace": "sbn",
    "consumerGroupName": "cgn",
    "eventHubName": "ehn",
    "keyName": "managementKey",
    "provisioningState": "Succeeded",
    "creationTime": "2017-04-18T19:20:33.2288820Z",
    "ingressStartAt": {
      "type": "CustomEnqueuedTime",
      "time": "2017-04-01T19:20:33.2288820Z"
    }
  }
}
{
  "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.TimeSeriesInsights/Environments/env1/eventSources/es1",
  "location": "West US",
  "name": "es1",
  "type": "Microsoft.TimeSeriesInsights/Environments/EventSources",
  "tags": {},
  "kind": "Microsoft.EventHub",
  "properties": {
    "eventSourceResourceId": "somePathInArm",
    "serviceBusNamespace": "sbn",
    "consumerGroupName": "cgn",
    "eventHubName": "ehn",
    "keyName": "managementKey",
    "provisioningState": "Succeeded",
    "creationTime": "2017-04-18T19:20:33.2288820Z",
    "ingressStartAt": {
      "type": "CustomEnqueuedTime",
      "time": "2017-04-01T19:20:33.2288820Z"
    }
  }
}

Definitions

Name Description
CloudError

Contains information about an API error.

CloudErrorBody

Describes a particular API error with an error code and a message.

EventHubEventSourceCreateOrUpdateParameters

Parameters supplied to the Create or Update Event Source operation for an EventHub event source.

EventHubEventSourceResource

An event source that receives its data from an Azure EventHub.

IngressStartAtType

The type of the ingressStartAt, It can be "EarliestAvailable", "EventSourceCreationTime", "CustomEnqueuedTime".

IoTHubEventSourceCreateOrUpdateParameters

Parameters supplied to the Create or Update Event Source operation for an IoTHub event source.

IoTHubEventSourceResource

An event source that receives its data from an Azure IoTHub.

LocalTimestamp

An object that represents the local timestamp property. It contains the format of local timestamp that needs to be used and the corresponding timezone offset information. If a value isn't specified for localTimestamp, or if null, then the local timestamp will not be ingressed with the events.

LocalTimestampFormat

An enum that represents the format of the local timestamp property that needs to be set.

ProvisioningState

Provisioning state of the resource.

TimeZoneOffset

An object that represents the offset information for the local timestamp format specified. Should not be specified for LocalTimestampFormat - Embedded.

CloudError

Contains information about an API error.

Name Type Description
error

CloudErrorBody

Describes a particular API error with an error code and a message.

CloudErrorBody

Describes a particular API error with an error code and a message.

Name Type Description
code

string

An error code that describes the error condition more precisely than an HTTP status code. Can be used to programmatically handle specific error cases.

details

CloudErrorBody[]

Contains nested errors that are related to this error.

message

string

A message that describes the error in detail and provides debugging information.

target

string

The target of the particular error (for example, the name of the property in error).

EventHubEventSourceCreateOrUpdateParameters

Parameters supplied to the Create or Update Event Source operation for an EventHub event source.

Name Type Description
creationTime

string

The time the resource was created.

eventSourceResourceId

string

The resource id of the event source in Azure Resource Manager.

ingressStartAt.time

string

ISO8601 UTC datetime with seconds precision (milliseconds are optional), specifying the date and time that will be the starting point for Events to be consumed.

ingressStartAt.type

IngressStartAtType

The type of the ingressStartAt, It can be "EarliestAvailable", "EventSourceCreationTime", "CustomEnqueuedTime".

kind string:

Microsoft.EventHub

The kind of the event source.

localTimestamp

LocalTimestamp

An object that represents the local timestamp property. It contains the format of local timestamp that needs to be used and the corresponding timezone offset information. If a value isn't specified for localTimestamp, or if null, then the local timestamp will not be ingressed with the events.

location

string

The location of the resource.

properties.consumerGroupName

string

The name of the event hub's consumer group that holds the partitions from which events will be read.

properties.eventHubName

string

The name of the event hub.

properties.keyName

string

The name of the SAS key that grants the Time Series Insights service access to the event hub. The shared access policies for this key must grant 'Listen' permissions to the event hub.

properties.serviceBusNamespace

string

The name of the service bus that contains the event hub.

properties.sharedAccessKey

string

The value of the shared access key that grants the Time Series Insights service read access to the event hub. This property is not shown in event source responses.

provisioningState

ProvisioningState

Provisioning state of the resource.

tags

object

Key-value pairs of additional properties for the resource.

timestampPropertyName

string

The event property that will be used as the event source's timestamp. If a value isn't specified for timestampPropertyName, or if null or empty-string is specified, the event creation time will be used.

EventHubEventSourceResource

An event source that receives its data from an Azure EventHub.

Name Type Description
creationTime

string

The time the resource was created.

eventSourceResourceId

string

The resource id of the event source in Azure Resource Manager.

id

string

Resource Id

ingressStartAt.time

string

ISO8601 UTC datetime with seconds precision (milliseconds are optional), specifying the date and time that will be the starting point for Events to be consumed.

ingressStartAt.type

IngressStartAtType

The type of the ingressStartAt, It can be "EarliestAvailable", "EventSourceCreationTime", "CustomEnqueuedTime".

kind string:

Microsoft.EventHub

The kind of the event source.

localTimestamp

LocalTimestamp

An object that represents the local timestamp property. It contains the format of local timestamp that needs to be used and the corresponding timezone offset information. If a value isn't specified for localTimestamp, or if null, then the local timestamp will not be ingressed with the events.

location

string

Resource location

name

string

Resource name

properties.consumerGroupName

string

The name of the event hub's consumer group that holds the partitions from which events will be read.

properties.eventHubName

string

The name of the event hub.

properties.keyName

string

The name of the SAS key that grants the Time Series Insights service access to the event hub. The shared access policies for this key must grant 'Listen' permissions to the event hub.

properties.serviceBusNamespace

string

The name of the service bus that contains the event hub.

provisioningState

ProvisioningState

Provisioning state of the resource.

tags

object

Resource tags

timestampPropertyName

string

The event property that will be used as the event source's timestamp. If a value isn't specified for timestampPropertyName, or if null or empty-string is specified, the event creation time will be used.

type

string

Resource type

IngressStartAtType

The type of the ingressStartAt, It can be "EarliestAvailable", "EventSourceCreationTime", "CustomEnqueuedTime".

Name Type Description
CustomEnqueuedTime

string

EarliestAvailable

string

EventSourceCreationTime

string

IoTHubEventSourceCreateOrUpdateParameters

Parameters supplied to the Create or Update Event Source operation for an IoTHub event source.

Name Type Description
creationTime

string

The time the resource was created.

eventSourceResourceId

string

The resource id of the event source in Azure Resource Manager.

ingressStartAt.time

string

ISO8601 UTC datetime with seconds precision (milliseconds are optional), specifying the date and time that will be the starting point for Events to be consumed.

ingressStartAt.type

IngressStartAtType

The type of the ingressStartAt, It can be "EarliestAvailable", "EventSourceCreationTime", "CustomEnqueuedTime".

kind string:

Microsoft.IoTHub

The kind of the event source.

localTimestamp

LocalTimestamp

An object that represents the local timestamp property. It contains the format of local timestamp that needs to be used and the corresponding timezone offset information. If a value isn't specified for localTimestamp, or if null, then the local timestamp will not be ingressed with the events.

location

string

The location of the resource.

properties.consumerGroupName

string

The name of the iot hub's consumer group that holds the partitions from which events will be read.

properties.iotHubName

string

The name of the iot hub.

properties.keyName

string

The name of the Shared Access Policy key that grants the Time Series Insights service access to the iot hub. This shared access policy key must grant 'service connect' permissions to the iot hub.

properties.sharedAccessKey

string

The value of the Shared Access Policy key that grants the Time Series Insights service read access to the iot hub. This property is not shown in event source responses.

provisioningState

ProvisioningState

Provisioning state of the resource.

tags

object

Key-value pairs of additional properties for the resource.

timestampPropertyName

string

The event property that will be used as the event source's timestamp. If a value isn't specified for timestampPropertyName, or if null or empty-string is specified, the event creation time will be used.

IoTHubEventSourceResource

An event source that receives its data from an Azure IoTHub.

Name Type Description
creationTime

string

The time the resource was created.

eventSourceResourceId

string

The resource id of the event source in Azure Resource Manager.

id

string

Resource Id

ingressStartAt.time

string

ISO8601 UTC datetime with seconds precision (milliseconds are optional), specifying the date and time that will be the starting point for Events to be consumed.

ingressStartAt.type

IngressStartAtType

The type of the ingressStartAt, It can be "EarliestAvailable", "EventSourceCreationTime", "CustomEnqueuedTime".

kind string:

Microsoft.IoTHub

The kind of the event source.

localTimestamp

LocalTimestamp

An object that represents the local timestamp property. It contains the format of local timestamp that needs to be used and the corresponding timezone offset information. If a value isn't specified for localTimestamp, or if null, then the local timestamp will not be ingressed with the events.

location

string

Resource location

name

string

Resource name

properties.consumerGroupName

string

The name of the iot hub's consumer group that holds the partitions from which events will be read.

properties.iotHubName

string

The name of the iot hub.

properties.keyName

string

The name of the Shared Access Policy key that grants the Time Series Insights service access to the iot hub. This shared access policy key must grant 'service connect' permissions to the iot hub.

provisioningState

ProvisioningState

Provisioning state of the resource.

tags

object

Resource tags

timestampPropertyName

string

The event property that will be used as the event source's timestamp. If a value isn't specified for timestampPropertyName, or if null or empty-string is specified, the event creation time will be used.

type

string

Resource type

LocalTimestamp

An object that represents the local timestamp property. It contains the format of local timestamp that needs to be used and the corresponding timezone offset information. If a value isn't specified for localTimestamp, or if null, then the local timestamp will not be ingressed with the events.

Name Type Description
format

LocalTimestampFormat

An enum that represents the format of the local timestamp property that needs to be set.

timeZoneOffset

TimeZoneOffset

An object that represents the offset information for the local timestamp format specified. Should not be specified for LocalTimestampFormat - Embedded.

LocalTimestampFormat

An enum that represents the format of the local timestamp property that needs to be set.

Name Type Description
Embedded

string

ProvisioningState

Provisioning state of the resource.

Name Type Description
Accepted

string

Creating

string

Deleting

string

Failed

string

Succeeded

string

Updating

string

TimeZoneOffset

An object that represents the offset information for the local timestamp format specified. Should not be specified for LocalTimestampFormat - Embedded.

Name Type Description
propertyName

string

The event property that will be contain the offset information to calculate the local timestamp. When the LocalTimestampFormat is Iana, the property name will contain the name of the column which contains IANA Timezone Name (eg: Americas/Los Angeles). When LocalTimestampFormat is Timespan, it contains the name of property which contains values representing the offset (eg: P1D or 1.00:00:00)