Advance with Assist: Encrypt Tabcmd Credentials

Data

Advance with Assist: Encrypt Tabcmd Credentials

by Mitchell Scott
//

Advance with Assist shares quick solutions to common challenges encountered by the InterWorks Assist on-demand team.

Question: I need to script tabcmd commands but can’t leave passwords in plaintext inside scripts! How can I script tabcmd commands securely?

The Challenge

Tabcmd requires a username and a password passed to it in order to log into a Tableau Server site. While this is fine for running interactively, it presents security problems when it’s time to make the leap to scripting with tabcmd. It’s poor form to leave plaintext passwords laying around in scripts, so we’ll use some built-in utilities in Microsoft PowerShell to encrypt a password and store it in the filesystem. We’ll then retrieve it and decrypt it in the PowerShell script that contains the tabcmd commands we want to run. This solution is cross-platform and runs just fine on Linux, too (after installing PowerShell on Linux and with some light editing to remove the .exe extension)!

The Solution

  1. Download the attached zip file and extract it.
  2. Edit the tabcmd-playbook.ps1 file in your favorite text editor. I prefer Visual Studio Code, but anything works!
  3. Adjust the values for $serverURL, $siteID, and $tabcmdPath to match your environment.
  4. Add whatever tabcmd commands you wish. Save the file.
  5. The encryption is user-specific. Make sure you’re logged in as the user that will be executing the tabcmd-playbook.ps1 file.
  6. Depending on your system settings, you may need to run the PowerShell cmdlets Unblock-File and/or Set-ExecutionPolicy to allow downloaded scripts to run.
  7. Open PowerShell and run the encrypt-password.ps1 script. It will prompt for a username and password. These will be stored in the same directory the script is in. The username is stored in plaintext, and the password is stored encrypted. This step only needs to be repeated when the user’s password changes.
  8. Execute tabcmd-playbook.ps1 and confirm your tabcmd commands run as expected.
  9. Schedule (or whatever!) the tabcmd-playbook.ps1 script, making sure the Run-As user is the same user you were logged in as when you encrypted the password.

Here’s an example of what it looks like:

Want More Advance with Assist

  1. Advance with Assist: Filtering Select Dates with DATETRUNC
  2. Advance with Assist: Enhancing Dashboards with Custom Icons
  3. Advance with Assist: Tableau Power User Leaving the Company
  4. Advance with Assist: Context Filters and LOD Calculations
  5. Advance with Assist: Custom Subscriptions with Tableau Server Custom Views
  6. Advance with Assist: Blending with Dimension Not Utilized
  7. Advance with Assist: Creating a Sankey Diagram from Survey Data
  8. Advance with Assist: Multiple Dashboard Actions with a Single Click
  9. Advance with Assist: Refreshing Tableau Online Data with Tableau Bridge
  10. Advance with Assist: Parameter Performance Optimization
  11. Advance with Assist: Using Custom Backgrounds with Polygon Shapefiles
  12. Advance with Assist: Changing Default Properties on Data
  13. Advance with Assist: Options for Calculating Percentages
  14. Advance with Assist: Removing Options from Filter List
  15. Advance with Assist: Extracting Year from De-identified Text String
  16. Advance with Assist: Marking the Latest Date on Trend Line
  17. Advance with Assist: What You Need to Know About Aliases
  18. Advance with Assist: Function Compatibility
  19. Advance with Assist: Mass Parameter Replacement
  20. Advance with Assist: Sorting with MONTH in Reverse
  21. Advance with Assist: Ungroup Column Headers That Have Concatenated
  22. Advance with Assist: Connectionless Failure Error in Tableau Server
  23. Advance with Assist: How to Exceed Tableau’s Column or Row Limit
  24. Advance with Assist: Adding Email Links to Your Dashboard
  25. Advance with Assist: Saving User-Selected Filters on Tableau Server
  26. Advance with Assist: Tableau and Named Ranges in Excel
  27. Advance with Assist: Editing Custom Fields in Tableau-Published Data Sources
  28. Advance with Assist: NOW and TODAY Functions in Tableau
  29. Advance with Assist: Sheet Swapping with Dummy Headers
  30. Advance with Assist: REST Error in Tableau and Snowflake Connection
  31. Advance with Assist: Mapping with One Data Row in Tableau 2019.2
  32. Advance with Assist: Multi-Number Formats for Single Calculations
  33. Advance with Assist: Removing Background Landmass on a Tableau Map
  34. Advance with Assist: Filtering Data Sources on Tableau Server
  35. Advance with Assist: Swapping Sheets in Tableau 2019.2
  36. Advance with Assist: Filling in Null Records Without Filtering
  37. Advance with Assist: Nested IF Calculations in Tableau
  38. Advance with Assist: Getting Show/Hide Buttons to Appear in Tableau Desktop
  39. Advance with Assist: Alteryx Output Error
  40. Advance with Assist: Missing Joins in Tableau 2020.2
  41. Advance with Assist: Tableau Server – Interactive MicroService Container Degraded
  42. Advance with Assist: A Shortcut for Duplicating Calculations
  43. Advance with Assist: Tableau Server License Renewal Refresh 
  44. Advance with Assist: Encrypt Tabcmd Credentials
  45. Advance with Assist: Pointing Tableau to a Named Range
  46. Advance with Assist: Tableau Server Migrations
  47. Advance with Assist: Adding ALL Selection to Parameters
  48. Advance with Assist: Uncaught Type Error in Tableau Server
  49. Advance with Assist: Site Roles Changing on Tableau Server
  50. Advance with Assist: Highlighting Points of Interest
  51. Advance with Assist: Finding Max Date and More
  52. Advance with Assist: Adding Field Names Above Bars on a Bar Chart
  53. Advance with Assist: Using Map Layers with Unconnected Data Sources

More About the Author

Mitchell Scott

ServerCare Lead
Advance with Assist: Tableau Server Migrations Question: I need to migrate Tableau Server; what are my options? Should I be using something like Azure Site Recovery or AWS AMIs to ...
Advance with Assist: Encrypt Tabcmd Credentials Question: I need to script tabcmd commands but can’t leave passwords in plaintext inside scripts! How can I script tabcmd ...

See more from this author →

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK

×

Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Germany
Geschäftsführer: Mel Stephenson

Kontaktaufnahme: markus@interworks.eu
Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072

×

Love our blog? You should see our emails. Sign up for our newsletter!