Igor
Igor

Reputation: 308

Logic App calling WebAPI with managed identity what kind of token is added to request

In Azure I have a working logic app with a managed identity calling a WebAPI endpoint using a HTTP step. The endpoint is now decorated to AllowAnonymous. But I would like the get to the token/claims. If in case they are added by the logic app. So the thing I would like to know is a token (bearer,jwt) added by the Logic App? And some example code to get to them would be nice.

    [AllowAnonymous]   
    [HttpPost]
    [Route("API/datatest/handle/{Id}")]
    public async Task<HttpResponseMessage> HandleAsync(Data data, string Id)
    {
    //get to the token/claims here.
    }

    //or by attribute.
    [GetLoginAppTokenData]
    [HttpPost]
    [Route("API/datatest/handle/{Id}")]
    public async Task<HttpResponseMessage> HandleAsync(Data data, string Id)
    {
    //do moreenter code here
    }

Upvotes: 1

Views: 1848

Answers (1)

Joey Cai
Joey Cai

Reputation: 20067

1.Go to logic app> Identity> Turn on System assigned.

enter image description here

2.Go to the webapp >Authentication / Authorization> Turn on Azure Active Directory Authentication Provider. Refer to this article.

3.Go to the webapp>Access Control(IAM)>Add>Add role assignment, add role like Contributor to your service principal of your logic app.

enter image description here

4.Go to logic app designer add Http connector to authenticate access with managed identity.

Set Authentication as Managed Identity and add Audience as your webapp app clientId which registered in azure ad.

enter image description here

Then you could use Logic App MSI to visit Webapp. For more details, you could refer to this article.

Upvotes: 3

Related Questions