FoundryEnvironment Class

Definition

Provides strongly-typed access to Foundry platform environment variables injected by the Azure AI Foundry hosting infrastructure. All values are read once in the static constructor and cached for the lifetime of the process.

public static class FoundryEnvironment
type FoundryEnvironment = class
Public Class FoundryEnvironment
Inheritance
FoundryEnvironment

Properties

Name Description
AgentBlueprintClientId

The managed identity client ID of the agent blueprint. Sourced from the FOUNDRY_AGENT_BLUEPRINT_CLIENT_ID environment variable. Stamped as microsoft.a365.agent.blueprint.id on telemetry spans.

AgentInstanceClientId

The managed identity client ID of the agent instance. Sourced from the FOUNDRY_AGENT_INSTANCE_CLIENT_ID environment variable. When present, this is used as the primary agent identifier for telemetry.

AgentName

The agent name. Sourced from the FOUNDRY_AGENT_NAME environment variable.

AgentTenantId

The Microsoft Entra tenant ID of the agent. Sourced from the FOUNDRY_AGENT_TENANT_ID environment variable. Stamped as microsoft.tenant.id on telemetry spans.

AgentVersion

The agent version. Sourced from the FOUNDRY_AGENT_VERSION environment variable.

AppInsightsConnectionString

The Application Insights connection string. Sourced from the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable.

IsAgent365TracingEnabled

Indicates whether Agent365 tracing export is enabled. Returns true when both IsHosted is true and the FOUNDRY_AGENT365_TRACING_ENABLED environment variable is set to "true" (case-insensitive).

IsHosted

Indicates whether the process is running in a Foundry hosted environment. Returns true when the FOUNDRY_HOSTING_ENVIRONMENT environment variable is set to a non-empty value.

OtlpEndpoint

The OTLP exporter endpoint. Sourced from the OTEL_EXPORTER_OTLP_ENDPOINT environment variable.

Port

The HTTP listen port. Sourced from the PORT environment variable. Default: 8088.

ProjectArmId

The full ARM ID of the Foundry project. Sourced from the FOUNDRY_PROJECT_ARM_ID environment variable.

ProjectEndpoint

The Foundry project endpoint. Sourced from the FOUNDRY_PROJECT_ENDPOINT environment variable.

SessionId

The session ID. Sourced from the FOUNDRY_AGENT_SESSION_ID environment variable.

SseKeepAliveInterval

The SSE keep-alive comment frame interval. Sourced from the SSE_KEEPALIVE_INTERVAL environment variable (value in integer seconds). When absent, zero, or unparseable, returns InfiniteTimeSpan (disabled).

WebSocketKeepAliveInterval

The WebSocket Ping/Pong keep-alive interval used by the invocations_ws protocol. Sourced from the WS_KEEPALIVE_INTERVAL environment variable (value in integer seconds). When absent, zero, or unparseable, returns InfiniteTimeSpan (disabled — Kestrel default of 30s does not apply because Core sets the option explicitly to honour the spec's "disabled by default" contract).

Applies to