Data Factory Github personal access token is invalid

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.

Data Factory Github personal access token is invalid

Checkout if the personal access token if has expired, it wasn’t.

Data Factory Github personal access token is invalid

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)

Data Factory Github personal access token is invalid

Find the user in Role assignments and press Add and designate the role assignment to be Contributor.

Data Factory Github personal access token is invalid

Now back in Data Factory you’ll be able to add the Github connection and be able to select the repo and branches.

Data Factory Github personal access token is invalid