Install the PI AF SQL Server database
- Last UpdatedNov 13, 2025
- 6 minute read
- PI System
- PI Server 2024 R2
- PI Server
Before you begin the installation, make sure to complete the following tasks:
-
Review the pre-installation tasks for the chosen cloud database platform in or an on-premises PI AF SQL Server database creation in Pre-installation requirements for PI AF.
-
Download the PI Server install kit onto the PI AF SQL Server computer, as described in Download the PI Server install kit.
-
The PI Server install kit checks for the presence of the .NET 4.8 framework, but will not continue if .NET 4.8 is not installed. See Manual creation of the PI AF SQL Server database.
-
Ensure that you have sysadmin privileges to install the PI AF SQL Server database on the SQL server if an SQL administrator is not available.
-
Ensure that the required network ports are open. See List of port requirements for PI AF Server.
Follow these steps to install the PI AF cloud-hosted database or on-premises SQL Server database.
-
Navigate to and double-click the PI Server install kit executable to begin the installation.
The Welcome page opens.
-
Select Next.
The Feature Selection page opens.
-
Select the Individual Features tab.
The Individual Features tab opens.
-
Under AF Server, select AF SQL database scripts and AF SQL script execution.
These selections will install and run the AF SQL scripts on the SQL Server computer or cloud database platform, and create the PI AF SQL Server database.
-
Click Next.
The Feature Rules window appears.
-
Review the warning message regarding the selected features, then select Next.
The SQL Server Connection window opens.
-
Optional steps if using Azure SQL Database or Azure Managed Instance: Follow the steps in this table to set up the PI AF SQL database on Microsoft Azure.
If you want to...
Perform these steps...
Recommended method:
Use the PI Server install kit as a managed identity to run the SQL Scripts against an empty Azure AF SQL database.
Prerequisite: Ensure that the managed identity has 'db_owner' privileges on the existing AF SQL database. If db_owner privileges have not been granted, run the following command to grant the required permissions:
CREATE USER <ManagedIdentityName> FROM EXTERNAL PROVIDER; ALTER ROLE db_owner ADD MEMBER <ManagedIdentityName>;
Note: The name of the system-assigned service principal is always the same name as the Azure resource it's created for. See Managed Identity Types.
-
In the Server name text box, enter the URL address of the Azure SQL database you created on the Azure portal.
-
Select Microsoft Entra Managed Identity from the Authentication dropdown list.
-
Take one of the following actions:
-
If using a user-assigned managed identity, enter the client ID in the text box. This value is a GUID.
-
If using a system-assigned managed identity, leave the text box blank
-
-
Skip to step 10.
After installation: After installation, revoke the db_owner privilege from the managed identity by running the following command:
ALTER ROLE db_owner DROP MEMBER <ManagedIdentityName>;
Use the PI Server install kit as a managed identity to run the SQL scripts and create the Azure SQL database.
Prerequisite: Ensure that the managed identity is assigned to one of the following roles:
-
The Microsoft Entra Admin role on the Azure SQL Database OR
-
The dbmanager database role on the primary database
-
In the Server name text box, enter the address of the database you created on the Microsoft Azure portal.
-
Select Microsoft Entra Managed Identity from the Authentication dropdown list.
-
Take one of the following actions:
-
If using a user-assigned managed identity, enter the client ID in the User assigned identity text box.
Note: The client ID is not the same as the managed identity name.
-
If using a system-assigned managed identity, leave the User assigned identity text box blank.
-
Skip to step 10.
After installation,revoke the dbmanager and/or Microsoft Entra Admin role(s) from the managed identity.
Note: For Microsoft Azure cloud database platforms, the authentication method can also be set in the GO.bat batch file if you want to create the PI AF database manually. See Set the authentication method in GO.bat for Microsoft Azure.
-
-
Optional steps if using Amazon RDS for SQL Server: Provide information about the Amazon RDS database where the PI AF SQL database will be created.
-
In the Server name text box, enter the URL address of the Amazon RDS database you created on the AWS portal.
-
Select Windows Authentication from the Authentication dropdown list, then skip to step 10.
-
-
Optional for on-prem versions of SQL Server: Provide information about your on-prem version of SQL Server to create the PI AF SQL database.
Note: Ensure there is enough disk space on the host computer to back up your PI AF SQL Server database.
If you want to...
Take one of these actions...
Choose the default instance or a named instance of SQL Server on the local computer.
-
Accept the default instance shown in the list under SQL Server Connection.
-
Select a different named instance from the list under SQL Server Connection.
-
Provide identifying information for SQL Server using one of the following formats:
-
Server Name
-
Server Name\Named Instance
-
.\Named Instance
Providing a named instance is not necessary if you are specifying the default SQL Server instance.
-
Specify SQL Server or a named instance of SQL Server on a remote computer.
Provide identifying information for SQL Server using this format:
Server Name[\Named Instance]
Providing a named instance is not necessary if you are specifying the default SQL Server instance.
Specify SQL Express on the local computer.
Provide identifying information for SQL Server using one of the following formats:
-
Server Name\SQLEXPRESS
-
.\SQLEXPRESS
Specify SQL Express on a remote computer.
Provide identifying information for SQL Server using this format:
Server Name\SQLEXPRESS
-
-
Click Next to proceed with the setup.
A check is performed to see if your user account has the required permissions on the SQL Server or cloud database platform and if a PI AF SQL Server database already exists. See SQL Server roles and permissions for PI AF.
-
Optional: If the installation detects an existing PI AF SQL Server database, the SQL Server Rules page opens. By default, the option to back up the existing PI AF SQL Server database and execute the AF SQL scripts is selected. Select Next to proceed with the default selection.
The Remote AF Server page opens.
-
Optional: Enter the computer name where the remote AF Server will be installed.
-
Optional: Specify the Active Directory accounts to add to the AFServers group and AFQueryEngines group.
The accounts added in these groups have access to the PI AF SQL Server database. The PI AF application service requires different permissions in the database, which is why there are two separate groups.
Note: Specify the Active Directory computer account corresponding to the domain or virtual account. This account is different than the accounts that are specified under the Service Accounts window, which specify the domain or virtual account used to run PI AF application service.
-
If you want to specify different accounts for the AFServers (PI AF application service) and AFQueryEngines groups, select Specify different accounts for the AFServers and AFQueryEngines group.
-
If the PI AF application service will run under a domain account, enter the domain and account name.
-
If you plan to run the PI AF application service under the default virtual account, enter the Active Directory account in the form DOMAIN\ComputerName. Virtual accounts connect as an Active Directory account corresponding to the computer on which they are running.
-
If you plan to run either of the services under a different account, specify the Active Directory account in the form DOMAIN\AccountName.
-
If the PI AF application service will run under a local account or you are unsure of the account you will use, leave the field blank and update the AFServers group with the appropriate membership after the installation is complete.
-
-
Select Next.
If you did not specify a remote system or domain account for the PI AF application service, the Remote AF Rules page opens.
-
Optional: Select "I will manually enter the appropriate account to the AFServers group on this computer.", then select Next.
-
Select Next.
The Summary window appears with a list of the selected features and versions selected for the installation.
-
Select Install to install the PI AF SQL scripts and create the PI AF SQL Server database.
The Installation Progress window opens.
The Complete window opens when the installation is complete.
You are now ready to install the PI AF application service (see Install the PI AF application service).