dotnet / dotnet/efcore

EnsureCreated fails with CosmosDB if Scale not set

Open
#26,885 4 comments 0 reactions 0 assignees View on GitHub
area-cosmos customer-reported
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

If you want to use the _EnsureCreated_ with a CosmosDB provider, the request fails with a generic 400 - BadRequest if the Cosmos instance does not have Scale setted.

To reproduce this, try to create a CosmosDB Database with _Provision throughput_ unselected and in your code (for example in the _Configure_ method of _Startup_ class, try to execute the code:

```C#
dbContext.Database.EnsureCreated();
```

If you create the database with the _Provision throughput_ selected and configured, the ensure works as expected.

EF Core version:
Database provider: Microsoft.EntityFrameworkCore.Cosmos v.5.0.10 and 5.0.12
Target framework: .NET 5.0
Operating system: Windows 10
IDE: Visual Studio 2019 16.11.7

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.