microsoft / azure-devops-python-api

Azure DevOps Python API
https://docs.microsoft.com/azure/devops/integrate/index?view=azure-devops
MIT License
593 stars 200 forks source link

Update README.md #503

Open kimtth opened 3 months ago

kimtth commented 3 months ago

Establish a connection using Browser Interactive mode

kimtth commented 3 months ago

@microsoft-github-policy-service agree

kimtth commented 3 months ago

Sorry for typos.

  1. tenant_id=tenant_id -> tenant_id=_tenant_id
  2. "access_token": access_token -> "access_token": access_token.token
# Fill in with your tenant id and org URL
organization_url = 'https://dev.azure.com/YOURORG'
_tenant_id= 'YOURORG_TENANT_ID'

# Create a connection to the org
credentials = InteractiveBrowserCredential(tenant_id=_tenant_id)
# The scope for the token should be 499b84ac-1321-427f-aa17-267ca6975798/.default which provides access to Azure DevOps Services REST API.
access_token = credentials.get_token("499b84ac-1321-427f-aa17-267ca6975798/.default")
token_auth = BasicTokenAuthentication({"access_token": access_token.token})
connection = Connection(base_url=organization_url, creds=token_auth)
JF6 commented 3 months ago

Nice addition (can be considered part of SFI imo)

vs4vijay commented 2 months ago

It doesn't support refreshing the access token and other related use cases. We need proper support of Azure Identity in Azure DevOps SDK.