Also currently there is no way to use managed identity to connect to iothub, only connection strings are possible.
Would be better if this works the same as eg: Azure.Data.Tables where you can inject the clients using already registered services.
What you expected to happen:
Keep the Azure apis consistent
eg:
.AddIotHub(sp => sp.GetService<ServiceClient>(), sp => sp.GetService<RegistryManager>(), options => ...
Maybe split it per check, or handle clients being null if they aren't needed depending on the options.
How to reproduce it (as minimally and precisely as possible):
register the current AddIotHub and monitor for socket exhaustion.
What happened:
IoTHubHealthCheck
Creates a newServiceClient
, this is a problem, see: https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.devices.serviceclient?view=azure-dotnet#remarksAlso currently there is no way to use managed identity to connect to iothub, only connection strings are possible. Would be better if this works the same as eg: Azure.Data.Tables where you can inject the clients using already registered services.
Same goes for the RegistryManager https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.devices.registrymanager?view=azure-dotnet#remarks
What you expected to happen: Keep the Azure apis consistent eg:
.AddIotHub(sp => sp.GetService<ServiceClient>(), sp => sp.GetService<RegistryManager>(), options => ...
Maybe split it per check, or handle clients being null if they aren't needed depending on the options.
How to reproduce it (as minimally and precisely as possible): register the current
AddIotHub
and monitor for socket exhaustion.Source code sample: https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/master/src/HealthChecks.Azure.IoTHub/IoTHubHealthCheck.cs#L43 #
Anything else we need to know?:
Environment: