Skip to content

EnsureCreated fails with CosmosDB if Scale not set #26885

@SamueleFurnari

Description

@SamueleFurnari

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:

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

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions