1
votes

Scenario:- we've created an application that has to update a few details in the discussion field of the azure DevOps task. But the azure DevOps account that we want to access is the clients. They have provided access to that ADO for us

But we want to update the task on ADO using the "Azure-DevOps" client library (python) which uses the rest API under the hood

https://github.com/microsoft/azure-devops-python-api
https://docs.microsoft.com/en-us/rest/api/azure/devops/?view=azure-devops-rest-6.1

I know that we can achieve this using the PAT token

But as the client is not ready to give the PAT token, we are exploring other ways to access the API The client is ready to give us APP-ID & APP-Secret (he'll configure in AAD) or else he is also okay with a service account

I don't know how to use the APP-ID & APP-Secret Or a service account to authenticate the API of ADO, could anyone share your views

below is the code that I am using to authenticate with the PAT token

@Python
personal_access_token = 'izpjkfptjl'
organization_url = 'https://microsoftit.visualstudio.com/{organisation}/{project}'
Credentials1 = BasicAuthentication('', personal_access_token)
connection = Connection(base_url=organization_url, creds=credentials)
work_client  = connection.clients.get_work_item_tracking_client()
WI = work_client.get_work_item(3)

could you let me know how to if its possible, or else at least with userName & password?.

if I use userName & password it's returning 401 authorized

Questions- I want to communicate with the above ADO using App ID or APP secret Or service account if these 2 are not possible at lease by UserName password

1
If you want to call devops rest API with username and password, please refer to github.com/microsoft/azure-devops-dotnet-samples/blob/main/…Jim Xu
@JimXU could you help me in Python, is there some resource available in pythonuser8701560
Could you please tell me what you want to know how to do with python?Jim Xu
Its not a python webapp on azure, its a standalone VM with windows OS on Azure ,on which we run our python code , and that code needs to update the details on a Azure devops tasksuser8701560
As you mentioned, they have provided access to that ADO for you. Can you access their organization and create PAT yourself?Walter

1 Answers

1
votes