Created
September 6, 2019 13:58
-
-
Save Gorgoras/1fe534fd9b454412f81c8203c773c483 to your computer and use it in GitHub Desktop.
Call ADF pipeline with parameters, authenticating with a user or with a service principal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from azure.mgmt.datafactory import DataFactoryManagementClient | |
from azure.common.credentials import UserPassCredentials #To login with user and pass, use this. | |
from azure.common.credentials import ServicePrincipalCredentials #To login with service principal (appid and client secret) use this | |
subscription_id = "subsID" | |
#Use only one of these, depending on how you want to login. | |
credentials = UserPassCredentials(username="[email protected]", password="yourpass") #To login with user and pass | |
credentials = ServicePrincipalCredentials(client_id='appid', secret='client secret', tenant='tenantid') #To login with serv ppal | |
adf_client = DataFactoryManagementClient(credentials, subscription_id) | |
rg_name = "resource group name" | |
df_name = "data factory name" | |
p_name = "pipeline name" | |
params = { | |
"Param1":"value1", | |
"Param2":"value2" | |
} | |
adf_client.pipelines.create_run(rg_name, df_name, p_name, params) |
how to call a trigger instead using params
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this - it was exactly what I was looking for. However I think the API may have changed and I needed to use named parameters to get this to work for me