TF30063:您无权访问 https://dev.azure.com/MyProject
TF30063: You are not authorized to access https://dev.azure.com/MyProject
我正在尝试使用 VS 2017 将我的项目连接到 Azure DevOps。
原因:从本地 DevOps 迁移到 Azure-DevOps。
错误:TF30063:您无权访问 https://dev.azure.com/MyProject
登录:双因素身份验证。
如何使用 VS 2017 在 Azure DevOps 中为我的项目创建测试计划?
我已经在 VS 2017 中连接到 Azure-DevOps,我可以使用浏览器查看我的项目(Visual Studio,查看->其他 Windows->Web 浏览器)。但是使用代码我无法访问
NetworkCredential netCred = new NetworkCredential("username@mail.com", "password");
BasicAuthCredential basicCred = new BasicAuthCredential(netCred);
TfsClientCredentials tfsCred = new TfsClientCredentials(basicCred);
tfsCred.AllowInteractive = false;
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri(_newServer), tfsCred);
tpc.EnsureAuthenticated();
tpc.Authenticate();
Log in with two factor authentication
考虑使用 Microsoft.TeamFoundationServer.Client nuget 包。尝试以下步骤:
- 创建 PAT:Authenticate access with personal access tokens
- 使用此示例代码进行身份验证:
string PAT = "<your_pat>";
VssConnection connection = new VssConnection(new Uri("<your_url>"), new VssBasicCredential(string.Empty, PAT));
TestPlanClient = Connection.GetClient<TestPlanHttpClient>();
- 然后你可以创建一个测试计划
TestPlanCreateParams newPlanDef = new TestPlanCreateParams()
{
Name = TestPlanName,
StartDate = StartDate,
EndDate = FinishDate,
AreaPath = AreaPath,
Iteration = IterationPath
};
var test_plan = TestPlanClient.CreateTestPlanAsync(newPlanDef, TeamProjectName).Wait();
您不能直接使用邮件帐户,请改用备用凭据 (https://dev.azure.com/{org}/_usersSettings/altcreds
)。
或者您可以使用个人访问令牌
VssCredentials Credentials = new VssCredentials(new Microsoft.VisualStudio.Services.Common.VssBasicCredential(string.Empty, "your personal acccess token"));
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri("https://dev.azure.com/{org{"), Credentials);
您还可以在运行时指定电子邮件帐户:
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri("https://{org}.visualstudio.com"), new VssClientCredentials());
我正在尝试使用 VS 2017 将我的项目连接到 Azure DevOps。 原因:从本地 DevOps 迁移到 Azure-DevOps。 错误:TF30063:您无权访问 https://dev.azure.com/MyProject 登录:双因素身份验证。 如何使用 VS 2017 在 Azure DevOps 中为我的项目创建测试计划?
我已经在 VS 2017 中连接到 Azure-DevOps,我可以使用浏览器查看我的项目(Visual Studio,查看->其他 Windows->Web 浏览器)。但是使用代码我无法访问
NetworkCredential netCred = new NetworkCredential("username@mail.com", "password");
BasicAuthCredential basicCred = new BasicAuthCredential(netCred);
TfsClientCredentials tfsCred = new TfsClientCredentials(basicCred);
tfsCred.AllowInteractive = false;
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri(_newServer), tfsCred);
tpc.EnsureAuthenticated();
tpc.Authenticate();
Log in with two factor authentication
考虑使用 Microsoft.TeamFoundationServer.Client nuget 包。尝试以下步骤:
- 创建 PAT:Authenticate access with personal access tokens
- 使用此示例代码进行身份验证:
string PAT = "<your_pat>";
VssConnection connection = new VssConnection(new Uri("<your_url>"), new VssBasicCredential(string.Empty, PAT));
TestPlanClient = Connection.GetClient<TestPlanHttpClient>();
- 然后你可以创建一个测试计划
TestPlanCreateParams newPlanDef = new TestPlanCreateParams()
{
Name = TestPlanName,
StartDate = StartDate,
EndDate = FinishDate,
AreaPath = AreaPath,
Iteration = IterationPath
};
var test_plan = TestPlanClient.CreateTestPlanAsync(newPlanDef, TeamProjectName).Wait();
您不能直接使用邮件帐户,请改用备用凭据 (https://dev.azure.com/{org}/_usersSettings/altcreds
)。
或者您可以使用个人访问令牌
VssCredentials Credentials = new VssCredentials(new Microsoft.VisualStudio.Services.Common.VssBasicCredential(string.Empty, "your personal acccess token"));
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri("https://dev.azure.com/{org{"), Credentials);
您还可以在运行时指定电子邮件帐户:
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri("https://{org}.visualstudio.com"), new VssClientCredentials());