Event Hubs - Create Or Update

Creates or updates a new Event Hub as a nested resource within a Namespace.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/eventhubs/{eventHubName}?api-version=2024-01-01

URI Parameters

Name In Required Type Description
eventHubName
path True

string

The Event Hub name

namespaceName
path True

string

The Namespace name

Regex pattern: ^[a-zA-Z][a-zA-Z0-9-]{6,50}[a-zA-Z0-9]$

resourceGroupName
path True

string

Name of the resource group within the azure subscription.

subscriptionId
path True

string

Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

api-version
query True

string

Client API Version.

Request Body

Name Type Description
properties.captureDescription

CaptureDescription

Properties of capture description

properties.messageRetentionInDays

integer

Number of days to retain the events for this Event Hub, value should be 1 to 7 days

properties.partitionCount

integer

Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions.

properties.retentionDescription

RetentionDescription

Event Hub retention settings

properties.status

EntityStatus

Enumerates the possible values for the status of the Event Hub.

properties.userMetadata

string

Gets and Sets Metadata of User.

Responses

Name Type Description
200 OK

Eventhub

Event Hub successfully created.

Other Status Codes

ErrorResponse

Eventhub error response describing why the operation failed.

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

EventHubCreate

Sample Request

PUT https://management.azure.com/subscriptions/5f750a97-50d9-4e36-8081-c9ee4c0210d4/resourceGroups/Default-NotificationHubs-AustraliaEast/providers/Microsoft.EventHub/namespaces/sdk-Namespace-5357/eventhubs/sdk-EventHub-6547?api-version=2024-01-01

{
  "properties": {
    "messageRetentionInDays": 4,
    "partitionCount": 4,
    "status": "Active",
    "userMetadata": "key",
    "captureDescription": {
      "enabled": true,
      "encoding": "Avro",
      "destination": {
        "name": "EventHubArchive.AzureBlockBlob",
        "properties": {
          "storageAccountResourceId": "/subscriptions/e2f361f0-3b27-4503-a9cc-21cfba380093/resourceGroups/Default-Storage-SouthCentralUS/providers/Microsoft.ClassicStorage/storageAccounts/arjunteststorage",
          "blobContainer": "container",
          "archiveNameFormat": "{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}"
        },
        "identity": {
          "type": "UserAssigned",
          "userAssignedIdentity": "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud2"
        }
      },
      "intervalInSeconds": 120,
      "sizeLimitInBytes": 10485763
    },
    "retentionDescription": {
      "cleanupPolicy": "Compact",
      "retentionTimeInHours": 96,
      "tombstoneRetentionTimeInHours": 1
    }
  }
}

Sample Response

{
  "id": "/subscriptions/e2f361f0-3b27-4503-a9cc-21cfba380093/resourceGroups/Default-NotificationHubs-AustraliaEast/providers/Microsoft.EventHub/namespaces/sdk-Namespace-716/eventhubs/sdk-EventHub-10",
  "name": "sdk-EventHub-10",
  "type": "Microsoft.EventHub/Namespaces/EventHubs",
  "properties": {
    "messageRetentionInDays": 4,
    "partitionCount": 4,
    "status": "Active",
    "userMetadata": "key",
    "createdAt": "2017-06-28T02:45:55.877Z",
    "updatedAt": "2017-06-28T02:46:05.877Z",
    "partitionIds": [
      "0",
      "1",
      "2",
      "3"
    ],
    "captureDescription": {
      "enabled": true,
      "encoding": "Avro",
      "destination": {
        "name": "EventHubArchive.AzureBlockBlob",
        "properties": {
          "storageAccountResourceId": "/subscriptions/e2f361f0-3b27-4503-a9cc-21cfba380093/resourceGroups/Default-Storage-SouthCentralUS/providers/Microsoft.ClassicStorage/storageAccounts/arjunteststorage",
          "blobContainer": "container",
          "archiveNameFormat": "{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}"
        },
        "identity": {
          "type": "UserAssigned",
          "userAssignedIdentity": "/subscriptions/SampleSubscription/resourceGroups/ResurceGroupSample/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ud2"
        }
      },
      "intervalInSeconds": 120,
      "sizeLimitInBytes": 10485763
    },
    "retentionDescription": {
      "cleanupPolicy": "Compact",
      "retentionTimeInHours": 96,
      "tombstoneRetentionTimeInHours": 1
    }
  }
}

Definitions

Name Description
CaptureDescription

Properties to configure capture description for eventhub

CaptureIdentity

A value that indicates whether capture description is enabled.

CaptureIdentityType

Type of Azure Active Directory Managed Identity.

CleanupPolicyRetentionDescription

Enumerates the possible values for cleanup policy

createdByType

The type of identity that created the resource.

Destination

Capture storage details for capture description

EncodingCaptureDescription

Enumerates the possible values for the encoding format of capture description. Note: 'AvroDeflate' will be deprecated in New API Version

EntityStatus

Enumerates the possible values for the status of the Event Hub.

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response indicates Event Hub service is not able to process the incoming request. The reason is provided in the error message.

Eventhub

Single item in List or Get Event Hub operation

RetentionDescription

Properties to configure retention settings for the eventhub

systemData

Metadata pertaining to creation and last modification of the resource.

CaptureDescription

Properties to configure capture description for eventhub

Name Type Description
destination

Destination

Properties of Destination where capture will be stored. (Storage Account, Blob Names)

enabled

boolean

A value that indicates whether capture description is enabled.

encoding

EncodingCaptureDescription

Enumerates the possible values for the encoding format of capture description. Note: 'AvroDeflate' will be deprecated in New API Version

intervalInSeconds

integer

The time window allows you to set the frequency with which the capture to Azure Blobs will happen, value should between 60 to 900 seconds

sizeLimitInBytes

integer

The size window defines the amount of data built up in your Event Hub before an capture operation, value should be between 10485760 to 524288000 bytes

skipEmptyArchives

boolean

A value that indicates whether to Skip Empty Archives

CaptureIdentity

A value that indicates whether capture description is enabled.

Name Type Description
type

CaptureIdentityType

Type of Azure Active Directory Managed Identity.

userAssignedIdentity

string

ARM ID of Managed User Identity. This property is required is the type is UserAssignedIdentity. If type is SystemAssigned, then the System Assigned Identity Associated with the namespace will be used.

CaptureIdentityType

Type of Azure Active Directory Managed Identity.

Name Type Description
SystemAssigned

string

UserAssigned

string

CleanupPolicyRetentionDescription

Enumerates the possible values for cleanup policy

Name Type Description
Compact

string

Delete

string

createdByType

The type of identity that created the resource.

Name Type Description
Application

string

Key

string

ManagedIdentity

string

User

string

Destination

Capture storage details for capture description

Name Type Description
identity

CaptureIdentity

A value that indicates whether capture description is enabled.

name

string

Name for capture destination

properties.archiveNameFormat

string

Blob naming convention for archive, e.g. {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}. Here all the parameters (Namespace,EventHub .. etc) are mandatory irrespective of order

properties.blobContainer

string

Blob container Name

properties.dataLakeAccountName

string

The Azure Data Lake Store name for the captured events

properties.dataLakeFolderPath

string

The destination folder path for the captured events

properties.dataLakeSubscriptionId

string

Subscription Id of Azure Data Lake Store

properties.storageAccountResourceId

string

Resource id of the storage account to be used to create the blobs

EncodingCaptureDescription

Enumerates the possible values for the encoding format of capture description. Note: 'AvroDeflate' will be deprecated in New API Version

Name Type Description
Avro

string

AvroDeflate

string

EntityStatus

Enumerates the possible values for the status of the Event Hub.

Name Type Description
Active

string

Creating

string

Deleting

string

Disabled

string

ReceiveDisabled

string

Renaming

string

Restoring

string

SendDisabled

string

Unknown

string

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

ErrorDetail

The error detail.

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

ErrorDetail[]

The error details.

message

string

The error message.

target

string

The error target.

ErrorResponse

Error response indicates Event Hub service is not able to process the incoming request. The reason is provided in the error message.

Name Type Description
error

ErrorDetail

The error object.

Eventhub

Single item in List or Get Event Hub operation

Name Type Description
id

string

Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

location

string

The geo-location where the resource lives

name

string

The name of the resource

properties.captureDescription

CaptureDescription

Properties of capture description

properties.createdAt

string

Exact time the Event Hub was created.

properties.messageRetentionInDays

integer

Number of days to retain the events for this Event Hub, value should be 1 to 7 days

properties.partitionCount

integer

Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions.

properties.partitionIds

string[]

Current number of shards on the Event Hub.

properties.retentionDescription

RetentionDescription

Event Hub retention settings

properties.status

EntityStatus

Enumerates the possible values for the status of the Event Hub.

properties.updatedAt

string

The exact time the message was updated.

properties.userMetadata

string

Gets and Sets Metadata of User.

systemData

systemData

The system meta data relating to this resource.

type

string

The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or "Microsoft.EventHub/Namespaces/EventHubs"

RetentionDescription

Properties to configure retention settings for the eventhub

Name Type Description
cleanupPolicy

CleanupPolicyRetentionDescription

Enumerates the possible values for cleanup policy

retentionTimeInHours

integer

Number of hours to retain the events for this Event Hub. This value is only used when cleanupPolicy is Delete. If cleanupPolicy is Compact the returned value of this property is Long.MaxValue

tombstoneRetentionTimeInHours

integer

Number of hours to retain the tombstone markers of a compacted Event Hub. This value is only used when cleanupPolicy is Compact. Consumer must complete reading the tombstone marker within this specified amount of time if consumer begins from starting offset to ensure they get a valid snapshot for the specific key described by the tombstone marker within the compacted Event Hub

systemData

Metadata pertaining to creation and last modification of the resource.

Name Type Description
createdAt

string

The timestamp of resource creation (UTC).

createdBy

string

The identity that created the resource.

createdByType

createdByType

The type of identity that created the resource.

lastModifiedAt

string

The type of identity that last modified the resource.

lastModifiedBy

string

The identity that last modified the resource.

lastModifiedByType

createdByType

The type of identity that last modified the resource.