This script will help you read and write data to Azure Cosmos DB, if you are new to cosmosDB please go thru the below links
Links to understand IOT Hub Cosmos-DB and create a Cosmos-DB Rsource
-
https://azure.microsoft.com/en-in/solutions/architecture/iot-using-cosmos-db/
-
https://docs.microsoft.com/en-us/azure/cosmos-db/create-sql-api-python The python files written here are referenced from the above link. use the above link to create a new database resource and to use the connection strings