Skip to main content

Azure Pipelines

Using Azure Pipelines, you can easily create/update and query entities in Port.

Github Illustration

๐Ÿ’ก Common Azure Pipelines usageโ€‹

Port's API allows for easy integration between Port and your Azure Pipeline jobs, for example:

  • Report the status of a running CI job;
  • Update the software catalog about a new build version for a microservice;
  • Get existing entities.


To interact with Port using Azure Pipelines, you will first need to define your Port credentials as variables for your pipeline. Then, pass the defined variables to your pipeline script, for example, Python:

- task: PythonScript@0
PORT_CLIENT_ID: $(PORT_CLIENT_ID) # The variable name for your Port clientId
PORT_CLIENT_SECRET: $(PORT_CLIENT_SECRET) # The variable name for your Port clientSecret
scriptSource: "filePath"
scriptPath: ""

Make sure you have an existing Blueprint in your Port installation to create/update entities.

Working with Port's APIโ€‹

Here is an example snippet showing how to integrate a job that uses Port's API with your existing Azure pipelines using Python:

Add the following task to your Azure pipeline:

Azure pipeline YAML
- script: |
pip install -r port_requirements.txt
- task: PythonScript@0
scriptSource: "filePath"
scriptPath: ""


In the following example, we use Python modules which need to be installed. You can use the following requirements.txt:


Create the following Python script in your repository to create or update Port entities as part of your pipeline:

import os
import requests
import json

# These are the credentials passed by the variables of your pipeline to your tasks and in to your env
CLIENT_ID = os.environ['PORT_CLIENT_ID']

credentials = {
'clientId': CLIENT_ID,
'clientSecret': CLIENT_SECRET
token_response ="{API_URL}/auth/access_token", json=credentials)
access_token = token_response.json()['accessToken']

headers = {
'Authorization': f'Bearer {access_token}'

entity_json = {
"identifier": "example-entity",
"properties": {
"myStringProp": "My value",
"myNumberProp": 1,
"myBooleanProp": true,
"myArrayProp": ["myVal1", "myVal2"],
"myObjectProp": {"myKey": "myVal", "myExtraKey": "myExtraVal"}

# request url : {API_URL}/blueprints/<blueprint_id>/entities
create_response ='{API_URL}/blueprints/test-blueprint/entities?upsert=true', json=entity_json, headers=headers)
print(json.dumps(get_response.json(), indent=4))


Refer to the examples page for practical examples of working with Port using Azure Pipelines.