Skip to content

Conversation

@jahnvi480
Copy link
Contributor

@jahnvi480 jahnvi480 commented Jul 11, 2025

ADO Work Item Reference

AB#37927


Summary

This pull request refactors the add_driver_name_to_app_parameter function in mssql_python/helpers.py to improve readability, modularity, and support for additional authentication types. Key changes include consolidating authentication handling logic, introducing a unified auth_type variable, and refining parameter filtering and token generation for different Azure Active Directory (AAD) authentication methods.

Refactoring and code simplification:

  • Replaced multiple boolean flags (has_aad_interactive, has_aad_device_code) with a single auth_type variable to track the authentication type, improving code clarity and reducing redundant logic.
  • Simplified parameter filtering by using a unified list of keys (exclude_keys) to exclude sensitive parameters during AAD authentication.

Enhanced support for AAD authentication:

  • Added support for ActiveDirectoryDefault authentication by introducing a new case in the auth_type handling logic and using DefaultAzureCredential for token generation.
  • Refactored token generation for ActiveDirectoryDeviceCode and ActiveDirectoryInteractive authentication to ensure consistent handling and modularity.

Other improvements:

  • Updated the logic to append the APP=MSSQL-Python parameter more consistently when the APP key is not found. (F

@github-actions github-actions bot added the pr-size: small Minimal code update label Jul 11, 2025
@github-actions github-actions bot added pr-size: small Minimal code update and removed pr-size: small Minimal code update labels Jul 11, 2025
@github-actions github-actions bot added pr-size: small Minimal code update and removed pr-size: small Minimal code update labels Jul 11, 2025
@jahnvi480
Copy link
Contributor Author

Added a new PR with required changes #135

@jahnvi480 jahnvi480 closed this Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-size: small Minimal code update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants