microsoft-azure-webjobs-extensions-authentication-events-dotnet 是什么?
此 Skill 指导 Azure Functions 使用 Microsoft.Azure.WebJobs.Extensions.AuthenticationEvents 响应 Microsoft Entra 自定义认证事件,包括发Token时添加claims、调整注册属性、校验提交与自定义OTP发送。必须先在Entra建立并绑定自定义扩展。
中文说明由本站依据来源整理;英文原文保留在页面下方。
怎么接入你的 Agent?
- 定位完整 Skill 目录
打开本项目来源,核对
SKILL.md及其引用的脚本和资料。 - 交给你正在用的 Agent
在下面选择客户端,展开并复制安装指令,让 Agent 读取来源后选择安装方式。
- 确认识别,再做具体任务
让 Agent 回报安装目录和识别到的名称
microsoft-azure-webjobs-extensions-authentication-events-dotnet,然后按本页使用示例提供材料。
展开并复制给 Codex 的安装指令
安装并检查 microsoft-azure-webjobs-extensions-authentication-events-dotnet
请在 Codex 的当前工作环境中安装并检查 microsoft-azure-webjobs-extensions-authentication-events-dotnet 这个 Skill。
项目身份:microsoft/skills / microsoft-azure-webjobs-extensions-authentication-events-dotnet
来源:https://github.com/microsoft/skills/blob/f03ec5392f7a0f3aca12af47477e92f1edf7b44c/.github/plugins/azure-sdk-dotnet/skills/microsoft-azure-webjobs-extensions-authentication-events-dotnet/SKILL.md
已定位的源文件:.github/plugins/azure-sdk-dotnet/skills/microsoft-azure-webjobs-extensions-authentication-events-dotnet/SKILL.md
1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。展开并复制给 Claude Code 的安装指令
安装并检查 microsoft-azure-webjobs-extensions-authentication-events-dotnet
请在 Claude Code 的当前工作环境中安装并检查 microsoft-azure-webjobs-extensions-authentication-events-dotnet 这个 Skill。
项目身份:microsoft/skills / microsoft-azure-webjobs-extensions-authentication-events-dotnet
来源:https://github.com/microsoft/skills/blob/f03ec5392f7a0f3aca12af47477e92f1edf7b44c/.github/plugins/azure-sdk-dotnet/skills/microsoft-azure-webjobs-extensions-authentication-events-dotnet/SKILL.md
已定位的源文件:.github/plugins/azure-sdk-dotnet/skills/microsoft-azure-webjobs-extensions-authentication-events-dotnet/SKILL.md
1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。展开并复制给 Cursor 的安装指令
安装并检查 microsoft-azure-webjobs-extensions-authentication-events-dotnet
请在 Cursor Agent 的当前工作环境中安装并检查 microsoft-azure-webjobs-extensions-authentication-events-dotnet 这个 Skill。
项目身份:microsoft/skills / microsoft-azure-webjobs-extensions-authentication-events-dotnet
来源:https://github.com/microsoft/skills/blob/f03ec5392f7a0f3aca12af47477e92f1edf7b44c/.github/plugins/azure-sdk-dotnet/skills/microsoft-azure-webjobs-extensions-authentication-events-dotnet/SKILL.md
已定位的源文件:.github/plugins/azure-sdk-dotnet/skills/microsoft-azure-webjobs-extensions-authentication-events-dotnet/SKILL.md
1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。展开并复制给 当前 Agent 的安装指令
安装并检查 microsoft-azure-webjobs-extensions-authentication-events-dotnet
请在 当前 Agent 的当前工作环境中安装并检查 microsoft-azure-webjobs-extensions-authentication-events-dotnet 这个 Skill。
项目身份:microsoft/skills / microsoft-azure-webjobs-extensions-authentication-events-dotnet
来源:https://github.com/microsoft/skills/blob/f03ec5392f7a0f3aca12af47477e92f1edf7b44c/.github/plugins/azure-sdk-dotnet/skills/microsoft-azure-webjobs-extensions-authentication-events-dotnet/SKILL.md
已定位的源文件:.github/plugins/azure-sdk-dotnet/skills/microsoft-azure-webjobs-extensions-authentication-events-dotnet/SKILL.md
1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。装好以后,具体怎么用?
准备哪些材料
- 安装 Microsoft.Azure.WebJobs.Extensions.AuthenticationEvents,并按当前 Azure Functions WebJobs SDK运行模型配置应用。
- 在 Entra 注册 API、暴露 CustomAuthenticationExtension.Receive.Payload scope、创建 custom authentication extension并绑定用户流。
- 外部数据、短信供应商和 Graph 调用分别需要安全凭据、网络策略与最小权限。
实际使用顺序
- 先确认当前登录/注册 user flow会触发目标事件,并建立 Function endpoint 与Entra扩展配置。
- 根据事件类型解析 request data:TokenIssuanceStart添加claims;AttributeCollectionStart配置表单;Submit验证/修改属性。
- OnOtpSend仅在收到有效手机号和OTP后调用短信/邮件服务,返回成功/失败 action;不要在日志记录OTP。
- 为外部 API 设置超时、失败兜底、correlation ID和幂等处理;测试不同身份、缺字段与服务不可用路径。
从一个具体任务开始
本站根据源文件编写的使用示例,未在本站实际运行。示例中的文件由你提供。
复制一个具体任务
请使用此 Skill 审查我自定义注册属性的 Azure Function 设计:列出Submit事件需要校验哪些字段、如何返回逐字段错误、扩展绑定和日志边界。先提供检查方案,不部署Function或发送OTP。得到事件处理审查清单;没有创建Entra扩展、调用API或发送验证码。
使用条件与边界
- 此扩展会处在登录/注册关键路径中,失败延迟或错误响应可能阻断用户认证。
- claims会进入ID/access token,必须最小化且不能放入敏感个人数据或高频变动授权信息。
- 源文 local.settings.json 使用本地开发占位,不应复制到生产;OTP和用户信息均属敏感数据。
常见问题
添加了Function触发器但登录时没触发怎么办?
确认Entra custom authentication extension的target URL、认证方式、API scope和user flow绑定,再核对事件类型和Function路由。
外部API超时会怎样?
应设计短超时和符合该事件的安全兜底;认证扩展位于登录路径,慢请求可能直接影响登录体验或失败。
来源原文与资料状态
- 源文件
- 已保存 SKILL.md,抓取于 2026-11-16T12:36:35.145Z
- 中文使用说明
- 已针对下方源文件版本整理用途、用法和常见问题
- 安装与任务测试
- 本站未执行安装或任务测试
- 来源复核
- 本页中文用法已对照保存版本的完整 SKILL.md 阅读整理
展开 SKILL.md 原文、章节与历史收录资料
.github/plugins/azure-sdk-dotnet/skills/microsoft-azure-webjobs-extensions-authentication-events-dotnet/SKILL.md · 抓取时间 2026-11-16T12:36:35.145Z
以下保留源文件的 description、章节及摘录,供核对中文说明;完整文件通过上方链接打开。
抓取成功不代表已完成安装或任务测试。
Microsoft Entra Authentication Events SDK for .NET. Azure Functions triggers for custom authentication extensions. Use for token enrichment, custom claims, attribute collection, and OTP customization in Entra ID. Triggers: "Authentication Events", "WebJobsAuthenticationEventsTrigger", "OnTokenIssuanceStart", "OnAttributeCollectionStart", "custom claims", "token enrichment", "Entra custom extension", "authentication extension".
查看源文件章节 / Source sections
- 原文:Microsoft.Azure.WebJobs.Extensions.AuthenticationEvents (.NET)
- 安装 / Installation
- 原文:Supported Events
- 原文:Core Workflows
- 原文:1. Token Enrichment (Add Custom Claims)
- 原文:2. Token Enrichment with External Data
- 原文:3. Attribute Collection - Customize UI (Start Event)
- 原文:4. Attribute Collection - Validate Submission (Submit Event)
- 原文:5. Custom OTP Delivery
- 原文:6. Function App Configuration
- 原文:Key Types Reference
- 原文:Entra ID Configuration
- 原文:Required App Registration Settings
- 原文:Best Practices
- 原文:Error Handling
- 原文:Related SDKs
- 原文:Reference Links
原文:Microsoft.Azure.WebJobs.Extensions.AuthenticationEvents (.NET)
Azure Functions extension for handling Microsoft Entra ID custom authentication events.
安装 / Installation
```bash dotnet add package Microsoft.Azure.WebJobs.Extensions.AuthenticationEvents ``` **Current Version**: v1.1.0 (stable)
原文:Supported Events
| Event | Purpose | |-------|---------| | `OnTokenIssuanceStart` | Add custom claims to tokens during issuance | | `OnAttributeCollectionStart` | Customize attribute collection UI before display | | `OnAttributeCollectionSubmit` | Validate/modify attributes after user submission | | `OnOtpSend` | Custom OTP delivery (SMS, email, etc.) |
原文:1. Token Enrichment (Add Custom Claims)
Add custom claims to access or ID tokens during sign-in. ```csharp using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.AuthenticationEvents; using Microsoft.Azure.WebJobs.Extensions.AuthenticationEvents.TokenIssuanceStart; using Microsoft.Extensions.Logging; public static class TokenEnrichmentFunction { [FunctionName("OnTokenIssuanceStart")] public static WebJobsAuthenticationEventResponse Run( [WebJobsAuthenticationEventsTrigger] WebJobsTokenIssuanceStartRequest request, ILogger log) { log.LogInformation("Token issuance event for user: {UserId}", request.Data?.AuthenticationContext?.User?.Id); // Create response with custom claims var response = new WebJobsTokenIssuanceStartResponse(); // Add claims to the token response.Actions.Add(new WebJobsProvideClaimsForToken { Claims = new Dictionary<string, string> { { "customClaim1", "customValue1" }, { "department", "Engineering" }, { "costCenter", "CC-12345" }, { "apiVersion", "v2" } } }); return response; } } ```
原文:2. Token Enrichment with External Data
Fetch claims from external systems (databases, APIs). ```csharp using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.AuthenticationEvents; using Microsoft.Azure.WebJobs.Extensions.AuthenticationEvents.TokenIssuanceStart; using Microsoft.Extensions.Logging; using System.Net.Http; using System.Text.Json; public static class TokenEnrichmentWithExternalData { private static readonly HttpClient _httpClient = new(); [FunctionName("OnTokenIssuanceStartExternal")] public static async Task<WebJobsAuthenticationEventResponse> Run( [WebJobsAuthenticationEventsTrigger] WebJobsTokenIssuanceStartRequest request, ILogger log) { string? userId = request.Data?.AuthenticationContext?.User?.Id; if (string.IsNullOrEmpty(userId)) { log.LogWarning("No user ID in request"); return new WebJobsTokenIssuanceStartResponse(); } // Fetch user data from external API var userProfile = await GetUserProfileAsync(userId); var response = new WebJobsTokenIssuanceStartResponse(); response.Actions.Add(new WebJobsProvideClaimsForToken { Claims = new Dictionary<string, string> { { "employeeId", userProfile.EmployeeId }, { "department", userProfile.Department }, { "roles", string.Join(",", userProfile.Roles) } } }); return response; } private static async Task<UserProfile> GetUserProfileAsync(string userId) { var response = await _httpClient.GetAsync($"https://api.example.com/users/{userId}"); response.EnsureSuccessStatusCode(); var json = await response.Content.ReadAsStringAsync(); return JsonSerializer.Deserialize<UserProfile>(json)!; } } public record UserProfile(string EmployeeId, string Department, string[] Roles); ```
原文:3. Attribute Collection - Customize UI (Start Event)
Customize the attribute collection page before it's displayed. ```csharp using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.AuthenticationEvents; using Microsoft.Azure.WebJobs.Extensions.AuthenticationEvents.Framework; using Microsoft.Extensions.Logging; public static class AttributeCollectionStartFunction { [FunctionName("OnAttributeCollectionStart")] public static WebJobsAuthenticationEventResponse Run( [WebJobsAuthenticationEventsTrigger] WebJobsAttributeCollectionStartRequest request, ILogger log) { log.LogInformation("Attribute collection start for correlation: {CorrelationId}", request.Data?.AuthenticationContext?.CorrelationId); var response = new WebJobsAttributeCollectionStartResponse(); // Option 1: Continue with default behavior response.Actions.Add(new WebJobsContinueWithDefaultBehavior()); // Option 2: Prefill attributes // response.Actions.Add(new WebJobsSetPrefillValues // { // Attributes = new Dictionary<string, string> // { // { "city", "Seattle" }, // { "country", "USA" } // } // }); // Option 3: Show blocking page (prevent sign-up) // response.Actions.Add(new WebJobsShowBlockPage // { // Message = "Sign-up is currently disabled." // }); return response; } } ```
文件 SHA256:b14e4f567c11c8c2a9d06baefc9095ab1cf7ec8e0f5851f271d77d4491ca86e4
仓库许可证记录:MIT;skill-declaration-captured-not-interpreted,查看来源。
Microsoft Entra Authentication Events SDK for .NET. Azure Functions triggers for custom authentication extensions. Use for token enrichment, custom claims, attribute collection, and OTP customization in Entra ID. Triggers: "Authentication Events", "WebJobsAuthenticationEventsTrigger", "OnTokenIssuanceStart", "OnAttributeCollectionStart", "custom claims", "token enrichment", "Entra custom extension", "authentication extension".
历史收录数据
| 来源仓库 | microsoft/skills |
|---|---|
| Skill源路径 | .github/plugins/azure-sdk-dotnet/skills/microsoft-azure-webjobs-extensions-authentication-events-dotnet/SKILL.md |
安装前请让使用的Agent先读取这个SKILL.md及其所在目录,确认依赖和所需权限。此页不生成未经来源验证的安装命令。
