您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

受保护的 Web API - 移到生产环境Protected web API - move to production

现在你已了解如何保护 Web API,将应用程序移动到生产环境时,需要考虑以下事项。Now that you know how to protect your web API, here are some things to consider when moving your application to production.

启用日志记录Enable logging

为了帮助对调试和身份验证失败进行故障排除,Microsoft 身份验证库提供了内置的日志记录支持。To help in debugging and authentication failure troubleshooting scenarios, the Microsoft Authentication Library provides built-in logging support. 以下文章介绍了如何记录每个库:Logging is each library is covered in the following articles:

一些数据收集建议如下:Here are some suggestions for data collection:

  • 用户在有问题时可能会寻求帮助。Users might ask for help when they have problems. 最佳做法是捕获日志并将其临时存储。A best practice is to capture and temporarily store logs. 提供一个供用户上传日志的位置。Provide a location where users can upload the logs. MSAL 提供日志记录扩展来捕获有关身份验证的详细信息。MSAL provides logging extensions to capture detailed information about authentication.

  • 如果遥测可用,请通过 MSAL 启用它,以收集有关用户如何登录应用的数据。If telemetry is available, enable it through MSAL to gather data about how users sign in to your app.

验证你的集成Validate your integration

按照 Microsoft 标识平台集成清单测试你的集成。Test your integration by following the Microsoft identity platform integration checklist.

后续步骤Next steps

方案:调用 Web API 的 Web API 中了解如何调用下游 API。Learn how to call a downstream API in Scenario: A web API that calls web APIs.

通过 GitHub 上的教程和示例了解更多信息:Learn more with tutorials and samples on GitHub: