# Microsoft SQL Server (MSSQL)

DuploCloud supports the deployment and management of [Microsoft SQL Server](https://www.microsoft.com/en-us/sql-server/sql-server-downloads) (MSSQL) on Azure. You can use the DuploCloud Portal to create MSSQL Servers, add databases, and apply network and security configurations such as firewall rules, private endpoints, and virtual network rules.

## Prerequisites

### Enable public access for MSSQL Servers

To create an MSSQL Server with public access, you must first enable a Tenant setting that allows public network access for databases and cache servers. If public access is not required, you can skip this step and proceed directly to [create an MSSQL Server](#creating-an-mssql-server).

1. From the DuploCloud Portal, navigate to **Administrator** -> **Tenants**.
2. Select the Tenant from the **NAME** column.
3. Select the **Settings** tab, and click **Add**. The **Add Tenant Feature** pane displays.
4. From the **Select Feature** list box, select **Allow Public Network Access for Databases and Cache Servers**.
5. Enable the setting, and click **Add**. Public access is enabled.

## Creating an MSSQL Server

Create a new Microsoft SQL Server instance in your tenant to host one or more SQL databases for your applications.

1. Select the Tenant from the **Tenant** list box.
2. In the DuploCloud Portal, navigate to **Cloud Services** -> **Database** -> **MSSQLServer**.
3. Click **Add**. The **Add SQL Server** pane displays.
4. Provide a name for the MSSQL Server database, your username and password, and database version information.
5. From the **Public Access** list box, select **Enabled** or **Disabled**. If **Enabled** is not available, complete the steps above under **Prerequisites** to [enable this option](#enable-public-access-for-databases-in-tenant-settings).
6. Click **Submit**. The MSSQL Server database is created.

<div align="left"><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2F9KSJbnRuER9HErLdvfxi%2FScreenshot%20(700).png?alt=media&#x26;token=1584b8f5-be90-4bcc-a6bf-e081fccca788" alt="Create My SQL Server" width="438"></div>

## **Adding an SQL database**

After creating an MSSQL Server, you must add one or more SQL databases to store your application data.

1. Select the Tenant from the **Tenant** list box.
2. Navigate to **Cloud Services** → **Database** → **MSSQL Server**.
3. Select the MSSQL Server from the **NAME** column.
4. In the **Databases** tab, click **Add**. The **Create SQL Database** pane displays.<br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FGbe394uy9m9lGUn9jj8y%2FScreenshot%20(760).png?alt=media&#x26;token=7cc482e9-7666-4a2c-b655-11e12f512f7b" alt="" width="405"><figcaption><p><strong>Create SQL Database</strong> pane</p></figcaption></figure></div>
5. Complete the following fields:

<table data-header-hidden><thead><tr><th width="157.99993896484375">Field</th><th>Description</th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>Enter a name for the database.</td></tr><tr><td><strong>Use Elastic Pool</strong></td><td>Select whether to use an elastic pool. Default is <strong>No</strong>.</td></tr><tr><td><strong>Service Tier</strong></td><td>Select the service tier.</td></tr><tr><td><strong>SKU Name</strong></td><td>Select the SKU name.</td></tr><tr><td><strong>Collation</strong></td><td>Optionally, enter the collation setting.</td></tr></tbody></table>

6. Click **Submit** to create the database.

## **Updating the backup retention period for a database**

The default backup retention period for an SQL database is 7 days. You can update this setting to retain backups for up to 35 days.

1. Select the Tenant from the **Tenant** list box.
2. Navigate to **Cloud Services** → **Database** → **MSSQLServer**.
3. Select the MSSQL Server from the **NAME** column.
4. Select the **Databases** tab.
5. Click the menu icon (<img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2F2zCpjpPJBxCltuVCLA89%2Fmenu%20icon.avif?alt=media&#x26;token=85eee83d-9971-4469-9bcd-61a43626d0fb" alt="" data-size="line">) next to the database and select **Update Short Term Retention**. The **Update Backup Retention Period** pane displays.

<div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FNtB26TIGuaMrMhXbkgkX%2FScreenshot%20(761).png?alt=media&#x26;token=531f1ca4-a699-47f0-a467-400d6ddc275f" alt="" width="406"><figcaption><p><strong>Update Backup Retention Period</strong> pane</p></figcaption></figure></div>

6. Enter a value between **1** and **35** days and click **Save**.

{% hint style="info" %}
The backup retention period cannot be configured for the `master` database.
{% endhint %}

## Viewing MSSQL Server and database details

1. Select the Tenant from the **Tenant** list box.
2. In the DuploCloud Portal, navigate to **Cloud Services** → **Database** → **MSSQLServer**.
3. Select the MSSQL Server from the **NAME** column. The MSSQL Server details page displays.<br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FQFgs6LGOi2CBlEGPXQwN%2FScreenshot%20(778).png?alt=media&#x26;token=8dc0972a-4a25-4467-ba16-980638d30647" alt=""><figcaption><p><strong>MSSQL Server</strong> page</p></figcaption></figure></div>
4. Use one of the following options to manage the server and its databases:

Use the **tabs** to view server details:

<table data-header-hidden><thead><tr><th width="177.5555419921875">Option</th><th>Description</th></tr></thead><tbody><tr><td><strong>Databases</strong></td><td>View or manage the databases associated with this server.</td></tr><tr><td><strong>Elastic Pools</strong></td><td>View or configure elastic pool settings, if applicable.</td></tr><tr><td><strong>Private Endpoints</strong></td><td>View or manage private network connections.</td></tr><tr><td><strong>Virtual Network Rules</strong></td><td>View or manage subnet-based access restrictions. This tab is only visible when public access is <strong>enabled</strong>.</td></tr><tr><td><strong>Firewall Rules</strong></td><td>View or manage IP-based firewall rules. This tab is only visible when public access is <strong>enabled</strong>.</td></tr></tbody></table>

You can also use the **Actions** button at the top right of the page:

<table data-header-hidden><thead><tr><th width="182.88885498046875">Action</th><th>Description</th></tr></thead><tbody><tr><td><strong>Azure Portal</strong></td><td>Open the server directly in the Azure Portal.</td></tr><tr><td><strong>Delete SQL Server</strong></td><td>Delete the server if no databases remain.</td></tr></tbody></table>

To manage an individual database, go to the **Databases** tab and click the menu icon (<img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2F2zCpjpPJBxCltuVCLA89%2Fmenu%20icon.avif?alt=media&#x26;token=85eee83d-9971-4469-9bcd-61a43626d0fb" alt="" data-size="line">) next to the database name:

<table data-header-hidden><thead><tr><th width="189.99993896484375">Option</th><th>Description</th></tr></thead><tbody><tr><td><strong>Edit</strong></td><td>Update the database name or settings.</td></tr><tr><td><strong>Update Short Term Retention</strong></td><td>Configure the backup retention period for the database.</td></tr><tr><td><strong>Delete</strong></td><td>Remove the database from the server.</td></tr></tbody></table>

{% hint style="info" %}
The `master` database is managed by Azure and cannot be edited or deleted.
{% endhint %}

## Adding private endpoints

A private endpoint is a network interface that connects you privately and securely to your MSSQL Server. This ensures that the traffic between your virtual network and the MSSQL database travels entirely without using the public internet.

1. Select the Tenant from the **Tenant** list box.
2. In the DuploCloud Portal, navigate to **Cloud Services** -> **Database** -> **MSSQLServer.**
3. Select the MSSQL Server database from the **NAME** column.
4. Select the **Private Endpoints** tab, and click **Add**. The **Add Private Endpoint** pane displays.<br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FP95drfxJKoa1sYv5XxBw%2Fprivate%20endpoint.png?alt=media&#x26;token=62b61cca-37ec-44a2-beb8-fd90ce489143" alt="" width="375"><figcaption><p>The <strong>Add Private Endpoint</strong> pane</p></figcaption></figure></div>
5. Add a name and select a subnet for your private endpoint.
6. Click **Submit**. The private endpoint is created and accessible via the selected subnet.

## **Configuring** elastic pools

Azure SQL Database Elastic Pools provide cost-effective database resource management by pooling multiple databases together and sharing resources based on their individual needs.

Configure Azure Elastic Pools for an MSSQL Server in the DuploCloud Portal:

1. Select the Tenant from the **Tenant** list box.
2. In the DuploCloud Portal, navigate to **Cloud Services** -> **Database** -> **MSSQLServer.**
3. Select the MSSQL Server database from the **NAME** column.
4. Select the **Elastic Pools** tab, and click **Add**. The **Add SQL Elastic Pool** pane displays.<br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FcxralnvrvExWZT2dRIwk%2FScreenshot%20(705).png?alt=media&#x26;token=b41f62e6-972f-495a-b594-0a2fbd96615a" alt=""><figcaption><p>The <strong>Add SQL Elastic Pool</strong> pane</p></figcaption></figure></div>
5. Enter a name for the elastic pool and configure the SQL Elastic Pool (select your **Service Tier**, **Sku Name**, **Max Storage Size**).
6. Click **Submit**. The elastic pool is created.<br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FikaMnEIv2qiXBGQixNh5%2FScreenshot%20(706).png?alt=media&#x26;token=a1e8a64f-977b-465e-ad92-79a9a7460c1f" alt=""><figcaption></figcaption></figure></div>

## Setting virtual network rules

Virtual network rules restrict access to your MSSQL Server to specific subnets within a virtual network, enhancing security and network isolation. Public access must be enabled to add virtual network rules.

1. Select the Tenant from the **Tenant** list box.
2. In the DuploCloud Portal, navigate to **Cloud Services** -> **Database** -> **MSSQL Server.**
3. Select the MSSQL Server from the **NAME** column.
4. Select the **Virtual Network Rules** tab, and click **Add**. The **Add New Virtual Network Rule** pane displays.
5. Add a name for the virtual network rule, and select the subnet. Click **Create**. The virtual network rule is created.

<div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FHQSKarAvUNEgRKiTAp5U%2FVN%20rule.png?alt=media&#x26;token=cb00c6b8-6d4c-4b28-b728-e78a8950191a" alt=""><figcaption><p><strong>Virtual Network Rule</strong> tab on the <strong>MSSQL Server</strong> page.</p></figcaption></figure></div>

## Setting firewall rules

Firewall rules for an MSSQL Server control access by allowing or denying traffic based on IP addresses. These rules help secure your databases by restricting access to trusted sources. Public access must be enabled to add firewall rules.

1. Select the Tenant from the **Tenant** list box.
2. In the DuploCloud Portal, navigate to **Cloud Services** -> **Database** -> **MSSQL Server.**
3. Select the MSSQL Server database from the **NAME** column.
4. Select the **Firewall Rules** tab, and click **Add**. The **Add New SQL Server Firewall Rule** pane displays.<br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2F0oP4CllTqrs0h1eg46WA%2Ffw%20rules.png?alt=media&#x26;token=307006bf-f434-47f0-9c1b-898c71745794" alt="" width="367"><figcaption><p><strong>Add New SQL Server Firewall Rule</strong> pane</p></figcaption></figure></div>
5. Add a name for the firewall rule, and specify the starting and ending IP addresses that should be allowed to access your MSSQL database.
6. Click **Create**. The firewall rule is added to the server.<br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FxZqLT2NoHKoqnOoEAK2z%2Ffirewall%20rule%20success.png?alt=media&#x26;token=ef4c7b1b-1fdd-43b5-b06d-4dcc803642d6" alt=""><figcaption><p><strong>Firewall Rule</strong> tab on the <strong>MSSQL Server</strong> page.</p></figcaption></figure></div>
