# Script Library

## Prerequisites

* Ensure that you have registered your cloud subscription in the **Subscriptions** application under the **Governance** app family.\
  For more information on cloud subscriptions, see [Subscriptions](https://docs.tessell.com/tessell/governance/subscriptions).
* Ensure that you have created your SQL Server-compatible scripts before uploading.

***

## Introduction

Masking scripts are used to mask or alter, one or more columns within a database table. These scripts can be designed and developed for use in the Availability Machines app. For example, you can create a script called MASK\_1 to mask column X in database table Y. This script can then be used to create masked backups of a database for development or QA purposes.

Pre-scripts and post-scripts are used in database operations like clone refreshes, or to prepare and restore the service.

Scripts are not limited to a single DB service — after creation, they can be used across multiple services.

By default, the application is accessible to the Data Owner role. A script created by one Data Owner is not accessible to another unless explicitly shared.

Tessell supports the following script types for SQL Server:

* **Masking** — Supports `.sql` and `.ps1`.
* **Pre-script** — Supports `.ps1` only.
* **Post-script** — Supports `.sql` and `.ps1`.

Each script, regardless of type, must be uploaded as a single file.

***

## Script Library dashboard

On the left navigation bar of the Tessell portal, select **Script Library** under **DB Services** to view the Script Library dashboard. You can filter the list by subscription, script type, status, and owner.

Dashboard filters have the following fields:

* **Search** — To find a specific script, specify the name in the search bar. The list filters automatically as you type.
* **Subscriptions** — Select a cloud subscription from the dropdown. By default, all subscriptions are displayed.
* **Script Type** — Select a script type from the dropdown. Available options are All, Masking, Pre-Script, and Post-Script.
* **Status** — Select a status from the dropdown. Available options are All or Enabled.
* **Owner** — Select a username to view scripts specific to that user. By default, all scripts shared with you are listed.
* **Clear** — Select this to clear all filters and revert to default settings.

### Upload script

1. Click **Upload Script** in the top-right corner.\
   The **Upload script** dialog box opens.
2. Specify a name in the **Name** field.
3. *(Optional)* Specify a description in the **Description** field.
4. Select **SQL Server** from the engine list.
5. Select a script type from the **Script Type** dropdown.
6. Click **Select File** to upload the script file from your local folder.
   * Only one file can be uploaded.
   * Maximum file size: 1 MiB.
7. Select the applicable subscriptions from the **Subscriptions** dropdown.
8. Click **Save**.

As an alternative method, use the code to upload a script.

1. Use the Code button at the top-right corner to view the ‘Code for uploading a new script’ window.
2. On the left-hand side of the window, you can view the API, its type and the payload.
3. On the right-hand side of the window, you can view the code for uploading a script in various languages like Shell, Python, Go, Java, JavaScript, and PowerShell that you can run independently.
4. You can copy and download the code using respective buttons.
5. Use the Close button to return to the main window.

The Script Library tab displays the following columns:

* **Script Name** — The name of the uploaded script. Hover over a name to view its description in a tooltip.
* **Script Type** — The type of script: Masking, Pre-Script, or Post-Script.
* **Subscriptions** — The subscriptions associated with the script. Account owners can view all scripts as they have access to all subscriptions.
* **Status** — Scripts have Enabled status by default.
* **Active Version** — The currently selected version of the script.
* **Created On** — The date and time the script was uploaded.
* **Created By** — The username that uploaded the script.
* **Ellipsis icon** — Options to update or delete a script:
  * **Update** — Modify the script name, description, active version, or subscriptions.
    * Subscriptions not used in any schedules, services, or clones can be removed directly.
    * Subscriptions in use must be removed from all associated schedules, services, or clones before they can be removed from the script.
  * **Delete** — Opens a confirmation dialog. Select the checkbox to confirm, then click **Delete**.

**Figure 1 - Script Library dashboard**

![](/files/7UPOG7azn66VTwBZVs9X)

***

## Script Library home page

Selecting a script from the dashboard opens its home page, which has two tabs: **Versions** and **Sharing**.

### Versions

Use the **Search** bar to find a specific version from the list.

**Upload new version**

1. Click **Upload new version**.\
   The **Upload a new version** dialog box opens.
2. Specify a version name in the **Name** field.
3. *(Optional)* Specify a description.
4. Click **Select File** to upload the version file from your local folder.
5. Click **Save**.

The Versions table displays the following columns:

* **Name** — The version name.
* **Version** — The version number.
* **File Name** — The script file name and extension.
* **Created On** — The date and time the version was uploaded.
* **Ellipsis icon** — Options to download or delete a version:
  * **Download** — Downloads the script version file to your local folder.
  * **Delete** — Opens a confirmation dialog. Select the checkbox to confirm, then click **Delete**.

    > **Note:** You cannot delete the active version. Set a different version as active before deleting the current one.

### Sharing

The Sharing tab allows you to share scripts with other users. A Data Owner can view only scripts created by or shared with them. A Data Owner with admin access to the DB Services app can view scripts associated with their accessible subscriptions.

Use the **Search** bar to find users by name.

**Share**

1. Click **Share** in the top-right corner.\
   The **Add users to your script** dialog box opens.
2. Select a role from the **Role** dropdown. Available options are Co-owner and Read-only.
3. Use the **Search** bar to find specific users.
4. Select users from the **Choices** column and move them to the **Chosen** column.\
   All personas except Account Owners without DB Admin access appear in the **Choices** column.

   > **Note:** Users and roles are managed in the **IAM** application under the **Governance** app family.
5. Click **Save**.

The Sharing tab displays the following columns:

* **User** — The usernames with whom the script is shared.
* **Role** — The assigned role: Co-owner or Read-only.

**Figure 2 - Script Library home page**

![](/files/6dFNLsp3AeNcer37WwK7)

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tessell.com/tessell/tessell-for-sqlserver/db-services/script_library_sqlserver.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
