简体   繁体   English

使用托管标识从逻辑应用调用 Azure AD 保护的 API

[英]Calling an Azure AD Protected API from Logic App using Managed Identity

We are having an Azure AD Protect API which is hosted on prem.我们有一个托管在本地的 Azure AD Protect API。 We have a requirement to call this API from Logic App.我们需要从 Logic App 调用此 API。 We have currently created or registered a new client App in App Registration for this logic App and have provided the necessary permissions and have called API passing the Bearer Token.我们目前在应用注册中为此逻辑应用创建或注册了一个新的客户端应用,并提供了必要的权限并调用了传递承载令牌的 API。

My question, is there a way we can leverage Managed Identity for Logic App (either User Assigned or System Assigned) for calling the API?我的问题是,有没有一种方法可以利用逻辑应用程序的托管标识(用户分配的或系统分配的)来调用 API?

Yes there is.就在这里。 I wrote an article on the topic (though it is not specific to Logic Apps): https://joonasw.net/view/calling-your-apis-with-aad-msi-using-app-permissions .我写了一篇关于这个主题的文章(虽然它不是特定于逻辑应用程序): https : //joonasw.net/view/calling-your-apis-with-aad-msi-using-app-permissions

You will need to create an appRoleAssignment that gives an application permission to your managed identity service principal.您将需要创建一个appRoleAssignment ,为您的托管标识服务主体提供应用程序权限。 To do this, we must use PowerShell or Microsoft Graph API.为此,我们必须使用 PowerShell 或 Microsoft Graph API。 With Azure AD PowerShell , we can do this:使用Azure AD PowerShell ,我们可以做到:

Connect-AzureAD

New-AzureADServiceAppRoleAssignment -ObjectId $miSpId -Id $appRoleId -PrincipalId $miSpId -ResourceId $targetApiSpId

There we have 3 arguments you need to find:我们需要找到 3 个参数:

  1. miSpId: The objectId of the Managed Identity (easy, we can find this from the Identity blade in the Logic App) miSpId:托管标识的对象标识(很简单,我们可以从逻辑应用程序的标识刀片中找到它)
  2. appRoleId: The id of the appRole defined on your API's manifest (this should be easy to find as well, it's in your API's manifest) appRoleId:在您的 API 清单中定义的 appRole id(这也应该很容易找到,它在您的 API 清单中)
  3. targetApiSpId: The objectId of the target API service principal (this one you can get by going to Enterprise Applications and finding your API there) targetApiSpId:目标 API 服务主体的 objectId(您可以通过转到 Enterprise Applications 并在那里找到您的 API 来获得该对象)

暂无
暂无

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

相关问题 使用托管标识从 Azure 逻辑应用到 Azure Function 进行身份验证 - Authenticate from Azure Logic app to Azure Function using Managed Identity 使用托管标识和 REST API 从 VM 调用 Azure 函数 - Calling Azure function from VM using managed identity and REST API 使用托管身份从Logic App中通过身份验证调用Azure函数 - Calling an Azure Function with authentication from a Logic App using Managed Identities 使用 Azure CLI/Powershell 获取逻辑应用的托管标识 ObjectID - Get Managed Identity ObjectID of Logic App using Azure CLI/Powershell 使用托管标识从 python azure 函数调用 API - Calling API from python azure function with managed identity How to call a protected API from an Azure Function App using the identity of the authenticated caller (Service Principal) to the Function App? - How to call a protected API from an Azure Function App using the identity of the authenticated caller (Service Principal) to the Function App? 对部署到 Azure 的应用程序使用 Azure 托管标识? - Using Azure Managed Identity for app deployed to Azure? 使用用户分配的托管标识访问 Azure AD B2C 和 MS Graph API - Access Azure AD B2C with MS Graph API using User-Assigned Managed Identity 将 Azure Web 应用程序用于具有托管标识的容器 - Using Azure Web App for Containers with managed identity 使用托管标识从 Azure 数据工厂触发逻辑应用程序工作流 - Triggering Logic Apps Workflow from Azure Data Factory using Managed Identity
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM