Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 2, 2025

Summary

This PR implements a diagnostic warning event that alerts users when Azure Functions Proxies files are loaded, informing them of the deprecation and upcoming end of community support.

Background

Azure Functions Proxies are officially deprecated, with community support ending on September 30, 2025 (official announcement). Despite this deprecation, a significant number of production applications still have proxies in use and users need to be proactively notified.

Changes

Diagnostic Event Constants

Added new diagnostic event constant AZFD0014 in DiagnosticEventConstants.cs with a help link (https://aka.ms/functions-deprecated-proxies) pointing to the official Azure deprecation announcement.

ProxyFunctionProvider Enhancement

Modified the ReadProxyMetadata method in ProxyFunctionProvider to emit a diagnostic warning event when proxy files are loaded. The warning is only emitted when:

  • A proxies.json file exists
  • The file contains valid proxy definitions
  • At least one proxy is successfully loaded

The warning message includes:

  • Clear deprecation notice
  • End of support date (September 30, 2025)
  • Migration guidance recommending Azure API Management or Azure Container Apps
  • Link to the official deprecation announcement

Test Coverage

Added a new unit test ProxyFunctionProvider_WhenProxiesEnabled_EmitsDiagnosticWarning that verifies:

  • The diagnostic event is properly emitted when proxy files are loaded
  • The correct error code (AZFD0014) is used
  • The warning message contains the expected deprecation information

Behavior

When an Azure Functions host starts up and loads proxies:

  1. The ProxyFunctionProvider reads the proxies.json file
  2. If valid proxies are found and loaded, a diagnostic warning event is emitted with error code AZFD0014
  3. The event is captured by Azure Monitor and appears in diagnostic logs
  4. Proxies continue to function normally (non-breaking change)

Impact

  • User Notification: Users with actual proxy files will now see actionable warnings in their Azure Monitor diagnostic logs
  • No False Positives: Warning only appears when proxy files exist and are loaded, not just when the feature flag is enabled
  • Non-Breaking: This is a warning-only change; proxy functionality remains unchanged
  • Minimal Footprint: Only 3 files modified
  • Consistent Pattern: Follows existing diagnostic event patterns used throughout the codebase (e.g., MissingFunctionsWorkerRuntime, WorkerRuntimeDoesNotMatchWithFunctionMetadata)

Fixes #11395

Original prompt

This section details on the original issue you should resolve

<issue_title>Emit diagnostic event for deprecated Proxy usage</issue_title>
<issue_description>Proxies are now officially deprecated: https://azure.microsoft.com/en-us/updates?id=community-support-for-azure-functions-proxies-will-end-on-30-september-2025

We should emit a diagnostic warning on startup to alert users of this. It still looks like we have a decent number of apps that still have this enabled in prod.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #11395

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] Emit diagnostic event for deprecated Proxy usage Emit diagnostic warning for deprecated Azure Functions Proxies usage Oct 2, 2025
@Copilot Copilot AI requested a review from brettsam October 2, 2025 21:11
Copilot finished work on behalf of brettsam October 2, 2025 21:11
_scriptOptions = scriptOptions;
_environment = environment;
_logger = loggerFactory.CreateLogger(LogCategories.Startup);
if (_environment.IsProxiesEnabled())
Copy link
Member

Choose a reason for hiding this comment

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

Are there other places in the host we do this check?

Copy link
Member

Choose a reason for hiding this comment

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

The warning here will be emitted simply if proxies feature flag is enabled. We may need to only emit warning if there are actual files with proxies. Otherwise, customers might be confused why the warning is generated. If we do want the warning here we also should provide instructions to remove feature flag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in commit da5c682 to only emit the warning when actual proxy files exist and are loaded, not just when the feature flag is enabled. The warning now appears in the ReadProxyMetadata method after confirming that proxies have been successfully loaded from the proxies.json file.

public const string WorkerRuntimeDoesNotMatchWithFunctionMetadataHelpLink = "https://aka.ms/functions-invalid-worker-runtime";

public const string DeprecatedProxiesErrorCode = "AZFD0014";
public const string DeprecatedProxiesHelpLink = "https://azure.microsoft.com/en-us/updates?id=community-support-for-azure-functions-proxies-will-end-on-30-september-2025";
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to https://aka.ms/functions-deprecated-proxies in commit da5c682.

_logger = loggerFactory.CreateLogger(LogCategories.Startup);
if (_environment.IsProxiesEnabled())
{
_logger.LogDiagnosticEventWarning(DiagnosticEventConstants.DeprecatedProxiesErrorCode, "Azure Functions Proxies are deprecated and community support will end on September 30, 2025. Please migrate to Azure API Management or Azure Container Apps. See https://azure.microsoft.com/en-us/updates?id=community-support-for-azure-functions-proxies-will-end-on-30-september-2025 for more information.", DiagnosticEventConstants.DeprecatedProxiesHelpLink, null);
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to https://aka.ms/functions-deprecated-proxies in commit da5c682.

Copilot finished work on behalf of brettsam October 7, 2025 15:30
@Copilot Copilot AI requested a review from brettsam October 7, 2025 15:30
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.

Emit diagnostic event for deprecated Proxy usage
4 participants