If you need to delete all documents from a container in Cosmos DB from the portal you can set the Time to Live value to 1 sec for all items in the container.
Setting TTL to 1 will cause Cosmos to automatically begin deleting all items in a container without you needing to issue an explicit delete from a client application (or deleting items one by one).
How you can configure TTL for Cosmos is below …
Deletion of items will take a few minutes
As noted by Microsoft …
- Deletion of expired items is a background task that consumes left-over Request Units.
- Even after the TTL has expired, if the container is overloaded with requests and if there aren’t enough RU’s available, the data deletion is delayed. Data is deleted once there are enough RUs available to perform the delete operation.
- Data is not returned by any queries (by any API) after the TTL has expired even if the delete is delayed.
… so after setting the TIL to 1 give it a few minutes to finish.