File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
java/com/microsoft/openai/samples/rag/config Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 4
4
import com .azure .core .credential .TokenCredential ;
5
5
import com .azure .identity .AzureCliCredentialBuilder ;
6
6
import com .azure .identity .ManagedIdentityCredentialBuilder ;
7
+ import org .springframework .beans .factory .annotation .Value ;
7
8
import org .springframework .context .annotation .Bean ;
8
9
import org .springframework .context .annotation .Configuration ;
9
10
import org .springframework .context .annotation .Profile ;
11
+ import org .springframework .util .StringUtils ;
10
12
11
13
@ Configuration
12
14
public class AzureAuthenticationConfiguration {
13
15
16
+ @ Value ("${azure.identity.client-id}" )
17
+ String clientId ;
18
+
14
19
@ Profile ("dev" )
15
20
@ Bean
16
21
public TokenCredential localTokenCredential () {
@@ -20,6 +25,10 @@ public TokenCredential localTokenCredential() {
20
25
@ Bean
21
26
@ Profile ("default" )
22
27
public TokenCredential managedIdentityTokenCredential () {
23
- return new ManagedIdentityCredentialBuilder ().build ();
28
+ if (this .clientId .equals ("system-managed-identity" ))
29
+ return new ManagedIdentityCredentialBuilder ().build ();
30
+ else
31
+ return new ManagedIdentityCredentialBuilder ().clientId (this .clientId ).build ();
32
+
24
33
}
25
34
}
Original file line number Diff line number Diff line change @@ -15,4 +15,7 @@ storage-account.service=${AZURE_STORAGE_ACCOUNT}
15
15
blob.container.name =${AZURE_STORAGE_CONTAINER:content}
16
16
17
17
logging.level.com.microsoft.openai.samples.rag.ask.approaches.semantickernel =DEBUG
18
- server.error.include-message =always
18
+ server.error.include-message =always
19
+
20
+ # Support for User Assigned Managed identity
21
+ azure.identity.client-id =${AZURE_CLIENT_ID:system-managed-identity}
You can’t perform that action at this time.
0 commit comments