예제 #1
0
def get_ado_client(base_url: str, token: str) -> WorkItemTrackingClient:
    connection = Connection(base_url=base_url,
                            creds=BasicAuthentication("PAT", token))
    client = connection.clients_v6_0.get_work_item_tracking_client()
    return client
예제 #2
0
from dotenv import load_dotenv
load_dotenv()
import os
from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication
import pprint

# Fill in with your personal access token and org URL
personal_access_token = os.getenv("PAT")
organization_url = 'https://dev.azure.com/' + os.getenv("ORG")

# Create a connection to the org
credentials = BasicAuthentication('', personal_access_token)
connection = Connection(base_url=organization_url, creds=credentials)

# Get a client (the "core" client provides access to projects, teams, etc)
core_client = connection.clients.get_core_client()

# Get the list of projects in the org
projects = core_client.get_projects()

# Delete all existing projects
for project in projects:
    pprint.pprint(project.__dict__)
    core_client.queue_delete_project(project.id)

projects = {"infrastructure", "website"}

for project_name in projects:
    project = {
        "name": project_name,