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
* 
The following expected warning displays when executing the script: Warning! The maximum key length for a clustered index is 900 bytes. The index 'data_table_indexes_pkey' has maximum length of 902 bytes. For some combination of large values, the insert/update operation will fail.
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]
Was this helpful?