Connecting 3CX to a Microsoft SQL Database & Grafana

Introduction

This guide is for systems running V20 Update 7 and provides a concise process to connect your 3CX phone system to a Microsoft SQL database for use with Grafana for data visualization and reporting.

Prerequisites

  • A running Microsoft SQL Server. On Premise or on Azure
  • Administrative access to your Microsoft SQL Server
  • Access to the 3CX Admin Console
  • A 3CX 16SC+ license (required for Data Connector functionality)

Step 1: Create your SQL Database on Azure or On Premise

Creating an SQL Database on Azure

  1. Login to your Azure Portal Here https://portal.azure.com/
  2. Search and Navigate to SQL Servers and click on Create
  3. Select or create a new resource group
  4. Set a unique Server Name and select a location near your PBX
  5. Select Use SQL Authentication and set your admin login and a strong password
  6. Note down these credentials as you will need them later to configure your Data Connector in 3CX Admin Console.
  7. Click Review + Create and then Create

  1. Navigate to SQL Servers, open the above server you just created and note down the Server Name as you will need it later to configure your Data Connector in 3CX Admin Console.
  2. Click on Create Database

  1. Set a unique database name
  2. Select the specs and size of the database as needed in the Compute and Storage Sections
  3. Click on Review + Create and then Create

  1. Once the Database is created, navigate to SQL Databases and open the above database you just created.
  2. Click on Set Server Firewall

  1. Switch Public network access to Selected Networks and click on Add a firewall rule
  2. Add the Public IP address of your PBX that will be accessing this database and click on Save.

Creating an on Premise SQL Database

  1. Download the on-premises Microsoft SQL Server and run the installer from here: https://www.microsoft.com/en-us/sql-server/sql-server-downloads
  2. Once Installation is successful, proceed to download and install SQL Server Management Studio
  3. Follow the wizard to install and launch SQL Server Management Studio (SSMS)

  1. By default ,Microsoft SQL Server could be listening to no ports or listening on dynamic ports. To use a specific port (eg, 1433 default) go to Windows Start Menu, search and open SQLServerManager16.msc
  2. In the left panel, go to SQL Server Network Configuration → Protocols for SQLEXPRESS
  3. Right-click on TCP/IP and Click Enable
  4. Still in Protocols for SQLEXPRESS:
    Double-click on
    TCP/IP and Go to the IP Addresses tab
  5. Scroll to the bottom and look for the IPAll section
  6. Set TCP Port = 1433 and leave TCP Dynamic Ports empty and click OK
  7. Back in SQL Server Configuration Manager In the left panel, go to SQL Server Services
  8. Right-click your instance(eg MSSQLSERVER) and click Restart

  1. Open SQL Server Management Studio that you installed above
  2. You can connect on localhost as an administrator to the new SQL Server using Windows Authentication as shown below

  1. Once connected to SSMS right right-click on Databases > New Database
  2. Give a unique name to the database and click OK

  1. To enable SQL Server Authentication for the PBX to be able to connect to the database, right-click on your SQL Server on the left panel and click on Properties
  2. Navigate to Security, select the option for SQL Server and Windows Authentication mode and click OK
  3. Once again, restart your SQL Server either from SQL Server Manager as shown above or via the task manager

  1. To create a user for the PBX to connect to this Database, right-click on Logins > New Login
  2. Set your username in Login Name
  3. Select SQL Authentication and set a strong password
  4. Uncheck Enforce password policy if you don’t want complexity rules
  5. Default database: select your new database created above (eg cdr_db)

  1. Still in the same "Login" window Click User Mapping on the left
  2. Select your new database (eg cdr_db)
  3. In the "Database role membership", check the options for

db_datareader, db_datawriter, db_ddladmin

  1. Click OK

Step 2: Configure Data Connector on 3CX

  1. Navigate to 3CX Admin Console > Integrations > Data Connector
  2. Select "Microsoft SQL Server" and enter the following:
  • Host: The IP Address or FQDN (if available) of the Host you installed Microsoft SQL Server on. Or the Server Name given by Azure
  • Port: The database port (default: 1433).
  • Database Name: The name of the database you created on Step 1.
  • Username: The username of the new user you created on Step 1.
  • Password: The password you configured for your new user.
  • Data Types: Choose what data you want to have transferred.
  • Frequency: Set the frequency for data transfer from the PBX to your Azure SQL Database.
  1. Save the configuration and click the "Test" button on your PBX to verify the connection to the Microsoft SQL database and confirm that you receive a success message. If the test fails, double-check the host, port, database name, username, and password. Also, verify that any firewalls allow connections from your PBX IP.

Step 3: Connect Grafana to the Microsoft SQL Database

  1. Log in to your Grafana instance (e.g., grafana.com or your self-hosted Grafana).
  2. Go to the Grafana configuration menu (gear icon) and click "Data Sources" and click "Add data source".
  3. Search for and select "Microsoft SQL Server"

  1. Configure the data source under "Connection", enter the following details:
  • Host: Enter the IP or FQDN and port of your Microsoft SQL Server in the format: IP/FQDN:1433
  • Database: The name of the database you created on Step 1.
  • User: The username of the new user you created on Step 1
  • Password: The password you configured for your new user
  • Authentication Type: SQL Server Authentication

  1. Click "Save & test" and verify that you receive a "Database Connection OK" message. If you encounter errors, double-check the connection details and SSL configuration. Also, verify that any firewalls on the Microsoft SQL host or network allow connections from Grafana IPs.

Last Updated
This document was last updated 02 June 2026
https://www.3cx.com/docs/microsoft-sql-server-configuration/