Closed auriou closed 5 years ago
Hello, when i use the api release, i get a 401 error, while i am administrator on my project and my site azureDevOps
Thx for your help.
import * as SDK from "azure-devops-extension-sdk"; import { CommonServiceIds, IProjectPageService, getClient } from "azure-devops-extension-api"; import * as vsrelease from "azure-devops-extension-api/Release"; import * as vsbuild from "azure-devops-extension-api/Build"; await SDK.ready(); // get current project name const projectService = await SDK.getService<IProjectPageService>(CommonServiceIds.ProjectPageService); const project = await projectService.getProject(); let projectName = ''; if(project !== undefined) projectName = project.name; console.log(projectName); // get buildDefinitions = ok const buildDefinitions = await getClient(vsbuild.BuildRestClient).getDefinitions( projectName, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true, true ); console.log(buildDefinitions); // get releaseDefinitions == error 401 ?? // {"$id":"1","innerException":null,"message":"TF400813: The user 'my admin guid' is not authorized to access this resource.","typeName":"Microsoft.TeamFoundation.Framework.Server.InvalidIdentityException, Microsoft.TeamFoundation.Framework.Server","typeKey":"InvalidIdentityException","errorCode":0,"eventId":3000} const releaseDefinitions = await getClient(vsrelease.ReleaseRestClient).getReleaseDefinitions(projectName); console.log(releaseDefinitions);
You must add rights to the manifest file of the extension
"scopes": [ "vso.release", "vso.build" ],
And you will have to authorize the new rights on AzureDevOps in the general extension section
Hello, when i use the api release, i get a 401 error, while i am administrator on my project and my site azureDevOps
Thx for your help.