随笔分类 -  【Azure API 管理】

Azure 中使用APIM的各种疑难杂症
摘要:问题描述 使用 Azure API Management(APIM)时,需要记录每个 API 请求的 Header 和 Body,以便进行问题排查和审计,如何配置才能完整捕获这些信息呢? 问题解答 在配置API的时候,启用 trace 策略来收集 inbound / outbound中分别收集请求的 阅读全文
posted @ 2025-10-12 16:59 路边两盏灯 阅读(7) 评论(0) 推荐(0)
摘要:问题描述 使用APIM服务时候,因为后端的API需要使用自签名证书进行验证。如果通过浏览器直接访问后端API返回正常,但是APIM请求的时候返回为500报错。 在开启Trace后,发现报错信息为:error message :The underlying connection was closed: 阅读全文
posted @ 2025-10-10 20:18 路边两盏灯 阅读(7) 评论(0) 推荐(0)
摘要:问题描述 在使用 Azure API Management(APIM)时,如何防止客户端发送过大的 POST 请求?例如,如何阻止任何超过 50MB 的文件上传请求,以避免资源浪费或潜在的服务中断。 问题解答 可以的。通过在 Azure APIM 中配置策略(Policy)来实现对请求体大小的限制。 阅读全文
posted @ 2025-09-30 17:22 路边两盏灯 阅读(7) 评论(0) 推荐(0)
摘要:APIM在上传文件的时候,请求的Payload是否有文件大小的限制呢? 阅读全文
posted @ 2025-09-27 16:36 路边两盏灯 阅读(10) 评论(0) 推荐(0)
摘要:问题描述 使用APIM服务,当遇见上传文件的请求时,需要考虑大文件对APIM性能的影响。 所以,是否可以使用APIM策略来监测请求body大小,如果超过50MB,就返回413 Payload too Large呢? 问题解答 当然可以。实现思路如下: 1: 在API的Policy中,在Inbound 阅读全文
posted @ 2025-07-09 19:50 路边两盏灯 阅读(21) 评论(0) 推荐(0)
摘要:HTTP Error 411. The request must be chunked or have a content length 阅读全文
posted @ 2025-06-24 20:30 路边两盏灯 阅读(70) 评论(0) 推荐(0)
摘要:问题描述 API Management在对请求进行鉴权的时候,是否有策略(如 validate-jwt类似的policy)来支持 SAML assertion呢? 问题解答 API Management策略不支持对 SAML assertion 的验证,validate-jwt 验证 的是 JWT 阅读全文
posted @ 2025-06-19 19:32 路边两盏灯 阅读(16) 评论(0) 推荐(0)
摘要:问题描述 Azure API Management 诊断日志开启后,它的默认日志中,并没有记录APIM请求的 Header 和 Body 信息。 那么,还有什么简单的方法来记录所有请求的 Header 或 Body 信息呢? 问题解答 可以的,使用 Trace 策略,然后调用 context.Req 阅读全文
posted @ 2025-04-24 20:05 路边两盏灯 阅读(25) 评论(0) 推荐(0)
摘要:如果没有关联的网络安全组,则阻止所有网络流量通过子网和网络接口。 阅读全文
posted @ 2025-01-21 20:25 路边两盏灯 阅读(64) 评论(0) 推荐(0)
摘要:Invalid parameter: This Migration API option is not supported or is temporarily disabled due to internal issues. Please visit https://aka.ms/apim-migrate-stv2 to see other migration options. 阅读全文
posted @ 2025-01-17 20:11 路边两盏灯 阅读(29) 评论(0) 推荐(0)
摘要:Collect data from this resource for analytics Data collection is required for detailed monitoring, custom dashboards, and more. A Log Analytics workspace is also required for the data storage. You can change the workspace destination at any time in Diagnostic settings. How do I use Log Analytics? 阅读全文
posted @ 2024-09-19 19:31 路边两盏灯 阅读(52) 评论(0) 推荐(0)
摘要:[Reason - The key used is expired.,Thumbprint of key used by client: '3D****************', Found key 'Start=04/28/2024 11:10:00, End=07/28/2024 11:10:00',Please visit the Azure Portal, Graph Explorer or directly use MS Graph to see configured keys for app Id 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'.Review the documentation at https://docs.microsoft.com/en-us/graph/deployments to determine the corresponding service endpoint 阅读全文
posted @ 2024-07-29 20:49 路边两盏灯 阅读(65) 评论(0) 推荐(0)
摘要:"code": "InvalidParameters", "message": "Invalid parameter: This request is not authorized to perform this operation.\r\nParameter name: backupContainerName (value: [backupcontainer])", 阅读全文
posted @ 2024-07-26 19:52 路边两盏灯 阅读(58) 评论(0) 推荐(0)
摘要:问题描述 Azure APIM服务日志中发现 java.lang.RuntimeException 错误,在进一步通过Application Insights采集的错误信息日志,发现真实的请求错误为:‘The remote name could not be resolved 'xxxx.xxx.x 阅读全文
posted @ 2024-05-21 18:04 路边两盏灯 阅读(55) 评论(0) 推荐(0)
摘要:问题描述 在为APIM服务配置了诊断日志(Diagnostic Setting),把日志收集在Log A Workspace中,需要验证日志中是否能查看到请求的错误信息。 所以想人为的来制造一些错误。经过网络搜索,参考Policy的文档介绍后,完成了以下3种错误 第一种:使用 return-resp 阅读全文
posted @ 2024-04-17 20:32 路边两盏灯 阅读(115) 评论(0) 推荐(1)
摘要:logs.applicationinsights.endpoint: “https://dc.applicationinsights.azure.cn/v2/track“ 阅读全文
posted @ 2024-03-19 20:32 路边两盏灯 阅读(62) 评论(0) 推荐(1)
摘要:问题描述 在Azure门户中,误删除API Management资源后,怎么办? 问题解答 遇见误删除的第一反应就是: 想恢复删除的内容,但是从门户上查看没有发现有可以操作的方面。 (错误,Azure APIM门户已经支持“一键恢复”功能:Recover deleted API Management 阅读全文
posted @ 2024-02-29 18:31 路边两盏灯 阅读(128) 评论(0) 推荐(1)
摘要:【Azure APIM】APIM 策略语句如何来设置多个Cookie值让浏览器保存HTTP Cookie(也叫 Web Cookie 或浏览器 Cookie)是服务器发送到用户浏览器并保存在本地的一小块数据。浏览器会存储 cookie 并在下次向同一服务器再发起请求时携带并发送到服务器上。服务器收到 HTTP 请求后,服务器可以在响应标头里面添加一个或多个 Set-Cookie 选项。浏览器收到响应后通常会保存下 Cookie,并将其放在 HTTP Cookie 标头内,向同一服务器发出请求时一起发送。 阅读全文
posted @ 2024-01-04 20:35 路边两盏灯 阅读(134) 评论(0) 推荐(1)
摘要:问题描述 需要在APIM策略中对请求所携带的Cookie中的token值进行JWT验证,如果获取Cookie中的值并且作为变量保存,然后在JWT 验证中使用呢? 问题解答 第一步:获取Cookie中的Token值 使用C#语句 @(context.Request.Headers.GetValueOr 阅读全文
posted @ 2024-01-03 22:25 路边两盏灯 阅读(53) 评论(0) 推荐(0)
摘要:问题描述 在APIM中配置JWT策略,验证JWT,如果认证失败,则跳转到 Azure Entra ID 的 Login 页面。 问题解答 要实现JWT验证失败后,跳转到 Azure Entra ID 的 Login 页面。需要使用到两种策略: validate-jwt :https://learn. 阅读全文
posted @ 2024-01-02 21:00 路边两盏灯 阅读(93) 评论(0) 推荐(0)