TPC-Council / HammerDB

HammerDB Database Load Testing and Benchmarking Tool
http://www.hammerdb.com
GNU General Public License v3.0
542 stars 115 forks source link

Add support for Microsoft Entra authentication for SQL Server #665

Closed sm-shaw closed 4 months ago

sm-shaw commented 4 months ago

Adds support for Microsoft Entra authentication for SQL Server workloads as discussed in Issue https://github.com/TPC-Council/HammerDB/issues/662

Note that as discussed in the issue, I have not tested this directly and have no means to do so, so fully reliant on feedback to verify that the correct functionality has been added. Windows and SQL authentication have been re-tested to make sure the added functionality does not impact the existing ones.

One question that is worth verifying is what happens when using interactive authentication if we have multiple virtual users? We can have hundreds or thousands (with asynchronous connections) - will all virtual users produce an interactive prompt?

To test, it is recommended to build from source on windows. This is very easy and just takes 1 command to build. Firstly, make sure you have visual studio 2022 installed.

Then download the zip file from here https://github.com/sm-shaw/HammerDB/tree/662 under the code tab.

Extract this into a directory of your choice and if you only want to test SQL Server edit the setup file as shown:

C:\HammerDB-662\HammerDB-662\Build\Bawt-2.1.0\Setup

edit HammerDB-Windows.bawt to comment out unneeded database interfaces

# Compiled Tcl Database interface packages.
#Setup oratcl            oratcl-4.6.7z                  oratcl_NMake.bawt   
#Setup mariatcl          mariatcl-0.1.7z                mariatcl_NMake.bawt
#Setup mysqltcl          mysqltcl-3.052.7z              mysqltcl_NMake.bawt
#Setup pgtcl             pgtcl-2.1.1.7z                 pgtcl_NMake.bawt    
#Setup db2tcl            db2tcl-2.0.1.7z                db2tcl_NMake.bawt

Then cd to the Bawt directory with a command prompt

cd C:\HammerDB-662\HammerDB-662\Build\Bawt-2.1.0

Set your python directory (or comment this out as well in the setup file) set PYTHONHOME=C:\Users\UserName\AppData\Local\Programs\Python\Python310

and then run the build

Build-Windows.bat x64 vs2022+gcc Setup\HammerDB-Windows.bawt update

Note that compilation time on Windows is impacted a lot by Windows defender and temporarily turning off realtime protection will improve the compile time.

When complete the GUI will show that all packages built successfully.

bawt1

Then a zip file (and directory) with the latest build for testing will be in this directory.

C:\HammerDB-662\HammerDB-662\Build\BawtBuild\vs2022\x64\Release\Distribution

dimitri-furman commented 4 months ago

I'll try to find some time to test this in coming days.

Multiple virtual users with interactive auth should work because the ODBC driver should cache the auth token, but of course we need to test.

abondvt89 commented 4 months ago

Merging after reviews and approval of the three members of the code maintenance team.