Hello @Debashis Jena
You can use Managed Identity to connect from Azure Function to Azure Cosmos DB
You need to set up a robust, key rotation agnostic solution to access Azure Cosmos DB keys by using managed identities and data plane role-based access control.
IoT Hub also offers a way to connect to its Service control plane by using Role-Based Access Control (RBAC). On top of that, you can completely disable access for shared access policies, which used to be the only way to connect to this plane.
https://www.vanderveer.io/iot-hub-service-managed-identity/
https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-managed-identity