-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathevent-hub.bicep
55 lines (48 loc) · 1.79 KB
/
event-hub.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { roleAssignmentInfo } from '../security/managed-identity.bicep'
@description('Name of the resource.')
param name string
@description('Name for the Event Hub Namespace associated with the Event Hub.')
param eventHubNamespaceName string
@description('Number of days to retain events in the Event Hub. Default is 1 day.')
param retentionInDays int = 1
@description('Number of partitions in the Event Hub. Default is 1 partition.')
param partitionCount int = 1
@description('Role assignments to create for the Event Hub resource.')
param roleAssignments roleAssignmentInfo[] = []
resource eventHubNamespace 'Microsoft.EventHub/namespaces@2024-05-01-preview' existing = {
name: eventHubNamespaceName
}
resource eventHub 'Microsoft.EventHub/namespaces/eventhubs@2024-05-01-preview' = {
name: name
parent: eventHubNamespace
properties: {
messageRetentionInDays: retentionInDays
partitionCount: partitionCount
}
resource listenSendAuthorization 'authorizationRules' = {
name: 'ListenSend'
properties: {
rights: [
'Listen'
'Send'
]
}
}
}
resource assignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = [
for roleAssignment in roleAssignments: {
name: guid(eventHub.id, roleAssignment.principalId, roleAssignment.roleDefinitionId)
scope: eventHub
properties: {
principalId: roleAssignment.principalId
roleDefinitionId: roleAssignment.roleDefinitionId
principalType: roleAssignment.principalType
}
}
]
@description('The deployed Event Hub resource.')
output resource resource = eventHub
@description('ID for the deployed Event Hub resource.')
output id string = eventHub.id
@description('Name for the deployed Event Hub resource.')
output name string = eventHub.name