Skip to content

fix: dev to main - Refactor credential retrieval logic for environment compatibility - #1127

Merged
Roopan-Microsoft merged 5 commits into
mainfrom
dev
Aug 6, 2026
Merged

fix: dev to main - Refactor credential retrieval logic for environment compatibility#1127
Roopan-Microsoft merged 5 commits into
mainfrom
dev

Conversation

@Akhileswara-Microsoft

Copy link
Copy Markdown
Contributor

Purpose

This pull request updates the logic for obtaining Azure credentials in the image_service.py file to better distinguish between development and production environments. The main change is to select the appropriate credential type based on the APP_ENV environment variable.

Credential selection logic:

  • Updated the _get_credential function to check the APP_ENV environment variable and use DefaultAzureCredential in development environments and ManagedIdentityCredential with the configured client ID otherwise. This ensures the correct authentication method is used depending on the deployment context.
  • Imported the os module to support reading environment variables.

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

Other Information

This pull request updates the logic for obtaining Azure credentials in the image_service.py service. The main change is to select credentials based on the current environment, improving local development experience and deployment flexibility.

Credential selection improvements:

  • Updated the _get_credential function to check the APP_ENV environment variable and use DefaultAzureCredential with require_envvar=True in development environments, while continuing to use ManagedIdentityCredential with the configured client ID in other environments.
  • Imported the os module to support reading environment variables in the credential selection logic.

@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.726s ⏱️

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors Azure credential selection in the MCP server’s image generation service to choose credentials based on APP_ENV, improving alignment between local development and deployed environments.

Changes:

  • Add os import to read APP_ENV.
  • Update _get_credential() to use DefaultAzureCredential when APP_ENV=dev, otherwise use ManagedIdentityCredential with the configured client ID.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/mcp_server/services/image_service.py
Copilot AI review requested due to automatic review settings August 6, 2026 09:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 10 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • src/App/package-lock.json: Generated file
Suppressed comments (1)

src/mcp_server/pyproject.toml:23

  • The PR description focuses on refactoring Azure credential selection in image_service.py, but this PR also changes a large set of dependency versions across multiple Python projects and the frontend (FastAPI/Uvicorn/Pydantic/OpenAI, React Router/Vite/Vitest, etc.). This increases review and rollout risk; please either split the dependency upgrades into a separate PR with rationale/validation, or update the PR description to explicitly cover these changes and testing performed.
  "fastmcp==3.2.0",
  "fastapi==0.136.1",
  "uvicorn[standard]==0.35.0",
  "python-dotenv==1.1.1",
  "azure-identity==1.25.3",
  "pydantic==2.13.4",

Comment thread src/App/package-lock.json
@Roopan-Microsoft
Roopan-Microsoft merged commit b796df9 into main Aug 6, 2026
11 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.

4 participants