DevTstLabs - How to add Repository Azure DevOps (name.visualstudio.com)

MaciekK 11 Reputation points
2021-06-22T02:56:29.15+00:00

Hello,
I am trying to add repository within "Dev Test Lab" in Azure Portal. Configuration and policies > Repositories > Add>repository. I'am trying to connect to Azure Devops repo.

What permissions do I need to have to succesfuly add new repository with token?

I have created personal access token and then i was trying to use this token (manually typing) in Azure but i have only got error "General Error".

Another error that was generated is :
"{
"status": "Failed",
"error": {
"code": "IncorrectClientCredentialOrCollectionUri",
"message": "The URI and/or credentials could not be validated successfully. Please check the URL to ensure it is valid and that the personal access token (PAT) hasn't expired."
}
}"

I think that this problem is related to my persmissions at Azure DevOps. But i dont know what permissions do i need and how to check them.

In my deployment I'am using :

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"artifactRepoSecurityToken": {
"type": "securestring"
},
"artifactRepositoryDisplayName": {
"type": "string",
"defaultValue": "Repo Name"
},
"artifactRepoUri": {
"type": "string",
"defaultValue": "https://companyname.visualstudio.com/DepartmentName/_git/DevTestLabs"
},
"artifactRepoBranch": {
"type": "string",
"defaultValue": "master"
},
"artifactRepoFolder": {
"type": "string",
"defaultValue": "/Artifacts"
},
"ARMRepoFolder": {
"type": "string",
"defaultValue": "/ARMTemplates"
},
"artifactRepoType": {
"type": "string",
"defaultValue": "VsoGit",
"allowedValues": [
"VsoGit",
"GitHub"
]
}
},
"variables": {},
"resources": [
{
"apiVersion": "2018-10-15-preview",
"type": "Microsoft.DevTestLab/labs/artifactSources",
"name": "[concat(trim(resourceGroup().name), '/',parameters('artifactRepositoryDisplayName'))]",
"location": "[resourceGroup().location]",
"properties": {
"uri": "[parameters('artifactRepoUri')]",
"folderPath": "[parameters('artifactRepoFolder')]",
"armTemplateFolderPath": "[parameters('ARMRepoFolder')]",
"branchRef": "[parameters('artifactRepoBranch')]",
"displayName": "[parameters('artifactRepositoryDisplayName')]",
"securityToken": "[parameters('artifactRepoSecurityToken')]",
"sourceType": "[parameters('artifactRepoType')]",
"status": "Enabled"
}
}
],
"outputs": {
}
}

Any help much appreciated.

Azure DevTest Labs
Azure DevTest Labs
An Azure service that is used for provisioning development and test environments.
276 questions
{count} vote

1 answer

Sort by: Most helpful
  1. MaciekK 11 Reputation points
    2021-06-24T04:09:34.797+00:00

    I have done the same with custom defined or even Full access setting for access token and I'm still getting error "GeneralError: GeneralError" within Azure.

    I have below permission to the repository that I'am trying to add within azure DevTest Lab resources
    108852-devops-repo-permissions.jpg

    I have Contributors permissions to the project in Azure DevOps , details attached below:

    108768-devops-project-permissions.jpg

    So why i cannot connect to the Azure DevOps Repo within Azure DevTest Lab repository?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.