Skip to content

feat(inputs.sqlserver): Support Azure federated token from env variables#18234

Open
kauanmodolo wants to merge 1 commit intoinfluxdata:masterfrom
kauanmodolo:feat/azure-federated-token-file
Open

feat(inputs.sqlserver): Support Azure federated token from env variables#18234
kauanmodolo wants to merge 1 commit intoinfluxdata:masterfrom
kauanmodolo:feat/azure-federated-token-file

Conversation

@kauanmodolo
Copy link

@kauanmodolo kauanmodolo commented Jan 19, 2026

Summary

This change introduces first-class support for Azure federated workload identity in the SQL Server input. When the environment exposes AZURE_CLIENT_ID, AZURE_TENANT_ID, and AZURE_FEDERATED_TOKEN_FILE, the plugin now reads the JWT assertion file, exchanges it against [https://login.microsoftonline.com/<tenant>/oauth2/v2.0/token](https://login.microsoftonline.com/%3Ctenant%3E/oauth2/v2.0/token%60) for the [https://database.windows.net/.default](https://database.windows.net/.default%60) scope, and delivers the resulting access token to the driver. This flow mirrors the documented curl exchange from Microsoft, meaning clusters that rely on Kubernetes workload identities (or other OIDC federations) no longer need managed identities or client secrets. If the variables are absent, the plugin seamlessly falls back to the existing Azure Identity / ADAL logic, so no behavioral change occurs for prior configurations.

The implementation carefully surfaces detailed error messages when the assertion file cannot be read, the HTTPS call fails, or the OAuth response doesn't contain an access token. This ensures operators can diagnose configuration issues quickly. By front-loading the federated path, we enable Telegraf to participate in modern secretless deployments that use short-lived tokens issued by federated identity providers.

Checklist

Related issues

resolves #15404

@telegraf-tiger
Copy link
Contributor

Thanks so much for the pull request!
🤝 ✒️ Just a reminder that the CLA has not yet been signed, and we'll need it before merging. Please sign the CLA when you get a chance, then post a comment here saying !signed-cla

@kauanmodolo kauanmodolo changed the title feat(inputs.sqlserver):support Azure federated token from env variables feat(inputs.sqlserver): Support Azure federated token from env variables Jan 19, 2026
@telegraf-tiger telegraf-tiger bot added area/sqlserver feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Jan 19, 2026
@kauanmodolo kauanmodolo force-pushed the feat/azure-federated-token-file branch from f19991d to 76f981f Compare January 19, 2026 19:22
@kauanmodolo
Copy link
Author

!signed-cla

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution @kauanmodolo! It seems like you "hand-crafted" this and I wonder if you can't use the functionality of the Azure SDK instead. This would add the benefit that we don't need to maintain the URLs etc if Microsoft decides to change something.

@srebhan srebhan self-assigned this Jan 28, 2026
@luizfelmach
Copy link

Thanks for your contribution @kauanmodolo! It seems like you "hand-crafted" this and I wonder if you can't use the functionality of the Azure SDK instead. This would add the benefit that we don't need to maintain the URLs etc if Microsoft decides to change something.

Using the https://github.com/Azure/azure-sdk-for-go/blob/sdk/azidentity/v1.13.1/sdk/azidentity/client_secret_credential.go#L47 looks the better approach.

@srebhan
Copy link
Member

srebhan commented Feb 10, 2026

@kauanmodolo any update?

@srebhan srebhan added the waiting for response waiting for response from contributor label Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/sqlserver feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins waiting for response waiting for response from contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQL Server AAD Azure Auth method doesn't work if multiple User assigned identies are existing.

3 participants