---
title: Query the database with read-only SQL access
slug: dxp/docs/read-only-sql-access
createdAt: 2026-10-30T20:00:00.000Z
---

Use read-only SQL access to query the database of a DXP environment with your own SQL tools, without submitting a request to Optimizely Support. You request access from the **Troubleshoot** tab in the PaaS portal. Optimizely opens the database firewall to the IP address you enter for up to four hours.

Optimizely Support no longer handles read-only SQL scripts. You must run read queries yourself with read-only SQL access.

Read-only SQL access supports read operations only. To change data in the database, submit a ticket to *[Optimizely Support](https://support.optimizely.com/hc/en-us/requests/new)*.

:::hint{type="info"}
**Note**
Read-only SQL access is not available for HIPAA projects or for projects where geofencing applies to your location.
:::

## Prerequisites

You need the following to use read-only SQL access:

- An Optimizely cloud account to access the self-services for Optimizely DXP. See [Create an Optimizely Cloud Account](https://docs.optimizely.com/dxp/cms12-docs/create-an-optimizely-cloud-account).
- A CMS 12 or CMS 13 project on DXP.
- A SQL client tool that supports Microsoft Entra ID authentication, such as SQL Server Management Studio.

## Request access

1. Select your project in the PaaS portal.
2. Open the **Troubleshoot** tab.
3. In the **Read-only SQL access** section, select the environment in the **Environment** drop-down list. The list shows only the environments you have access to.
4. Confirm the IP address in the **IP address** field. The field shows your detected IP address. Enter a different address if you connect from another network. Access works only from the address you enter.
5. Click **Request access**.
6. Click **Grant access** in the confirmation window.

![Screenshot of the Read-only SQL access section on the Troubleshoot tab where you select an environment and IP address to request access](../../assets/read-only-sql-access-request-form.png "Screenshot of the Read-only SQL access section on the Troubleshoot tab where you select an environment and IP address to request access")

The request displays in the **Your access** table with the status **Being set up**. When the status changes to **Active**, the table shows the connection details.

## Connect to the database

When your access is **Active**, use the following connection details from the **Your access** table:

- **Server** – The database server address. Click **Copy to clipboard** to copy it.
- **Database** – The name of each database in the environment. You must specify a database name when you connect. Connections without a database name fail.
- **Authentication** – **Microsoft Entra ID**. Sign in with your Microsoft Entra ID account.

![Screenshot of the Your access table where an Active grant shows its expiry time, connection details, and Revoke action](../../assets/read-only-sql-access-your-access.png "Screenshot of the Your access table where an Active grant shows its expiry time, connection details, and Revoke action")

You can run read queries against the database as many times as you need until your access expires.

## Extend or switch access

To keep working after your access expires, extend it before the time in the **Expires (UTC)** column.

1. Select the environment in the **Environment** drop-down list.
2. Enter the IP address in the **IP address** field.
3. Click **Extend access**.
4. Click **Extend access** or **Switch access** in the confirmation window. The confirmation window shows the new expiry time.

The result depends on the IP address you enter:

- **Same IP address** – Optimizely extends your access. Your existing connection is not interrupted.
- **Different IP address** – Optimizely switches your access to the new address. Open connections from the previous address are closed.

## Revoke access

Revoke access when you finish your work.

1. Click **Revoke** for the environment in the **Your access** table.
2. Click **Revoke access** in the confirmation window.

Open connections from the granted IP address are closed. The status shows **Being revoked** until Optimizely removes the access.

If you do not revoke access, Optimizely revokes it automatically shortly after it expires.

## Access status

The **Status** column in the **Your access** table shows one of the following values:

- **Being set up** – Optimizely is setting up your access.
- **Active** – You can connect to the database.
- **Expired** – Your access expired. Optimizely removes it shortly after, so a connection can keep working briefly.
- **Being revoked** – Optimizely is removing your access.
- **Failed** – Optimizely could not set up your access. Click **Try again** to request it again.
- **Revoke failed** – Optimizely could not remove your access, so it can still be usable. Click **Revoke** to try again.
