Automation with PowerShell
Published 25 September 2019
SQL Data Catalog is an API-driven product. Everything that can be done through the Web interface can also be done through the API.
The product comes bundled with some helpful PowerShell scripts to accelerate your classification project. The scripts talk directly to the API, allowing for advanced filtering and bulk classification.
Getting an authorization token
The PowerShell script will need an auth token to authenticate with the API. See Generating an authorization token for more details.
Importing the PowerShell module
Run the following PowerShell commands to download and import the module, replacing $server
and $authToken
with the relevant values.
$server="http://spiders-mosaic0:15156" $authToken="NjE5MTA5MDAzNzIwMzkyNzA0Ojk4YTUyYjY4LTRiMDYtNDJmMi05MmJlLTU2MDU2NzFjNTMzYw==" Invoke-WebRequest -Uri "$server/powershell" -OutFile 'data-catalog.psm1' -Headers @{"Authorization"="Bearer $authToken"} Import-Module .\data-catalog.psm1 -Force
The PowerShell module should be re-downloaded every time you use the product, in order to maintain compatibility with the latest installed version.
If your computer is not configured to execute scripts, you may receive an error when you try to import the module. In this case, you can temporarily change your script execution policy using the following, and then try again:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process -Force
The required PowerShell version is 5.1 or higher.
You may also find helpful examples and cmdlet references
If you want to work with the API directly, without the use of PowerShell scripts provided, you may find Exploring the REST API helpful.