I'm new to both Terraform and Azure. In a timespan of 6 weeks I have to create an IoT solution. I've only got 3 weeks left.
I have to provision devices in an IoT hub using a DPS and if 'm not wrong, a DPS uses azure functions to do so.
My question is, how can I add azure functions to a dps using terraform or is this not possible and do I have it all wrong?
CodePudding user response:
DPS does not require an Azure Function for basic functionality. That's only needed if you're doing custom allocation policies. If all you want to do is have an IoT Hub assigned from a pool of one or more Hubs, then one of the built-in allocation policies will work, as described in the overview:
Multiple allocation policies to control how DPS assigns devices to IoT hubs in support of your scenarios: Lowest latency, evenly weighted distribution (default), and static configuration via the enrollment list. Latency is determined using the same method as Traffic Manager.
The documentation explains how to select this in the Portal, and since you mention you're using Terraform, the provider does this using the allocation_policy
setting according to the provider documentation.
I understand you're under a small time crunch but you might find the self-paced training at Microsoft Learn for the AZ-220 exam worth your time. There is a learning path about device provisioning, and the information on load balancing is covered in that (for example, at this lesson).