Closed msl0 closed 1 month ago
When I extended the permissions with ManageAdvSecScanning
(Advanced Security: manage settings), the problem disappeared. It looks like this permission was only required for deletion. The permissions required to create new repositories are:
Create repository
Advanced Security: manage settings
It would be good to include this information in the documentation
@msl0 I tried with SPN but I can still managed the git repository with:Advanced Security
disabled
Run with PAT(permission required) - **Code**: Read, Create, & Manage.
@xuzhang3 does it make a difference that I used the pipeline user (ProjectName Build Service) token instead of PAT?
@msl0 This depends on the permissions granted to the token (ProjectName Build Service)
Community Note
Terraform (and Azure DevOps Provider) Version
Affected Resource(s)
azuredevops_git_repository
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
I should be able to recreate the existing repository in another project if the permissions are the same in both projects
Actual Behavior
Provider deletes the repository of the old project, but when creating the repository in the new project I get this error:
TF401027: You need the Git 'ManageAdvSecScanning' permission to perform this action. Details: identity 'Build\<project_collection_build_service_id>', scope 'repository'.
. When I clear the state and run Terraform, a new repository is created and the mentioned error does not appear, which proves that no additional permissions are required beyond those currently granted.Steps to Reproduce
terraform apply
terraform apply
Important Factoids
I noticed that during this operation, despite deleting the old repository from Azure DevOps, Terraform does not update the state in case of a problem, which causes another problem that I mentioned here
References