Skip to content

refactor: update credential retrieval logic based on environment - #1126

Merged
Roopan-Microsoft merged 1 commit into
devfrom
codeql_fix
Aug 6, 2026
Merged

refactor: update credential retrieval logic based on environment#1126
Roopan-Microsoft merged 1 commit into
devfrom
codeql_fix

Conversation

@Akhileswara-Microsoft

Copy link
Copy Markdown
Contributor

Purpose

This pull request updates the logic for obtaining Azure credentials in the image_service.py service to better distinguish between development and production environments. The main change is to select the credential type based on the APP_ENV environment variable, improving local development experience and deployment flexibility.

Credential selection improvements:

  • Updated the _get_credential function in image_service.py to use DefaultAzureCredential with require_envvar=True when APP_ENV is set to dev, and to use ManagedIdentityCredential with the configured client ID otherwise. This ensures that local development uses environment-based credentials, while production uses managed identity.
  • Added an import for the os module to support reading environment variables.

Does this introduce a breaking change?

  • Yes
  • No

Other Information

This pull request updates the logic for obtaining Azure credentials in the image_service.py to better support different environments (development vs. production). The main change is to select the appropriate credential type based on the APP_ENV environment variable.

Credential selection improvements:

  • Modified the _get_credential function to check the APP_ENV environment variable and use DefaultAzureCredential in development environments and ManagedIdentityCredential in production, improving environment-specific authentication handling.
  • Added import os to support reading environment variables for credential selection.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Coverage

Coverage Report •
FileStmtsMissCoverMissing
TOTAL382455285% 
report-only-changed-files is enabled. No files were changed during this commit :)

Tests Skipped Failures Errors Time
834 0 💤 0 ❌ 0 🔥 9.973s ⏱️

@Roopan-Microsoft
Roopan-Microsoft merged commit cfae7b0 into dev Aug 6, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants