Skip to content
Stackship documentation Svenska

SQL ServerUsers

Create an instance

Create a SQL Server instance in the portal — name and placement, edition and product key, version, database and collation, compute plan and storage, backups and monitoring — or with the CLI.

Requires: sqlservercluster/write

Creating an instance needs the sqlservercluster/write permission in the resource group; the Owner, Contributor and Databases Operator roles have it.

Open the wizard

In the portal at https://portal.example.com, open SQL Server in the sidebar and choose Create SQL Server Databases. The Create SQL Server Instance wizard has seven steps: Basics, Edition, Database, Resources, Backup, Monitoring and Review. Next checks a step before it moves on, and Submit on the last step creates the instance.

Basics

  • Instance Name — 3 to 50 characters: lowercase letters, digits and hyphens, not starting or ending with a hyphen, and unique in the resource group. The name cannot be changed later; it is also the instance's in-cluster host name.
  • Boundary, Cluster and Resource group — where the instance runs. Each is filled in for you when there is only one choice.

Edition

  • Edition — Developer (free, non-production), the default; Express (free, production, capped); Standard (paid); or Enterprise (paid). Choosing Express shows its limits: 10 GB per database and limited CPU and memory. The edition cannot be changed after creation.
  • Product Key — shown for Standard and Enterprise, and required for them: without a key the wizard does not move on. The key is stored as a secret in the resource group and never displayed again. The API does not check for one: a paid-edition instance created there without licenseKey runs without a product key.

Database

  • SQL Server Version — SQL Server 2022, the default, or SQL Server 2019.

    Warning

    Every instance runs the SQL Server 2022 image. Choosing SQL Server 2019 only records 2019 as the instance's version. Choose SQL Server 2022.

  • Initial Database Name — the database created when the server first starts, and the one the connection strings open. Required: 1 to 128 characters, letters, digits and underscores, starting with a letter or an underscore.

  • Collation — the server collation, such as SQL_Latin1_General_CP1_CI_AS. Leave it empty for SQL Server's default. The wizard checks only that it is at most 128 characters, so a name SQL Server does not know is not refused when you create the instance.

The version, the database name and the collation cannot be changed after creation.

Resources

  • Compute plan — how much CPU and memory the server gets, and its default storage; each card shows the plan's name and shape. Choosing a plan fills in the fields below. The plans are listed in Compute plans. When the boundary restricts which plans may be used, the others cannot be chosen, and a plan that this installation's nodes could never host is refused when you create the instance.

  • Storage Size — the data volume, in whole GB. It starts at the plan's storage.

    Important

    Choose the size you need now. Raising it later does not enlarge the existing volume — see Storage and resources.

  • Advanced resource settings — CPU Request and Memory Request, filled in from the plan. SQL Server needs at least 2 GB of memory. The CPU and memory limits come from the plan.

Backup

  • Enable Backups — off by default. When it is on, the platform snapshots the data volume on a schedule.
  • Retention Policy — how long each backup is kept: a number followed by d (days), w (weeks) or m (months), such as 30d, the default.
  • Backup schedule — Daily, or Weekly on a Day of week, at a Time (UTC); or a Custom cron expression with five fields, in UTC. The default is daily at 03:00 UTC.

What a backup contains and how to restore one is described in Back up and restore.

Monitoring

  • Enable Monitoring — on by default. The platform stores the choice on the instance but does not act on it today; nothing it collects about the instance depends on it.

Review

Review shows the name, edition, version, database, resources, monitoring and backups. Submit creates the instance and returns to the list. The instance is Creating until the server accepts connections, and then Running; the initial database is created right after. Follow it on the instance's Operations tab — see Operations.

With the CLI

bash
stsh sqlserver create my-sql -g my-resource-group -c my-cluster \
  --set computePlan=small --set databaseName=AppDb

The edition defaults to Developer and the version to 2022. Without databaseName no database is created and the connection strings open master. For a paid edition, keep the product key out of your shell history by putting the body in a file:

json
{
  "edition": "Standard",
  "licenseKey": "<product key>",
  "sqlVersion": "2022",
  "databaseName": "AppDb",
  "computePlan": "medium"
}
bash
stsh sqlserver create my-sql -g my-resource-group -c my-cluster --file instance.json

Next steps