-
Notifications
You must be signed in to change notification settings - Fork 1
/
iothub.bicep
57 lines (48 loc) · 1.41 KB
/
iothub.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
56
57
//
// Deploys an Azure IoT Hub
// https://learn.microsoft.com/en-us/azure/iot-hub/
//
@description('Descriptor for this resource')
param prefix string = 'iothub'
@description('Unique suffix for all resources in this deployment')
param suffix string = uniqueString(resourceGroup().id)
@description('Location for all resources.')
param location string = resourceGroup().location
@description('SKU name.')
param sku string = 'S1'
@description('Number of provisioned units. Restricted to 1 unit for the F1 SKU. Can be set up to maximum number allowed for subscription.')
param capacity int = 1
@description('Optional file upload storage endpoint')
param uploadstorage object = {}
@description('Optional array of routes to establish')
param routes array = []
resource iotHub 'Microsoft.Devices/IotHubs@2021-07-02' = {
name: '${prefix}-${suffix}'
location: location
sku: {
name: sku
capacity: capacity
}
properties: {
storageEndpoints: uploadstorage
routing: {
routes: routes
fallbackRoute: {
name: '$fallback'
source: 'DeviceMessages'
condition: 'true'
endpointNames: [
'events'
]
isEnabled: true
}
}
}
}
output result object = {
name: iotHub.name
id: iotHub.id
host: iotHub.properties.hostName
eventpath: iotHub.properties.eventHubEndpoints.events.path
eventendpoint: iotHub.properties.eventHubEndpoints.events.endpoint
}