Skip to content

Conversation

@alzarei
Copy link

@alzarei alzarei commented Dec 4, 2025

Pull Request Contribution Checklist

Motivation and Context

Why is this change required?

The codebase had inconsistent environment variable naming for OpenAI API keys across samples.

What problem does it solve?

Eliminates confusion caused by mixed usage of OPENAI_APIKEY and OPENAI_API_KEY.

What scenario does it contribute to?

Ensures all samples and documentation use standardized environment variable naming aligned with OpenAI conventions.

Related Issue

Fixes #1001

Description

Changes Made

Standardized OpenAI API key environment variable naming across 15 files:

  • Replaced OPENAI_APIKEYOPENAI_API_KEY (14 occurrences)
  • Replaced AZURE_FOUNDRY_OPENAI_APIKEYAZURE_FOUNDRY_OPENAI_API_KEY (1 occurrence)

Affected Files

  • .NET sample code (5 Program.cs files)
  • .NET sample documentation (5 README.md files)
  • Unit test file (1 PromptAgents.cs)
  • YAML configuration files (3 OpenAI samples)
  • Python documentation (1 README.md)

Approach

Simple find-and-replace operation to standardize naming convention. No functional changes to code logic.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible (N/A - naming change only)
  • Is this a breaking change? No - environment variable names are external configuration

Additional Notes

Verification Steps Completed

  • Verified no remaining OPENAI_APIKEY occurrences in codebase
  • Verified no remaining AZURE_FOUNDRY_OPENAI_APIKEY occurrences
  • Development environment set up (.NET SDK 10.0.100, Python 3.10 with uv)

CI/CD Checks

  • All CI/CD builds pass
  • No test failures introduced
  • Code formatting checks pass

…t#1001)

- Replace OPENAI_APIKEY with OPENAI_API_KEY across all samples
- Replace AZURE_FOUNDRY_OPENAI_APIKEY with AZURE_FOUNDRY_OPENAI_API_KEY
- Ensures consistency with OpenAI's standard naming convention
- Applies to .NET and Python samples

Fixes microsoft#1001
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation python .NET labels Dec 4, 2025
@github-actions github-actions bot changed the title fix: Standardize OpenAI API key environment variable naming (#1001) Python: fix: Standardize OpenAI API key environment variable naming (#1001) Dec 4, 2025
@github-actions github-actions bot changed the title fix: Standardize OpenAI API key environment variable naming (#1001) .NET: fix: Standardize OpenAI API key environment variable naming (#1001) Dec 4, 2025
@alzarei alzarei marked this pull request as ready for review December 4, 2025 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation .NET python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: AgentWithOpenAI Wrong environment variable name

2 participants