Azure / Azure/azure-devops-cli-extension

PersonalAccessToken not set on GitHub Service Endpoint

Open
#1,056 1 comment 0 reactions 0 assignees View on GitHub
Area: ProToCol bug
Dominant language
Python
Stars
682
Forks
278
Avg merge
3d 23h
Merged PRs (30d)
3

Description

Azure Cli Version: 2.12.1
Azure-Devops extension version: 0.18.0

I am trying to create a GitHub service connection using the `az devops service-endpoint github create` command but I can't seem to set the personal access token (PAT).

Steps to reproduce:

1. Create a [GitHub PAT](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token)
2. Set the environment variable according to the [docs](https://docs.microsoft.com/en-us/azure/devops/cli/service-endpoint?view=azure-devops):

export AZURE_DEVOPS_EXT_GITHUB_PAT=

3. Run the command:

az devops service-endpoint github create \
--github-url https://github.com \
--name MyServiceConnection \
--org
--project

The `accessToken` is always set to `null` in the output and if I browse to the portal (dev.azure.com/MyOrganization) to verify the connection, it's not there either:

{
"administratorsGroup": null,
"authorization": {
"parameters": {
"accessToken": null
},
"scheme": "PersonalAccessToken"
},
"createdBy": {
...
},
"data": {},
"description": null,
"groupScopeId": null,
"id": "08611b67-f551-406c-b2bd-df30f369f7d4",
"isReady": true,
"isShared": false,
"name": "MyServiceConnection",
"operationStatus": null,
"owner": "library",
"readersGroup": null,
"serviceEndpointProjectReferences": [
{
"name": "MyServiceConnection ",
"projectReference": {
"id": "...",
"name": null
}
}
],
"type": "github",
"url": "https://github.com"
}

I get the same result if I don't set the `AZURE_DEVOPS_EXT_GITHUB_PAT` environment variable but enter the PAT manually in the prompt.

What am I doing wrong?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.