-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Personal Access Token Resource/Data Source to create/update/revok… #1140
base: main
Are you sure you want to change the base?
Add Personal Access Token Resource/Data Source to create/update/revok… #1140
Conversation
…e/get Personal Access Tokens using the 7.1-preview API. Requires a custom build of azure-devops-go-api that adds this feature. Currently there is an issue with Authentication that may require additional work to resolve.
@xuzhang3 Since this change depends on a change to the Azure DevOps Go API and that project seems to be no longer solvent could someone take over that repository and update this provider to use it? |
@cparkins how do you generate the |
@xuzhang3 - I did a combination of things to generate the SDK file. First I used some automation tools to use the OpenAPI definitions to generate the endpoints and models. I tried 2 different tools, neither of which seemed to match the other files. And then I took the one that was closest and tried to match it up manually. The result can be found here: https://github.com/microsoft/azure-devops-go-api/pull/164/files#diff-b7bfa06027df021e82f51c88b0c7d4bd044c3c618faddc04f6ea1a2569cc1e82R23 After making those modifications I linked my local build to my local terraform providers and then I was able to get the result seen above. I believe this issue is related to the fact that an "On Behalf Of" OAuth Token has to be used to make this type of request. I think there may be another change for another Resource that has added OIDC support and that might be capable of solving that issue. But even if that is resolved it does not resolve the problem that the underlying library may never get updated as it seems to be defunct. I do have a question about what you said though. What do you mean by "The location is mapped to a configuration template for generating the request URLs, which is managed by the service"? Can you show me an example of what you mean? |
@cparkins The vendor files come from the azuredevops-go-sdk. If you generated the tokens SDK yourself, you should not mix it with the . We will add the newly generated SDK directly to this project (https://github.com/microsoft/terraform-provider-azuredevops/tree/main/azuredevops/utils) This is one of the workarounds to solve the Regarding the locations, you can get all the API locations by |
@xuzhang3 The repository you linked is redirecting to the repository that I have created the PR to add the Token endpoints for. Is there an example of how to do the following:
Any information or examples you can provide would be helpful. Or if you could take the work that I have done and branch it The API Specifications that I used were from here: https://github.com/MicrosoftDocs/vsts-rest-api-specs |
@cparkins As I know the |
Add the ability to create/update/revoke/get Personal Access Tokens using the 7.1-preview API. Currently this requires a custom build of azure-devops-go-api that adds these features.
In testing there is currently an issue Authenticating against the Azure DevOps API which is difficult to understand. I believe this issue is related to the fact that these endpoints require an OAuth 2.0 token:
https://learn.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/service-principal-managed-identity?toc=%2Fazure%2Fdevops%2Forganizations%2Fsecurity%2Ftoc.json&view=azure-devops#get-a-microsoft-entra-id-token
Here is an example of the error seen when debug logging is enabled:
Until these issues are resolved this code is unusable. I submitted the PR to see if I could recruit some help in getting this fully tested (I have been able to get these endpoints working without Terraform).
All Submissions:
What about the current behavior has changed?
A new Resource and Data Source are added to represent Personal Access Tokens.
Issue Number:
Does this introduce a change to
go.mod
,go.sum
orvendor/
?This change requires the addition of the v7/tokens module.
Does this introduce a breaking change?
Any relevant logs, error output, etc?
See above.
Other information
There is currently an issue with the Authentication methods that the Provider uses that requires some additional work to get this fully functional.