IOT Hub

Overview

The IOT Hub builder creates IOT Hub and linked Provision Services.

  • IOT Hubs (Microsoft.Devices/IotHubs)
  • Provisioning Services (Microsoft.Devices/provisioningServices)

Builder Keywords

KeywordPurpose
nameSpecifies the name of the IOT Hub
skuSets the SKU of the IOT Hub
capacitySets the name of the capacity for the IOT Hub instance
partition_countSets the name of the SKU/Tier for the IOT Hub instance
retention_daysSets the name of the SKU/Tier for the IOT Hub instance
enable_device_provisioningSets the name of the SKU/Tier for the IOT Hub instance

Configuration Members

MemberPurpose
GetKeyReturns an ARM expression to retrieve the IOT Hub key for a specific policy e.g IotHubOwner or RegistryReadWrite. Useful for e.g. supplying the key to another resource e.g. KeyVault or an app setting in the App Service.
GetConnectionStringReturns an ARM expression to generate an IOT Hub connection string for a specific policy e.g IotHubOwner or RegistryReadWrite. Useful for e.g. supplying the key to another resource e.g. KeyVault or an app setting in the App Service.

Example

open Farmer
open Farmer.Builders

let hub = iotHub {
    name "yourhubname"
    sku IotHub.B1
    capacity 2
    partition_count 2
    retention_days 3
    enable_device_provisioning
}

let deployment = arm {
    location Location.NorthEurope
    add_resource hub
    output "iot_key" (hub.GetKey IotHub.IotHubOwner)
    output "iot_connection" (hub.GetConnectionString IotHub.RegistryReadWrite)
}