Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Markdown
- [Prerequisites](#prerequisites)
- [Create the Database](#create-the-database)

## Prerequisites
* A Microsoft SQL Server
  * Saga requires SQL Server 2012 compatibility.
  * Saga is tested and verified with the following versions:
    * SQL Server 2019
    * SQL Server 2022
  * The Microsoft SQL sever needs to be dimensioned in accordance with the size of the Saga installation. Heavy I/O is to be expected.
* A user with permissions to create databases on the Microsoft SQL Server.
* A gMSA account, see [Ayfie Saga Installation Guide](https://ayfie-dev.atlassian.net/wiki/spaces/SAGA/pages/2400714758/Ayfie+Saga+Installation+Guide)

## Create the Database

Download these files:
* [new-sqlserverlocatordatabase.ps1](https://ayfie-dev.atlassian.net/wiki/download/attachments/2374336517/new-sqlserverlocatordatabase.ps1?version=3233)
* [new-sqlserverlocatordatabase.sql](https://ayfie-dev.atlassian.net/wiki/download/attachments/2374336517/new-sqlserverlocatordatabase.sql?version=3233)

To create the database, run the command below (after having replaced \<Microsoft_SQL_host_FQDN\>, \<domain\> and \<login_name\>) with a user that has permission to create databases.

```
 .\new-sqlserverlocatordatabase.ps1 -Server <Microsoft_SQL_host_FQDN> -Database Locator -AdServiceAccount <domain>\<login_name>
```

* Server - The Microsoft SQL server where the database will be created.
* Database - The name of the database that will be created.
* AdServiceAccount - The Active Directory service account to get access to the database. This needs to be the gMSA account.
* <login_name> is the SAM account name.

The script must be run from a Windows host with Microsoft SQL Server connectivity and the **SqlServer** PowerShell module installed. The module is included within Windowsall ServerSaga 2019, the OS required by Sagasupported OSes. The user executing the script must in the Microsoft SQL Server database have been granted permissions to perform the actions described below.

The script performs the following actions:
* Creates a database named *Locator*
* Sets 2012 SQL Server compatibility level on the database.
* Creates *db_executor* role and grants execute permissions to this role in the database.
* Creates a user for the AdServiceAccount in the database.
* Creates a login for the AdServiceAccount in the database.
* Adds the following roles for the AdServiceAccount:
  * *db_executor*
  * *db_ddladmin*
  * *db_datareader*
  * *db_datawriter*