ION DocsV2
  • Architecture
    • ION Architecture V2
      • ION V2 — Architecture Overview
      • V2 context
        • V2 capacity model
        • V2 constraints
        • V2 integration boundaries
        • V2 requirements
        • V2 solution strategy
      • V2 Structural Design
        • ION V2 Landscape
        • ION V2 Platform Views
          • ION V2 Delivery and Runway
          • ION V2 Incident-Processing Pipelines
          • ION V2 Platform Networking
          • ION V2 Platform Observability
          • ION V2 Platform Security
        • ION V2 System Context
        • ION V2 Systems
          • Alya System Topology
          • Cogs System Topology
          • Ion IQ System Topology
          • Kingsman System Topology
          • Pigeon System Topology
          • Veritas System Topology
          • Watchtower System Topology
      • V2 evolution and platform lineage
        • Tiberium Origins
          • Tiberium Architecture Overview
          • Tiberium Components Architecture Overview
        • Voyager and the V2 Merge
          • Voyager Architecture Overview
          • Voyager Identity Architecture Overview
          • Voyager Services Architecture Overview
      • V2 Platform Architecture
        • Alya Workbench
          • Mission Brief: Alya (Workbench for Cyber Defenders)
        • Asset Discovery
        • Automation
        • Customer Communications
          • Notification and Escalation Design
        • Reporting and Dashboards
        • Vulnerability Mitigations
      • V2 Well-Architected
        • V2 Reliability
          • Availability Architecture
        • V2 Security
          • API Management
            • API Management Architecture
            • API Management Guidelines
            • API Management Implementation
              • APIM Deployment and Debugging
              • APIM Global Policy Implementation
              • APIM Platform Provisioning
              • APIM Policy Authoring
              • APIM Service Onboarding
              • APIM Webhook Flow Implementation
            • API Management Policy Model
          • V2 Security Architecture
          • Teams Notification Security
          • Customer Data and PII
          • V2 Identity
            • Applications and Authorization
            • V2 Identity Architecture
            • Microsoft Entra ID
            • V2 Identity Standard
            • V2 Identity Implementation
              • Application Registration
              • Application Roles
              • Customer Identity Onboarding
              • Identity Lifecycle and Operations
              • Managed Identity
            • V2 Identity Workflows
              • Alya Workbench Identity Workflow
              • Customer Portal Identity Workflow
              • Microservices Identity Workflow
              • ServiceNow Inbound Identity Workflow
              • Microsoft Teams Identity Workflow
          • Customer Environment Access
            • Customer Environment Access Architecture
            • Customer Environment Access Guidelines
            • Customer Environment Access How-to
    • ION Architecture V3
      • ION V3 Architecture Overview
      • V3 context
        • V3 capacity model
        • V3 constraints
        • V3 integration boundaries
        • V3 requirements
        • V3 solution strategy
      • V3 Structural Design
        • Data and events
          • Archival and retention
          • Event model
          • Event sourcing
          • Event store
          • Micro-frontend interaction
          • Recovery and disaster recovery
          • Replay and reconstruction
          • Reporting and customer analytics
          • Event-sourcing requirements
          • Snapshots
          • UI interaction
        • ION v3 domains
          • Assets domain
            • Assets domain flows
            • Assets domain implementation
            • Assets domain model
          • Customer Collaboration domain
            • Customer Collaboration domain flows
            • Customer Collaboration domain implementation
            • Customer Collaboration domain model
          • Incident domain
            • Incident domain flows
            • Incident domain implementation
            • Incident domain model
          • Investigation domain
            • Investigation domain flows
            • Investigation domain implementation
            • Investigation domain model
          • Remediation domain
            • Remediation domain implementation
            • Remediation domain model
          • Ticket domain
            • Ticket domain flows
            • Ticket domain implementation
            • Ticket domain model
        • ION V3 Landscape
        • ION V3 Platform Views
          • Internal API
            • Internal API architecture
            • Internal API consumer guide
            • Internal API identity and access
            • Internal API implementation
          • Micro-Frontends
            • Micro-Frontends architecture
            • Micro-Frontends capability service (Signet)
            • Micro-Frontends composition
            • Micro-Frontends identity and access
            • Micro-Frontends implementation
            • Micro-Frontends real-time (SignalR)
            • Micro-Frontends routing and ingress
            • Shells and MFEs
          • SOAR Integration
            • SOAR Integration architecture
            • SOAR Integration customer onboarding
            • SOAR Integration Identity and Access Design
            • SOAR Integration implementation
            • SOAR Integration operations
        • ION V3 System Context
        • ION V3 systems
          • Alya
          • Cogs
          • ION IQ
          • Kingsman
          • Pigeon
          • Veritas
          • Watchtower
      • V2 to V3 evolution
        • V2 to V3 architecture delta
        • V2 to V3 decision changes
        • V2 to V3 migration guidance
        • V2 to V3 service impact
      • Well-Architected
        • Cost Optimization
          • Cost Governance
            • Cost Governance Architecture
            • Cost Governance Guidelines
            • Cost Governance Implementation
          • SKU Strategy
            • SKU Strategy Architecture
            • SKU Strategy Guidelines
            • SKU Strategy Implementation
        • Operational excellence
          • Audit Logs
            • Audit Logs Architecture
            • Audit Logs Guidelines
            • Audit Logs Implementation
          • CI/CD Runway
            • CI/CD Runway Architecture
            • CI/CD Runway Guidelines
            • CI/CD Runway Implementation
          • Feature Flags
            • Feature Flags Architecture
            • Feature Flags Guidelines
            • Feature Flags Implementation
          • Incident management
            • Incident management architecture
            • Incident management guidelines
            • Incident management implementation
          • Azure Landing Zone
            • Azure Landing Zone Architecture
            • Azure Landing Zone Guidelines
            • Azure Landing Zone Implementation
          • Notifications
            • Notifications Architecture
            • Notifications Guidelines
            • Notifications Implementation
          • Observability
            • Observability Architecture
            • Observability Guidelines
            • Observability Implementation
        • Performance efficiency
          • Capacity, sizing, and scaling
            • Capacity, sizing, and scaling architecture
            • Capacity, sizing, and scaling guidelines
            • Implement capacity, sizing, and scaling
          • UI responsiveness
            • UI responsiveness architecture
            • UI responsiveness guidelines
            • Implement UI responsiveness
        • V3 reliability
          • Application resilience patterns
          • Critical flows
          • Customer reliability assurance
            • ION Platform reliability and service continuity
            • Customer reliability slides
          • Disaster recovery
            • Disaster recovery architecture
            • Disaster recovery guidelines
            • Disaster recovery implementation
              • DR implementation: API Management
              • DR implementation: App Configuration
              • DR implementation: Application Gateway
              • DR implementation: Azure SQL Database
              • DR implementation: Container Apps
              • DR implementation: Container Registry
              • DR implementation: Cosmos DB
              • DR implementation: Event Hubs
              • DR implementation: Azure Front Door
              • DR implementation: Function Apps
              • DR implementation: Key Vault
              • DR implementation: Log Analytics and Application Insights
              • DR implementation: MySQL Flexible Server (Temporal)
              • DR implementation: PostgreSQL Flexible Server
              • DR implementation: Azure Managed Redis
              • DR implementation: Service Bus
              • DR implementation: SignalR
              • DR implementation: Storage accounts
            • Operational-data replication
            • Disaster recovery operations
          • Edge and routing
            • Azure Application Gateway
              • Azure Application Gateway architecture
              • Azure Application Gateway guidelines
              • Azure Application Gateway implementation
              • Azure Application Gateway resiliency
              • Azure Application Gateway security
            • Azure Front Door
              • Azure Front Door architecture
              • Azure Front Door guidelines
              • Azure Front Door implementation
              • Azure Front Door resiliency
              • Azure Front Door security
          • Event-store disaster recovery (moved)
          • Failure mode analysis
          • Graceful degradation
            • Graceful degradation architecture
            • Graceful degradation guidelines
            • Graceful degradation implementation
          • V3 reliability maturity model
            • V3 reliability maturity assessment
            • Maturity level 2: self-preservation
            • Maturity level 3: recovery readiness
            • Maturity level 4: maintain stability
            • Maturity level 5: stay resilient
          • Multi-region replication
            • Multi-region replication architecture
            • Multi-region replication guidelines
            • Multi-region replication implementation assessment
          • Reliability testing
          • Scaling and headroom
          • Targets and health model
          • Trade-offs and accepted risks
        • V3 Security
          • API Management
            • API Management Architecture
            • API Management Guidelines
            • API Management Implementation
              • API Contracts and Asynchronous Operations
              • APIM Deployment and Debugging
              • APIM Global Policy Implementation
              • APIM Platform Provisioning
              • APIM Policy Authoring
              • APIM Service Onboarding
              • APIM Webhook Flow Implementation
            • API Management Policy Model
          • V3 Security Architecture
          • Data protection
            • Data protection architecture
            • Data protection guidelines
            • Data protection implementation guidelines
              • API Management
              • Application Gateway
              • Azure SQL Database
              • Azure Container Apps
              • Azure Cosmos DB
              • Azure Front Door
              • Azure Function Apps
              • Azure Database for MySQL
              • Azure Database for PostgreSQL
              • Data protection procedures
          • V3 Security Guidelines
          • V3 Identity
            • Applications and Authorization in ION V3
            • V3 Identity Architecture
            • Capabilities
            • Microsoft Entra ID for ION V3
            • V3 Identity Standard
            • V3 Identity Implementation
              • App Service Authentication
              • Application Registration
              • Application Roles
              • Customer Azure RBAC
              • Customer Identity Onboarding
              • Identity Lifecycle and Operations
              • Mailbox-Scoped Access
              • Managed Identity
              • Workload Identity Federation
            • V3 Identity Workflows
              • Alya Workbench Identity Workflow
              • Customer Azure RBAC Identity Workflow
              • Customer Portal Identity Workflow
              • Mailbox Access Identity Workflow
              • Microservices Identity Workflow
              • ServiceNow Inbound Identity Workflow
              • Shell and MFE Identity Workflow
              • Microsoft Teams Identity Workflow
          • Customer Environment Access
            • Azure Lighthouse
              • Azure Lighthouse implementation
            • GDAP and Tenant Governance
              • Access Packages (legacy)
              • GDAP human access implementation
            • Customer environment access guidelines
            • Multi-tenant Entra apps
              • Multi-tenant Entra apps implementation
            • Teams B2B Direct Connect
              • Teams B2B Direct Connect implementation
          • Network Security
            • Network Security Architecture
            • Network Security Guidelines
            • Network Security Implementation
              • Egress and Static IPs
              • Resource Access Restrictions
          • V3 Security Patterns
    • ION Architecture V4
      • How V4 evolves from V3
  • Principles
  • Patterns
    • Application Permissions Only
    • Async REST
    • Audit Logs (Pattern)
    • Auth / AuthZ
    • Dead Letter Queue (DLQ)
    • Dual Writes (and how to avoid them)
    • ECST — Event-Carried State Transfer
    • Event Hubs Throttling
    • Feature Flags (Pattern)
    • Idempotent Write
    • MFE UI Interaction
    • Notifications (Pattern)
    • Private Data Store Access
    • Schema Evolution
    • Service Bus Topic Throttling
    • UI Interaction with an Event-Sourced Backend
  • Standards
    • API Standard
    • API Standards
    • Coding Standard
    • Coding Standards
    • Documentation Standard
    • Documentation Standards
    • Microservice Standard
    • Microservice Checklist
    • Operational Readiness Standard
    • ORR — Operational Readiness Review Checklist
  • Decisions
    • ADR-0001
    • ADR-0002
    • ADR-0003
    • ADR-0004
    • ADR-0005
    • ADR-0006
    • ADR-0007
    • ADR-0008
    • ADR-0009
    • ADR-0010
    • ADR-0011
    • ADR-0012
    • ADR-0013
    • ADR-0014
    • ADR-0015
    • ADR-0016
    • ADR-0017
    • ADR-0018
    • ADR-0019
    • ADR-0020
    • ADR-0021
    • ADR-0022
    • ADR-0023
    • ADR-0024
    • ADR-0025
    • ADR-0026
    • ADR-0027
    • ADR-0028
    • ADR-0029
    • ADR-0030
    • ADR-0031
    • ADR-0032
    • ADR-0033
    • ADR-0034
  • Services
  • Governance
    • Assumptions
    • Discrepancies
    • V3 reference coverage and conflict matrix
OntinueION Docs
  1. Architecture
  2. ION Architecture V2
  3. V2 Well-Architected
  4. V2 Security
  5. API Management
  6. API Management Implementation
  7. APIM Webhook Flow Implementation

APIM Webhook Flow Implementation

security
VersionV2V3
architecturev2

APIM Webhook Flow Implementation

External webhook providers cannot always present an ION Entra access token. ION therefore supports an explicit webhook exception in which a dedicated API omits global inbound policy inheritance and delegates sender-specific validation to the webhook implementation.

This page documents the deployed Phoenix Microsoft Graph webhook flow from:

  • phoenix/infrastructure/phoenix_webhooks_api.tf;
  • phoenix/api/specs/openapi_webhooks.yaml;
  • phoenix/api/policies/apim-phoenix-graph-webhook-api-policy.xml;
  • the lifecycle and resource operation-policy files; and
  • the Phoenix webhook handlers and notification service.

This exception is not an unauthenticated-backend pattern. APIM still authenticates to the OAuth-protected Function App using its managed identity, while Phoenix validates the Graph notification at the application layer.

Why the webhook bypass exists

The normal global inbound policy requires an Authorization bearer token, validates its tenant and audience, and requires role claims. Microsoft Graph webhook delivery uses a different proof model:

  1. Graph validates endpoint ownership by sending a validationToken query value that the endpoint must return as plain text.
  2. Resource-data notifications contain Graph-issued validation JWTs in the payload.
  3. Notifications carry the subscription’s clientState, tenant or organization identifier, and subscription identifier for application validation.

The dedicated external webhook API therefore does not inherit normal caller JWT validation. This exception MUST remain limited to operations whose provider validation is implemented and tested in application code.

Deployed end-to-end flow

There are two independent trust decisions:

BoundaryIdentity or proofEnforcement
Graph → Phoenix webhookEndpoint validation challenge, payload validation JWTs where supplied, expected tenant, clientState, and subscription IDPhoenix webhook handlers and notification service
APIM → Phoenix Function AppAPIM user-assigned managed-identity access tokenFunction App platform OAuth before function execution

Exact policy-inheritance behavior

The webhook does not bypass every global section. It bypasses only global inbound authentication and tenant processing.

Consequences of omitting inbound <base /> at API scope include:

  • no required caller Authorization header;
  • no global transaction-ID creation;
  • no pre-validation tenant lookup or customer allow-list check;
  • no global caller JWT, issuer, audience, or role validation;
  • no trusted X-Tenant-Id or X-Authorization creation; and
  • no global Forwarded header or request trace—the API policy supplies its own forwarding header and trace invocation.

The inherited global backend still applies per-API concurrency and the bounded forward-request. Global response and error fragments still execute.

Deployed API policy

The external Graph API policy deliberately has no <base /> in inbound. It selects the Phoenix backend, rate-limits by source IP, sets forwarding context, traces the request, acquires an APIM managed-identity token, and overwrites Authorization before reaching the backend.

<policies>
  <inbound>
    <!-- Intentionally no inbound base: normal caller JWT policy is not applicable. -->
    <set-backend-service base-url="${globals.backend_base_url}" />

    <rate-limit-by-key
      calls="500"
      renewal-period="60"
      counter-key="@(context.Request.IpAddress)"
      increment-condition="@(context.Response.StatusCode &gt;= 200 &amp;&amp; context.Response.StatusCode &lt; 400)"
      remaining-calls-variable-name="remainingCallsPerIP" />

    <set-header name="Forwarded" exists-action="override">
      <value>@("proto=" + context.Request.OriginalUrl.Scheme + ";host=" + context.Request.OriginalUrl.Host + ";path=" + context.Request.OriginalUrl.Path + ";")</value>
    </set-header>

    <include-fragment fragment-id="fragment-request-trace" />

    <authentication-managed-identity
      resource="{{APIM-BACKEND-AUDIENCE}}"
      client-id="{{APIM-MSI-CLIENT-ID}}"
      output-token-variable-name="backend-access-token"
      ignore-error="false" />

    <set-header name="Authorization" exists-action="override">
      <value>@("Bearer " + (string)context.Variables["backend-access-token"])</value>
    </set-header>
  </inbound>

  <backend>
    <base />
  </backend>
  <outbound>
    <base />
    <set-header name="x-aspnet-version" exists-action="delete" />
    <set-header name="x-powered-by" exists-action="delete" />
  </outbound>
  <on-error>
    <base />
  </on-error>
</policies>

The rate limit counts successful responses as deployed. It is not proof that the source is Microsoft Graph, and source IP must not be treated as the webhook’s primary authentication mechanism.

The request trace runs before APIM replaces Authorization. The deployed trace fragment excludes authorization headers, but it logs the full request body. That can expose Graph notification content and is not the safe target pattern. Webhook telemetry must be reduced to bounded metadata.

Operation policies and route mapping

Both webhook operations inherit the webhook API policy and rewrite only their backend path:

Public operationBackend rewriteApplication handler
POST /v1/subscriptions/webhooks/lifecycle/v1/subscriptions/webhooks/lifecycleLifecycle notification handler
POST /v1/subscriptions/webhooks/resource/v1/subscriptions/notifications/resource-changeResource-change notification handler
<policies>
  <inbound>
    <base />
    <rewrite-uri
      template="${globals.webhook_backend_path}"
      copy-unmatched-params="true" />
  </inbound>
  <backend>
    <base />
  </backend>
  <outbound>
    <base />
  </outbound>
  <on-error>
    <base />
  </on-error>
</policies>

Here, operation inbound <base /> invokes the API policy. Because the API policy has no inbound <base />, inheritance stops before global inbound.

Endpoint-validation challenge

When validationToken is present in the query string, both handlers return its value with HTTP 200 and Content-Type: text/plain:

var validationToken = request.GetQueryParamValue("validationToken");
if (validationToken is not null)
{
    var response = request.CreateResponse(HttpStatusCode.OK);
    response.Headers.Add("Content-Type", "text/plain");
    await response.WriteStringAsync(validationToken, cancellationToken);
    return response;
}

This challenge proves control of the registered endpoint to Microsoft Graph. It does not authenticate arbitrary notification requests after subscription setup. The validation token is sensitive transient input and MUST NOT be logged; the deployed handlers currently log it and should be remediated.

Notification validation

For a normal delivery, Phoenix performs application validation after platform OAuth has authenticated APIM.

Resource-data notifications

Phoenix:

  1. Parses the request body as a Graph change-notification collection.
  2. Reads the collection’s validationTokens.
  3. Validates each supplied JWT against the configured tenant and client audience.
  4. Rejects token-validation failure.
  5. Validates each notification’s tenant, clientState, and subscription ID.
  6. Queues only valid notifications for downstream handling.
var validationTokens = GetValidationTokens(notificationCollection);
await ValidateTokens(validationTokens, expectedTenant, expectedClient);

foreach (var notification in notificationCollection.Value)
{
    if (HasExpectedTenantClientStateAndSubscription(notification))
    {
        notificationQueue.Enqueue(notification);
    }
}

The deployed token validator returns success for an empty token list. Because the resource-data path is intended to require validation JWTs, tests and future hardening must require at least one token rather than treating an empty collection as valid.

Lifecycle notifications

Graph lifecycle notifications do not follow the same payload-token path. Phoenix validates each notification using:

  • organizationId for lifecycle events, falling back to tenantId where applicable;
  • the configured expected tenant;
  • the configured subscription clientState; and
  • a non-empty subscription ID.

Invalid individual notifications are discarded and are not queued. The handler returns 202 after accepted notifications are handed to the internal notification handler.

Function middleware exception

The Phoenix Function triggers use AuthorizationLevel.Anonymous because Function keys are not the trust mechanism. Function App platform OAuth authenticates APIM before invocation.

Phoenix explicitly excludes the two webhook function names from its normal in-process authentication and role-authorization middleware:

app
    .UseWhen<AuthenticationMiddleware>(IsHttpAndNotWebhook)
    .UseWhen<AuthorizationMiddleware>(IsHttpAndNotWebhook)
    .UseWhen<ExceptionHandlingMiddleware>(IsHttp)
    .UseWhen<CorrelationIdMiddleware>(IsHttp)
    .UseWhen<RequestResponseLoggingMiddleware>(IsHttp);

Webhook-specific validation in the handlers and notification service therefore becomes mandatory. Adding a new webhook function without adding equivalent sender validation creates an unauthenticated application path even if APIM-to-backend OAuth remains correctly configured.

Required webhook guardrails

A webhook API that bypasses global inbound policy MUST:

  • use a dedicated external API and explicit operation-policy map;
  • omit inbound <base /> only at the reviewed API or operation boundary;
  • document the provider’s challenge and notification-authentication protocol;
  • validate provider signatures, JWTs, shared state, or equivalent cryptographic proof before trusting the payload;
  • validate subscription, tenant/customer, event type, timestamp, and replay context where the provider supplies them;
  • authenticate APIM to an OAuth-protected backend with a narrowly authorized UAMI;
  • fail closed when provider validation data is absent, invalid, ambiguous, or unavailable;
  • rate-limit and bound request size, processing time, and queue work;
  • acknowledge only after validation and durable acceptance required by the provider protocol;
  • avoid logging validation tokens, payload JWTs, clientState, encrypted content, complete bodies, or authorization headers; and
  • include negative tests proving normal global-policy bypass cannot be applied to other API operations.

Source-IP filtering may be added as defense in depth when the provider publishes a reliable range, but it must not replace provider-level validation.

Current implementation risks

RiskDeployed behaviorRequired disposition
OpenAPI security mismatchThe webhook contract declares BearerAuth, while APIM deliberately performs no caller bearer validation.Model the actual provider security semantics so generated documentation does not claim a control that is absent.
Full-body APIM tracingRequest and error fragments can capture notification payloads.Use bounded webhook metadata and prohibit payload capture by default.
Validation challenge loggingBoth handlers log the validationToken.Remove token values from logs.
Empty validation-token collectionResource token validation succeeds when the list exists but is empty.Require at least one valid token for resource-data notifications.
No global transaction-ID creationWebhook API inbound does not set X-Transaction-Id.Create a gateway correlation ID without importing normal JWT policy, or ensure an equivalent trusted correlation layer.
Broad webhook exception riskAuthentication and authorization middleware are skipped by function-name classification.Keep the function allow-list minimal and require dedicated sender-validation tests for every entry.

Validation checklist

  • A Graph endpoint-validation request receives the exact token as text/plain without exposing it in logs.
  • A webhook request does not require an ION caller bearer token.
  • The webhook API does not execute global inbound JWT or tenant policy.
  • API policy acquires the expected APIM UAMI token and overwrites backend Authorization.
  • Direct anonymous calls to the Function App are rejected by platform OAuth.
  • Global backend concurrency and forwarding still execute.
  • Global outbound and error behavior still execute with safe telemetry.
  • Resource-data notifications without validation JWTs are rejected.
  • Invalid validation JWT signature, issuer, tenant, audience, or lifetime is rejected.
  • Wrong tenant, clientState, or missing subscription ID is not queued.
  • Valid lifecycle and resource notifications are durably handed off before 202.
  • Request-size and rate-limit behavior is tested.
  • No webhook token, clientState, encrypted content, or full payload appears in APIM or application logs.
  • Removing webhook-specific validation causes security tests to fail.

Related pages

  • Global policy implementation
  • Policy model
  • Policy authoring
  • Service onboarding
  • Deployment and debugging

On this page

  • Why the webhook bypass exists
  • Deployed end-to-end flow
  • Exact policy-inheritance behavior
  • Deployed API policy
  • Operation policies and route mapping
  • Endpoint-validation challenge
  • Notification validation
  • Resource-data notifications
  • Lifecycle notifications
  • Function middleware exception
  • Required webhook guardrails
  • Current implementation risks
  • Validation checklist
  • Related pages
PreviousAPIM Service Onboarding
NextAPI Management Policy Model
Edit on GitHubSecurity