One way to import a CSV file into Azure Cosmos DB is to use the Azure Cosmos DB Data Migration tool. Here are the steps you can follow:
- Download and install the Azure Cosmos DB Data Migration tool from the Azure Portal.
- Open the tool and create a new migration project.
- Choose the source type as "CSV" and select the CSV file you want to import.
- Choose the target type as "DocumentDB" (the previous name for Azure Cosmos DB).
- Enter your Azure Cosmos DB account details and select the appropriate database and collection to import the data into.
- Map the fields in your CSV file to the corresponding fields in your Azure Cosmos DB collection.
- Review the settings and start the migration.
The tool will automatically create the appropriate documents in your Azure Cosmos DB collection based on the data in your CSV file. This method is typically faster than manually inserting the data using the Azure Portal or API calls.