Skip to content

Instantly share code, notes, and snippets.

@zoltanctoth
Created September 7, 2020 12:00
Show Gist options
  • Save zoltanctoth/2326648dd3b666fe4cf2bfd983140250 to your computer and use it in GitHub Desktop.
Save zoltanctoth/2326648dd3b666fe4cf2bfd983140250 to your computer and use it in GitHub Desktop.
List Azure Data Factory Pipelines and Run an ADF PIpeline using a Credential-based Service Principal Authentication
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.datafactory import DataFactoryManagementClient
from azure.mgmt.datafactory.models import *
subscription_id = '8d1dc324-4f8a-4be5-ae74-310e2f5596a5'
credentials = ServicePrincipalCredentials(client_id='dcf2637e-8f81-4bbb-a72e-ac2f291e328b', secret='<< secret >>', tenant='874cd0d6-f21a-4c6e-8239-51287476f635')
adf_client = DataFactoryManagementClient(credentials, subscription_id)
pipelines = adf_client.pipelines.list_by_factory("schneider-test", "Schneider-Test-Data-Factory")
for p in pipelines:
p: PipelineResource
adf_client.pipelines.create_run("schneider-test", "Schneider-Test-Data-Factory", pipeline_name=p.name)
print(f"Executing pipeline {p.name}")
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment