You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure中配置Webhook传递属性后无法注册Event Grid订阅的问题求助

Troubleshooting Azure Event Grid Webhook Subscription Failure with Delivery Properties

Hi Ashok, sorry to hear you're stuck on this issue—let's walk through some targeted fixes and checks to get your webhook subscription working with custom delivery properties:

Common Causes & Fixes

1. Ensure Your Validation Logic Handles Custom Headers

When you add delivery properties like Authorization or custom content-type headers, Event Grid includes these headers during the validation request (not just event delivery). If your REST service's validation code only expects the default validation payload without extra headers, it might reject the request.

  • Double-check that your validation endpoint first processes any custom headers (e.g., validating an auth token in the Authorization header) before handling the Event Grid validation logic (returning the validationCode from the request body).
  • Verify that your service accepts OPTIONS requests (if using the validation handshake method) with these custom headers enabled.

2. Validate Content-Type Compatibility

If you're overriding the content-type header:

  • Make sure the value you specify is supported by Event Grid (e.g., application/json or application/cloudevents+json). Using an unsupported format will cause validation to fail.
  • Confirm your REST service can parse the request body in the specified content-type format during both validation and event delivery.

3. Check Web App Access Restrictions & Middleware

Azure Web App security layers might block requests with custom headers:

  • Temporarily disable IP restrictions, WAF rules, or custom authentication middleware to test if they're intercepting the validation request.
  • If you re-enable these restrictions, add the official Event Grid service IP ranges to your allowlist to ensure requests aren't blocked.

4. Dig Into Detailed Failure Logs

  • In the Azure Portal, navigate to your Event Grid subscription and check the Delivery Failures tab for specific error codes (e.g., 401 Unauthorized, 400 Bad Request) and failure details—this will pinpoint whether the issue is with auth, request formatting, or something else.
  • Enable detailed logging for your Web App under App Service Logs, then inspect the incoming request headers and service response status codes to confirm if your custom delivery properties are being sent correctly.

5. Test with Azure CLI (Optional)

Use the Azure CLI to create the subscription with delivery properties, which often returns more verbose error messages than the Portal:

az eventgrid event-subscription create \
  --name your-subscription-name \
  --source-resource-id /subscriptions/{your-sub-id}/resourceGroups/{your-rg}/providers/{resource-provider}/{resource-name} \
  --endpoint https://your-webapp.azurewebsites.net/api/your-event-endpoint \
  --delivery-attribute-mapping "headerName=Authorization,headerValue=Bearer your-auth-token"

If you can share specific error codes or log snippets from your failed attempts, we can narrow this down further!

内容的提问来源于stack exchange,提问作者Ashok Peravali

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 23:18:15