ThingWorx Model Definition and Composer > Data Storage > Persistence Providers > Using Azure SQL Server as the Persistence Provider > Azure SQL Managed Instance Installation
  
Azure SQL Managed Instance Installation
Database Setup for Managed Instance
Prerequisites
Azure SQL managed instance must be created using Azure Portal. Provision a managed instance by following the steps at https://docs.microsoft.com/en-us/azure/sql-database/sql-database-managed-instance-get-started
* 
Do not create the managed instance admin name as twadmin since ThingWorx uses that user name.
Setting up ThingWorx Database and Schema for Managed Instance
1. Create twadmin User after completing the prerequisites setup linked above:
CREATE LOGIN twadmin WITH PASSWORD=[password]
* 
Your password must be at least 16 characters in length. Your password must contain characters from three of the following categories – English uppercase letters, English lowercase letters, numbers (0-9), and non-alphanumeric characters (!, $, #, %, etc.).
2. Run the following script to create ThingWorx database in your managed Instance. These scripts are packaged with ThingWorx release artifacts:
Linux:
./thingworxAzureManagedInstanceDBSetup.sh -h [Managed instance name] -d thingworx -a [Managed instance admin login]
Windows:
.\thingworxAzureManagedInstanceDBSetup.ps1 -h [Managed instance name] -d thingworx -a [Managed instance admin login]
3. Run the following script to create ThingWorx model, property, and data schema in your ThingWorx database created in above step:
Linux:
./thingworxAzureManagedInstanceSchemaSetup.sh -h [Managed instance name] -d thingworx -l twadmin
Windows:
.\thingworxAzureManagedInstanceSchemaSetup.ps1 -h [Managed instance name] -d thingworx -l twadmin
Executing the Database Cleanup Script for Managed Instance
Run the following script to drop ThingWorx database:
Linux:
./thingworxAzureManagedInstanceDBCleanup.sh -h [Managed instance name] -d thingworx -a [Managed instance admin login]
Windows:
.\thingworxAzureManagedInstanceDBCleanup.ps1 -h [Managed instance name] -d thingworx -a [Managed instance admin login]
For next steps, go to Configuring ThingWorx with Azure SQL.