Question

Schnalbi on Thu, 03 Oct 2019 09:59:34


Hello,

I set up managed service identiity on my function app. I'm struggling how to connect to Azure DevOps from inside my function. The code snippet below from my function shows me a token and a secret when I run the code:

var azureServiceTokenProvider2 = new AzureServiceTokenProvider();
string accessToken = await azureServiceTokenProvider2.GetAccessTokenAsync("https://management.azure.com/").ConfigureAwait(false);
log.LogInformation($"Access Token:{accessToken}");
log.LogInformation("env " + Environment.GetEnvironmentVariable("MSI_SECRET"));

Personal access tokens are no option for me. The API call I'm targeting in Azure DevOps is as follows (Call works with PAT):

PATCH https://dev.azure.com/{orgName}/{projectName}/_apis/wit/workitems/{wiId}?api-version=5.1

Best regards

Albrecht

Replies

KetanChawda-MSFT on Fri, 04 Oct 2019 08:58:41


Until now, some services in Azure does not support MSI identity authentication, including Azure Devops.

You can refer to Services that support managed identities for Azure resources.

You can also up-vote the existing feature request in official Azure DevOps forum. You can comment and vote it there. Product Group are reviewing these suggestion regularly and considering take it as plan.

For now you can use PAT to access DevOps API's from Azure Function as documented here

KetanChawda-MSFT on Thu, 10 Oct 2019 05:10:45


Hello Schnalbi,

Any update on this thread? Did the above post helped answering your question?