From 11400971ac16db640827292d9437ec718384eb77 Mon Sep 17 00:00:00 2001 From: Mouhsin Elmajdouby Date: Thu, 18 Jun 2026 12:03:42 +0100 Subject: [PATCH] Add optional tenantId to Azure interactive auth --- ojdbc-provider-azure/README.md | 15 +++++++++------ .../authentication/TokenCredentialFactory.java | 6 +++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ojdbc-provider-azure/README.md b/ojdbc-provider-azure/README.md index 66551430..63393044 100644 --- a/ojdbc-provider-azure/README.md +++ b/ojdbc-provider-azure/README.md @@ -219,11 +219,13 @@ The user can provide an optional parameter `AUTHENTICATION` (case-ignored) which AZURE_CLIENT_ID (only required for user assigned) - AZURE_INTERACTIVE - InteractiveBrowserCredential - AZURE_CLIENT_ID - AZURE_REDIRECT_URL + AZURE_INTERACTIVE + InteractiveBrowserCredential +   + AZURE_TENANT_ID + AZURE_CLIENT_ID + AZURE_REDIRECT_URL @@ -732,7 +734,7 @@ common set of parameters. Redirect URL - for authentication-method=interactive + for authenticationMethod=interactive A URL of the form http://localhost[:port-number] is accepted. @@ -813,7 +815,8 @@ A browser link is output to the standard output stream.
interactive
Authenticate interactively by logging in to a cloud account with your -default web browser. The browser window is opened automatically. +default web browser. The browser window is opened automatically. The optional +tenantId parameter may be configured to target a specific tenant.
auto-detect
diff --git a/ojdbc-provider-azure/src/main/java/oracle/jdbc/provider/azure/authentication/TokenCredentialFactory.java b/ojdbc-provider-azure/src/main/java/oracle/jdbc/provider/azure/authentication/TokenCredentialFactory.java index 4d226aac..ac634daa 100644 --- a/ojdbc-provider-azure/src/main/java/oracle/jdbc/provider/azure/authentication/TokenCredentialFactory.java +++ b/ojdbc-provider-azure/src/main/java/oracle/jdbc/provider/azure/authentication/TokenCredentialFactory.java @@ -202,15 +202,15 @@ private static TokenCredential defaultCredentials(ParameterSet parameterSet) { /** * Returns credentials for interactive authentication in a web browser. - * @param parameterSet Configures the request with a client ID (optional), and - * redirect URL (required). + * @param parameterSet Configures the request with optional tenant ID, client ID, + * and redirect URL. * @return Credentials for interactive authentication - * //throws //TODO: What does this throw? */ private static InteractiveBrowserCredential interactiveCredentials( ParameterSet parameterSet) { return new InteractiveBrowserCredentialBuilder() .clientId(parameterSet.getOptional(CLIENT_ID)) + .tenantId(parameterSet.getOptional(TENANT_ID)) .redirectUrl(parameterSet.getOptional(REDIRECT_URL)) .build(); }