Skip to content

Commit fa57654

Browse files
committed
Update ManagedIdentityCredential to use UAMI for containerapps
1 parent 5682b67 commit fa57654

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/backend/app.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ async def setup_clients():
419419
AZURE_ENABLE_UNAUTHENTICATED_ACCESS = os.getenv("AZURE_ENABLE_UNAUTHENTICATED_ACCESS", "").lower() == "true"
420420
AZURE_SERVER_APP_ID = os.getenv("AZURE_SERVER_APP_ID")
421421
AZURE_SERVER_APP_SECRET = os.getenv("AZURE_SERVER_APP_SECRET")
422+
AZURE_CLIENT_ID = os.getenv("AZURE_CLIENT_ID")
422423
AZURE_CLIENT_APP_ID = os.getenv("AZURE_CLIENT_APP_ID")
423424
AZURE_AUTH_TENANT_ID = os.getenv("AZURE_AUTH_TENANT_ID", AZURE_TENANT_ID)
424425

@@ -449,7 +450,11 @@ async def setup_clients():
449450
azure_credential: Union[AzureDeveloperCliCredential, ManagedIdentityCredential]
450451
if RUNNING_ON_AZURE:
451452
current_app.logger.info("Setting up Azure credential using ManagedIdentityCredential")
452-
azure_credential = ManagedIdentityCredential()
453+
azure_credential = (
454+
ManagedIdentityCredential()
455+
if AZURE_CLIENT_ID is None
456+
else ManagedIdentityCredential(client_id=AZURE_CLIENT_ID)
457+
)
453458
elif AZURE_TENANT_ID:
454459
current_app.logger.info(
455460
"Setting up Azure credential using AzureDeveloperCliCredential with tenant_id %s", AZURE_TENANT_ID

0 commit comments

Comments
 (0)