简体   繁体   English

Azure API 管理:如何使用 Microsoft Identity 对后端进行身份验证?

[英]Azure API Management: How to authenticate with Microsoft Identity to backend?

We host a .net WebAPI webapp in Azure.我们在 Azure 中托管了 .net WebAPI webapp。 The webapp uses Microsoft Identity/OAuth2 for authentication. webapp 使用 Microsoft Identity/OAuth2 进行身份验证。 For some tests, we authorized some users for the WebAPI.对于一些测试,我们授权一些用户使用 WebAPI。 This works as expected.这按预期工作。

Now we added Azure API Management as a front proxy for our WebAPI webapp.现在我们添加了 Azure API Management 作为我们 WebAPI webapp 的前端代理。 We added all endpoints but we're unable to enable the API Management to use the backend WebAPI, because it's unauthorized by nature.我们添加了所有端点,但我们无法启用 API 管理以使用后端 WebAPI,因为它本质上是未经授权的。 And we don't know how the API Management can access it, since it has no identity as we know that we could authorize.而且我们不知道 API 管理如何访问它,因为它没有我们知道我们可以授权的身份。

How does this need to be done?这需要怎么做?

You can achieve this be enabling Managed Identity on APIM .您可以通过在 APIM 上启用 Managed Identity来实现这一点。

Then you can use this MI in a policy to inject a JWT on backend requests.然后,您可以在策略中使用此 MI 在后端请求中注入 JWT。

<authentication-managed-identity resource="resource" client-id="clientid of user-assigned identity" output-token-variable-name="token-variable" ignore-error="true|false"/>  

https://docs.microsoft.com/en-us/azure/api-management/api-management-authentication-policies#ManagedIdentity https://docs.microsoft.com/en-us/azure/api-management/api-management-authentication-policies#ManagedIdentity

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Microsoft.Identity.Client.PublicClientApplication C# 验证 Azure 资源 API 的交互 - How to Authenticate Azure Resource API's Interactive using Microsoft.Identity.Client.PublicClientApplication C# 针对 Azure API 管理进行身份验证 - Authenticate Against Azure API Management 使用Microsoft Azure构建身份管理系统 - Building an Identity Management System using Microsoft Azure 如何通过https://management.azure.com api进行身份验证? - How to authenticate for https://management.azure.com api? 是否有用于身份管理的 Microsoft Azure Ansible 模块? - Is there a Microsoft Azure Ansible Module for Identity Management? Azure API 管理 + Azure 函数和托管标识 - Azure API Management + Azure Function and managed identity 如何使用用户名和密码验证 Microsoft Azure API - How to authenticate Microsoft Azure API's using username & Password Azure管理API无法使用ADAL进行身份验证 - Azure Management API fails to authenticate using ADAL Azure API 管理和后端 Web API - Azure API Management and Backend Web API Microsoft Azure-如何为Api管理导出和创建部署脚本 - Microsoft Azure - How to export and create deployment script for Api Management
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM