Script Based Install Guide: Azure SQL Server for RED 8
This is a guide to installing the WhereScape Enablement Pack for Azure SQL Server for WhereScape RED 8.6.6.1 or higher
Prerequisites
Before you begin the following prerequisites must be met:
- A supported* version of SQL Server or Azure SQL with
- A database to house the RED Metadata Repository
- (optionally) a database for the Range Table DB
- ODBC DSN's created for these DB's
- RED Metadata Repository Database permissions- SELECT, INSERT, UPDATE, and EXECUTE – Optional
- Note: The above permissions are for Scheduler installation, this can be done manually later.
- Access to an Azure SQL Server (Target Environment), with the following connectivity information:
- Server Name
- Database Name
- User Name
- Password
- At least one schema available to use as a RED Data Warehouse Target
- Connection String to connect to Azure SQL Server
- e.g Server=tcp:<server>,<port>;Database=<database>;User ID=$USERNAME$;Password=$PASSWORD$;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;
- Azure SQL Server software installed
- Azure SQL Server ODBC driver (64-bit)
- Add ODBC DSN for Azure SQL Server Target Database
- .Net Framework 4.8 or higher
- bcp Utility installed and enabled
- Windows Powershell version 5 or higher
- Note: make sure this is done using a 64-bit powershell terminal
- Azure SQL Server ODBC driver (64-bit)
- WhereScape RED version 8.6.6.1 or higher
- Must be pre-installed with valid license key entered and EULA accepted
- Python 3.8 or higher- For File Parser
- Select Add Python 3.x to PATH from the installation Window
- Pip Manager Install with the command:
python -m pip install --upgrade pip
- WhereScape Enablement Pack for Azure SQL Server version 8.6.6.1 or higher
- Downloaded and unpacked to a local temp folder
- Install Azure Storage Package
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 Install-Module -Name AzureRM Install-Module -Name Az.Storage -Force -AllowClobber
RED supports the following versions for the metadata repository: MS SQL SERVER 2012 to 2019 and Azure SQL DB
Enablement Pack Setup Scripts
The Enablement Pack Install process is entirely driven by scripts. The below table outlines these scripts, their purpose, and if Run as Administrator is required.
# | Enablement Pack Setup Scripts | Script Purpose | Run as Admin | Intended Application |
1 | Setup_Enablement_Pack.ps1 | Setup and configure a RED Metadata Repository for Azure SQL | Yes | New and Existing installations |
2 | install_WslPowershell_Modules.bat | Installs or updates WslPowershell Modules on this machine | Yes | New and Existing installations |
3 | install_WslPython_Modules.bat | Installs or updates WslPython Modules and required Python libraries on this machine | Yes | New and Existing installations |
4 | import_powershell_templates.ps1 | Imports or updates the Powershell Templates to a RED Metadata Repository. Also includes any Script or Procedure Imports | No* | Existing installations |
5 | set_default_templates.ps1 | Applies the RED Connection defaults in a RED Metadata Repository for Python or Powershell templates | No* | Existing installations |
Note that on some systems executing Windows Powershell scripts is disabled by default, see troubleshooting for workarounds
Each Powershell script in the list above provides some help at the command line, this can be output by passing the -help
parameter to the script.For Example > .\Setup_Enablement_Pack.ps1 -help
Step-By-Step Guide
Setup and configure a new RED Metadata Repository for Azure SQL/SQL Server
Run Powershell as Administrator:
Script 1 > Powershell -ExecutionPolicy Bypass -File .\Setup_Enablement_Pack.ps1
Install or Update WhereScape Powershell Modules
Run Script As Administrator
Script 2 > install_WslPowershell_Modules.bat
Install or Update WhereScape Python Modules
Run Script As Administrator
Script 3 > install_WslPython_Modules.bat
There are two steps in this script:
1. Install the WhereScape WslPython modules to C:\Program Data\WhereScape\Modules\
2. PIP to download/update required Python libraries - for offline install please see the required library list for Python in the Troubleshooting section.
Install or Update WhereScape Powershell Templates (For Existing Installations)
Run Script as Administrator
Script 2 > install_WslPowershell_Modules.bat Script 4 > import_powershell_templates.ps1 Script 5 > set_default_templates.ps1
Note: Skip this step for new installations.
Set Connection defaults for a Template Set (For Existing Installations)
Script 5 > set_default_templates.ps1
The upgrade will not overwrite the existing Data Type Mappings or UI configs. The user either needs to manually delete them or use startAtstep to continue the script execution.
Important Upgrade Notes
If RED repository exists, it will prompt to upgrade the repository. This enablement pack will overwrite any existing Source Enablement Pack UI Configs:
Amazon S3 | Load From Amazon S3 |
Azure Data Lake Storage Gen2 | Load From Azure Data Lake Storage Gen2 |
Google Cloud | Load From Google Cloud |
To ensure existing Source Enablement Pack connections and associated Load Tables continue to browse and load:
Go into UI Configuration Maintenance in RED before installing this Enablement Pack and rename the affected UI Configurations. While the updated Load Template will work with previous Source Enablement Pack we recommend moving these previous versions of Load Tables to newly created Parser-based connections following this install. The earlier versions of the Source Enablement Pack will be deprecated following this release.
Post Install Steps - Optional
Configure Connections
There were two connections added that will optionally require your attention:
- Connection: 'Database Source System' - this connection was set up as an example source connection,
- open it's properties and set it up for a source DB in your environment
- or you can remove it if not required
- Target Connection Extended Property - SERVER_NAME
- Add a complete server name for Azure SQL server or SQL Server instance.
- Target Connection Extended Property - BCP_AUTH_METHOD
- -T for trusted Connections
- -G for Azure Active Directory authentication
- Default blank
- Target Connection Extended Property - Blob Storage Account
- Target Connection Extended Property - Blob Storage Access Key
- Target Connection Extended Property - Blob Storage Container
- Target Connection Extended Property - Blob Data Source
- Add exact record terminators for the files from the Windows source connection, please note \r\n and \n are considered as different record terminators. NOTE: For record terminator '\n' use hexadecimal notation'0x0A'
- For SQL Server Named Target, add exact record terminators for the files from SQL source connection in the extended property UNLOAD_RECORD_CHAR, please update the default to \r\n.
NOTE: For Blob extended properties refer to the below section
Configure Azure SQL Database and Blob Storage
Run the below queries in the Azure SQL database query editor.
CREATE MASTER KEY ENCRYPTION BY PASSWORD = '<MASTER_KEY>';
CREATE DATABASE SCOPED CREDENTIAL <BlobStorageCredential> WITH IDENTITY = 'SHARED ACCESS SIGNATURE', SECRET = '<SAS_TOKEN>';
DROP EXTERNAL DATA SOURCE <Blob Data Source>;
CREATE EXTERNAL DATA SOURCE <Blob Data Source>WITH (TYPE = BLOB_STORAGE,LOCATION = 'https://<Blob Storage Account>.blob.core.windows.net/<Blob Storage Container>/<Directory>',CREDENTIAL = <BlobStorageCredential> );
NOTE: Keywords mentioned in <> in blue need to be replaced with the values that can be found on Azure.
Enable Script Launcher Toolbar
Several stand-alone scripts provide some features, these scripts have been added to the Script Launcher menu but you will need to enable the menu toolbar item to see them.
To enable the Script Launcher menu in RED: Select menu item View->Toolbars->Script Launcher
Source Enablement Pack Support
Source Pack Name | Supported By Azure SQL Server | Supported Features |
Amazon S3 | Yes | Download to local and load using bcp
|
Azure Data Lake Storage Gen2 | Yes | Load file from Azure Data Lake Storage Gen2 bucket to Azure SQL Server
|
Google Drive | No | None |
Google Cloud | Yes | None |
Windows Parser | 1.CSV | Refer to Windows Parser Guide. |
File Types : AVRO,ORC and PARQUET
Load to Azure SQL/SQL Server: If the source file data contains a field delimiter (Default ","(comma)), change it in the source properties of the load table to load data successfully.
Troubleshooting and Tips
Run As Administrator
Press the Windows Key on your keyboard and start typing cmd.exe, when the cmd.exe icon shows up in the search list right click it to bring up the context menu, select Run As Administrator
Now you have an admin prompt navigate to to the folder where you have unpacked your WhereScape Red Enablement Pack using the cd
command:C:\Windows\system32> cd <full path to the unpacked folder>
Run batch (.bat) scripts from the administrator prompt by simply typing the name at the prompt and clicking enter, for example:C:\temp\EnablementPack>install_WslPowershell_Modules.bat
Run Powershell (.ps1) scripts from the administrator prompt by typing the Powershell run script command, for example:C:\temp\EnablementPack>Powershell -ExecutionPolicy Bypass -File .\Setup_Enablement_Pack.ps1
In the event you can not bypass the Powershell execution policy due to group policies you can instead try "-ExecutionPolicy RemoteSigned" which should allow unsigned local scripts.
Windows Powershell Script Execution
On some systems, Windows Powershell script execution is disabled by default. There are several workarounds for this which can be found on the internet by searching the term "Powershell Execution Policy".
Here is the most common workaround that WhereScape suggests, which does not permanently change the execution rights:
Start a Windows CMD prompt as Administrator, change the directory to your script directory, and run the WhereScape Powershell scripts with this command:
cmd:>Powershell -ExecutionPolicy Bypass -File .\<script_file_name.ps1>
Restarting failed scripts
Some setup scripts will track each step and output the step number when there is a failure. To restart from the failed step (or to skip the step) provide the parameter -startAtStep <step number>
to the script.
Example: Powershell -ExecutionPolicy Bypass -File .\<script_file_name.ps1> -startAtStep 123
To avoid having to provide all the parameters again you can copy the full command line with parameters from the first "INFO" message from the beginning of the console output.
If a valid RED installation can not be found
If you have Red 8.6.6.1 or higher installed but the script (Setup_Enablement_Pack) fails to find it on your system then you are most likely running the PowerShell (x86) version which does not show installed 64-bit apps by default. Please open a 64-bit version of PowerShell instead and re-run the script.
Amazon AWS PowerShell command not found
Some systems require a force initialization of AWS modules after installing Amazon S3 PowerShell modules, whereas other systems only require a restart. Run the PowerShell command below as an administrator to initialize Amazon modules.
Import-Module AWS.Tools.Installer
Set-AWSCredentials