Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Service Tiers when create Azure SQL database from VS C#

Is it possible to set the Microsoft Azure SQL Database service tiers when creating a new database from Visual Studio in C#? Currently, I can connect to the Azure SQL server and create table with no problem but for some reason (maybe Microsoft Default) the databases will be created in Web which is the service tier that going to be retired. I would like to set the default service tiers to either be Basic, Standard, or Premium depends on the needs.

What I found so far is when I call this method Database.Initialize(true) <--EF http://msdn.microsoft.com/en-us/library/system.data.entity.database.initialize(v=vs.113).aspx It would create the database and set it to Web service tier.

like image 712
Chi Wu Avatar asked Nov 11 '14 00:11

Chi Wu


People also ask

What is service tiers in Azure SQL Database?

The General Purpose service tier is a default service tier in Azure SQL Database and Azure SQL Managed Instance that is designed for most of generic workloads. If you need a fully managed database engine with a default SLA and storage latency between 5 and 10 ms, the General Purpose tier is the option for you.

Which Azure SQL Database service tier provides the fastest recovery time for a database?

Fast geo-recovery - When active geo-replication is configured, the Business Critical tier has a guaranteed Recovery Point Objective (RPO) of 5 seconds and Recovery Time Objective (RTO) of 30 seconds for 100% of deployed hours.


1 Answers

With Azure SQL v12 you have the option to specify the SKU. Example:

var dbCreationCmd = $"CREATE DATABASE [{databaseName}] (MAXSIZE={maxSize}," +
                            $"EDITION='{edition}'," +
                            $"SERVICE_OBJECTIVE='{serviceObjective}')";

// With Azure SQL db V12, database creation TSQL became a sync process. 
// So we need a 10 minutes command timeout
ExecuteNonQuery(connectionString, dbCreationCmd, commandTimeout: 600);
like image 142
Xavier John Avatar answered Oct 21 '22 15:10

Xavier John