0

With Azure Devops Services, I need to get azure devops user id which triggered a release, from task.json.

I've got a datasourcebinding with Azure API Management service. This has to get Azure API Management tag based on user id. I've tried different approach :

  {
    "target": "TEST",
    "endpointId": "$(ConnectedServiceName)",
    "endpointUrl": "{{endpoint.url}}/subscriptions/{{endpoint.subscriptionId}}/resourceGroups/$(ResourceGroupName)/providers/Microsoft.ApiManagement/service/$(APIM)/products?tags=**$(Release.RequestedForId)**&api-version=2019-12-01",
    "resultSelector": "jsonpath:$.value[*]",
    "resultTemplate": "{\"Value\" : \"{{{id}}}\", \"DisplayValue\" : \"{{{properties.displayName}}}\" }"
  },

I tried also with {{Release.RequestedForId}} but it didn't work.

I saw different resources for datasourcebinding support :

tfs:teamfoundation – Any micro service hosted within TFS (e.g. Build, Test etc.) tfs:packaging – Packaging service tfs:feed – Feed service tfs:rm – Release Management service tfs:governance - Governance service tfs:ems - Extension Management service

I found examples for tfs:feed and tfs:teamfoundation only.

Is there any section for users ? Is there any additional information apart from Azure Devops Services REST API ?

Quite few examples in but none for user request.

Is it possible to get current context release variables or azure devops user id directly in task.json ?

This would be a huge help.

Thank you !

gab
  • 81
  • 9
  • Not get your response for several days, would you please share your latest information about this issue? If you have any concern, feel free to share it here. – Hugh Lin Apr 27 '20 at 01:42

1 Answers1

0

You made a small misatke. Instead of Release.RequestedForId please give a try for Release.Deployment.RequestedFor of Release.Deployment.RequestedForId

Docs for Release.Deployment.RequestedFor says:

The display name of the identity that triggered (started) the deployment currently in progress. Not available in TFS 2015.

Example: Mateo Escobedo

Docs for Release.Deployment.RequestedForId says:

The ID of the identity that triggered (started) the deployment currently in progress. Not available in TFS 2015.

Example: 2f435d07-769f-4e46-849d-10d1ab9ba6ab

You have this written here.

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107