Azure policy to set the diagnostic Settings for Azure Function to Event Hub so that all the events will be routed to the corresponding event hub.

Azure policy can automate this process and for resources that already exist, a remediation task has to be created.
Below is code that will help to create the Azure Policy to set the Azure Functions diagnostic settings to event-hub.