Hi All, anyone can get flows from Azure DevOps ser...
# prefect-community
d
Hi All, anyone can get flows from Azure DevOps service successfully using git storage? I got this error "Failed to load and execute Flow's environment: HTTPUnauthorized('No valid credentials provided')". It seems that git storage doesn't support private access token to access azure devops? This is my code: flow.storage = Git(     repo="xxxxxxx/prefect/_git/prefect",                            # name of repo     flow_path ="./flows/azuredevops.py",                    # location of flow file in repo     branch_name ="main",     repo_host="xxxxx@dev.azure.com",                    # repo host name     git_token_secret_name ="azuresecret" )
k
It does. It’s just the format is hard to figure out. I tested it and detailed it here .
💯 1
d
It works perfectly! Thanks Kevin.
👍 1
x
Hi David. Are you using prefect cloud in this case? I am experiencing same issue with prefect cloud. What format is your devops url? dev.azure.com/org or org.visualstudio.com thx
d
k
I am just curious, why are you on Azure Devops? Is there no Github integration on Azure? I was on DevOps at my last job and it’s a bit painful
d
Azure DevOps supports all Git clients. Theoretically, If tools are compatible with Git, they could be compatible with Azure DevOps. We use Azure DevOps because of Corporate policy though.
k
Ahh that’s good to know!
x
Hey Kevin. Unfortunately, I still get anonying NotGitRepository error when I try your example above. I did following https://username:PAT@dev.azure.com/org/project/_git/repo this may sound stupid but what did I miss🤣
d
@Xiaoshen Hou, if your corp uses AAD, make sure the username is the userid in AAD .
and that PAT should have more than "read" privilege.
x
hey @David Yang, thx for the tip, the userid, do you refer to the user principle name or object id in AAD?
d
I used UPN. not object id
x
I must say I've tried to add both and even add the PAT to full access but still prefect cloud is complaining "NotGitRepository", I test all locally at CLI with git clone, work perfectly🤣
d
This is my code: Storage = Git(     repo="[Org Name]/[Project Name]/_git/[repo name]",                            # name of repo     flow_path ="./flows/dbtflow.py",                    # location of flow file in repo     branch_name ="main",     repo_host="[Org Name]",                    # repo host name     git_clone_url_secret_name  ="azureflowurl"           # url in this format  https//[UPN][personal access token]@dev.azure.com/[Org Name]/[Project Name]/_git/[repo name] ) azureflowurl is the secret name I set in Prefect cloud. Hope it helps...