Specifying Azure SQL Database Options

Azure SQL Database provides a variety of pricing options that are usually configured through the Azure Portal. However if you are managing the schema using EF Core migrations you can specify the desired options in the model itself.

You can specify the service tier of the database (EDITION) using HasServiceTier:


You can specify the maximum size of the database using HasDatabaseMaxSize:

modelBuilder.HasDatabaseMaxSize("2 GB");

You can specify the performance level of the database (SERVICE_OBJECTIVE) using HasPerformanceLevel:


Use HasPerformanceLevelSql to configure the elastic pool, since the value is not a string literal:

modelBuilder.HasPerformanceLevelSql("ELASTIC_POOL ( name = myelasticpool )");


You can find all the supported values in the ALTER DATABASE documentation.