简体   繁体   English

从Visual Studio Team Services创建Azure DevTest Lab VM

[英]Create Azure DevTest Lab VM from Visual Studio Team Services

I want to create an Azure DevTest labs VM as part of a build process in Visual Studio Team Services. 我想在Visual Studio Team Services中创建Azure DevTest Labs VM作为构建过程的一部分。 However when I run a build I get the following error: 但是,当我运行构建时,出现以下错误:

******************************************************************************
Starting task: Create Azure DevTest Labs VM
******************************************************************************
Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.102.0\tasks\AzureDevTestLabsCreateVM\1.0.7\New-AzureDtlVM.ps1
Looking for Azure PowerShell module at C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement\Azure\Azure.psd1
AzurePSCmdletsVersion= 1.3.2
Get-ServiceEndpoint -Name ***** -Context Microsoft.TeamFoundation.DistributedTask.Agent.Worker.Common.TaskContext
tenantId= ********
azureSubscriptionId= *****
azureSubscriptionName= *****
Add-AzureRMAccount -ServicePrincipal -Tenant ******** -Credential System.Management.Automation.PSCredential
Select-AzureRMSubscription -SubscriptionId ***** -tenantId ********
Starting Azure DevTest Labs Create VM Task
Task called with the following parameters:
  ConnectedServiceName  = *****
  LabId = *****
  TemplateName = C:\a\1\s\MVC app\azure-rm-template
  TemplateParameters = -newVMName 'builder' -userName 'admin' -password (ConvertTo-SecureString -String ***** -AsPlainText -Force)
  OutputResourceId = labVMId
Validating input parameters
Fetching lab *****
Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.ErrorResponses.ErrorResponseMessageException: MissingSubscription : The request did not have a provided subscription. All requests must have an associated subscription Id.
at Microsoft.Azure.Commands.ResourceManager.Cmdlets.RestClients.ResourceManagerRestClientBase.<SendRequestAsync>d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Commands.ResourceManager.Cmdlets.RestClients.ResourceManagerRestClientBase.<SendRequestAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Commands.ResourceManager.Cmdlets.RestClients.ResourceManagerRestClientBase.<SendRequestAsync>d__1b`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.GetAzureResourceCmdlet.<GetResource>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.GetAzureResourceCmdlet.<GetResources>d__c.MoveNext()

I have connected VSTS to Azure using a service principal and I am using the DevTest labs tasks provided by Microsoft ( https://marketplace.visualstudio.com/items?itemName=ms-azuredevtestlabs.tasks ). 我已使用服务主体将VSTS连接到Azure,并且正在使用Microsoft提供的DevTest Labs任务( https://marketplace.visualstudio.com/items?itemName=ms-azuredevtestlabs.tasks )。

It's very confusing because the error claims "MissingSubscription" but the logs for that very task contain all of my subscription information?!?! 这非常令人困惑,因为该错误声明为“ MissingSubscription”,但该任务的日志包含我所有的订阅信息?!?!

This could be caused by the "Lab Name" you entered in "Azure DevTest Labs Create VM" task is incorrect. 这可能是由于您在“ Azure DevTest Labs创建VM”任务中输入的“实验室名称”不正确引起的。 Make sure you have created the DevTest Lab in Azure Portal, and then in the "Azure DevTest Labs Create VM" task, you should see it from the drop-down list of "Lab Name', choose it from there. 确保已在Azure Portal中创建了DevTest Lab,然后在“ Azure DevTest Labs Create VM”任务中,应该从“ Lab Name”的下拉列表中看到它,然后从中选择它。 在此处输入图片说明

If the Lab Name is correct, you should see the "LabID" in the log the same as following format: 如果实验室名称正确,则应该在日志中看到“ LabID”,格式如下:

LabId = /subscriptions/subscriptionID/resourceGroups/resourcegroupname/providers/Microsoft.DevTestLab/labs/LabName 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure DevTest实验室VM工件 - Azure DevTest lab VM artifacts 将DevTest Lab虚拟机移至另一个DevTest Lab - Move DevTest Lab VM to another DevTest Lab Visual Studio团队服务/ Azure - Visual Studio Team Services / Azure 为什么Azure VM会被VS DevTest Lab解除分配 - Why Azure VM gets deallocated by VS DevTest Lab 在ARM模板中指定用于创建Azure DevTest Lab VM的资源组 - Specify resource group in ARM template for Azure DevTest Lab VM creation 如何在Azure DevTest Lab VM上设置自动更新 - How do I set Automatic Updates on Azure DevTest Lab VM 如何将更新发送到 azure 中的开发测试实验室 VM? - How to send updates to the VM which is DevTest lab in azure? 在Visual Studio Team Services版本中创建Azure Cloud Service程序包 - Create Azure Cloud Service package in Visual Studio Team Services build Visual Studio Team Services在Azure上部署 - azure vm上不存在错误default-publish.ps1 - Visual Studio Team Services deploy on Azure - error default-publish.ps1 doesn't exist on azure vm 从Visual Studio Team Services(VSO)部署Azure WebApp - Deploy Azure WebApp from Visual Studio Team Services (VSO)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM