[英]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.