Access from Data Factory V2 resource with Github repository is not possible if personal access token is not valid. It will ask to login but everything is just redirecting and ending up with access denied.
“Retrieve GitHub Access Token. The personal access token is invalid. Please provide a valid token.”
The Data Factory settings for Git repository is set correct.
Checkout if the personal access token if has expired, it wasn’t.
In my case everything regarding the personal access token was fine. Both the validation and 2fa.
Solution
It turned out in this case it was a missing user rights or more correctly lack of user rights. The user’s role was only Reader.
Go to Azure Resource Group and navigate to Access control (IAM)
Find the user in Role assignments and press Add and designate the role assignment to be Contributor.
Now back in Data Factory you’ll be able to add the Github connection and be able to select the repo and branches.