BruceHaley / ExportPipelineDefinitions

Export all Azure DevOps pipeline definitions so they can be searched globally

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extra step to link Classic pipelines TaskId with Extenison/Task name

ThomasWatling opened this issue · comments

You've linked to this tool from https://stackoverflow.com/questions/71250584/how-to-check-if-installed-extensions-are-used-in-pipelines as being useful in auditing the contents of pipelines, especially the inclusion of extensions. There is no default functionality in Azure DevOps to indicate if an installed extension is actually in use or not ("in use" = defined in a pipeline irrespective of when/whether the pipeline was run). Thanks - it's brilliant, and works well for YAML defined pipelines.

For classic pipelines, the output in the .json files doesn't list the extension/task name, instead it refers to taskId. This means that you can't only use the extension/task name (e.g. AmazonWebServices.aws-vsts-tools) for searching, you also need to know the TaskId and search for that...except I couldn't find an API call to link taskId and extension. However, there is an undocumented API at https://dev.azure.com/{{organization}}/_apis/distributedtask/tasks which lists extensions/tasks e.g.

{
	"value": [{
		"id": "{{the taskId we're looking for}}",
		"version": {},
		"friendlyName": "{{friendly name}}",
		"description": "{{description}}",
		"contributionIdentifier": "{{dotted extension/task name e.g. AmazonWebServices.aws-vsts-tools.S3Download}}"
	}]
}

This gives you a few options then for how you continue the audit/search for extensions in use in your pipeline definitions. I've not been able to compare if taskId is unique to an Azure DevOps organisation or is a parameter of the extension globally. Just wanted to share in case it's useful for adding to the Readme. Thanks!