2017-02-14 74 views
0

我已经编写了一个task.json文件,下面是代码,并试图创建一个插件..这是我的插件输入。我能够看到天蓝色的subcriptions但资源组名称不是自动填充的。我应该添加什么?无法获取列表中的资源组名称

`"inputs":[ 
     { 
      "name": "ConnectedServiceNameSelector", 
      "type": "pickList", 
      "label": "Cloud Provider", 
      "required": false, 
     "helpMarkDown": "", 
     "defaultValue": "", 
     "options": { 
      "ConnectedServiceNameARM": "Azure RM", 
      "ConnectedServiceNameAWS": "AWS" 
     } 
    }, 
    { 
     "name": "ConnectedServiceNameARM", 
     "type": "connectedService:AzureRM", 
     "label": "Azure RM Subscription", 
     "defaultValue": "", 
     "required": true, 
     "helpMarkDown": "Azure Resource Manager subscription to target for copying the files.", 
     "visibleRule": "ConnectedServiceNameSelector = ConnectedServiceNameARM" 
    }, 
    { 
     "name": "ConnectedServiceNameAWS", 
     "type": "connectedService:AWS", 
     "label": "AWS", 
     "defaultValue": "", 
     "required": true, 
     "helpMarkDown": "AWS subscription to target for copying the files.", 
     "visibleRule": "ConnectedServiceNameSelector = ConnectedServiceNameAWS" 
    }, 
    { 

     "name": "ResourceGroupName", 
     "label": "Resource Group", 
     "type": "pickList", 
     "required": true, 
     "groupName": "AzureDetails", 
     "helpMarkDown": "Provide the name of a resource group.", 
     "properties": { 
      "EditableOptions": "True" 
     } 
    }, 
    { 
     "name": "action", 
     "type": "pickList", 
     "label": "Operation", 
     "defaultValue": "Create Or Update Resource Group", 
     "required": true, 
     "groupName": "AzureDetails", 
     "helpMarkDown": "Action to be performed on the Azure resources or resource group.", 
     "options": { 
      "Create Or Update Resource Group": "Create or update resource group", 
      "Select Resource Group": "Select resource group", 
      "Start": "Start virtual machines", 
      "Stop": "Stop virtual machines", 
      "Restart": "Restart virtual machines", 
      "Delete": "Delete virtual machines", 
      "DeleteRG": "Delete resource group" 
     } 
    }, 
    { 
     "name": "deploymentName", 
     "type": "string", 
     "label": "Deployment Name", 
     "required": false, 
     "defaultValue": "", 
     "groupName": "AzureDetails", 
     "helpMarkDown": "Provide a deployment name" 
    }, 
    { 
     "name": "location", 
     "type": "pickList", 
     "label": "Region", 
     "defaultValue": "Southeast Asia", 
     "required": true, 
     "helpMarkDown": "Location for deploying the resource group. If the resource group already exists in the subscription, then this value will be ignored.", 
     "groupName": "AzureDetails", 
     "options": { 
      "Australia East": "Australia East", 
      "Australia Southeast": "Australia Southeast", 
      "Brazil South": "Brazil South", 
      "Canada Central": "Canada Central", 
      "Canada East": "Canada East", 
      "Central India": "Central India", 
      "Central US": "Central US", 
      "East Asia": "East Asia", 
      "East US": "East US", 
      "East US 2 ": "East US 2 ", 
      "Japan East": "Japan East", 
      "Japan West": "Japan West", 
      "North Central US": "North Central US", 
      "North Europe": "North Europe", 
      "South Central US": "South Central US", 
      "South India": "South India", 
      "Southeast Asia": "Southeast Asia", 
      "UK South": "UK South", 
      "UK West": "UK West", 
      "West Central US": "West Central US", 
      "West Europe": "West Europe", 
      "West India": "West India", 
      "West US": "West US", 
      "West US 2": "West US 2" 
     }, 
     "properties": { 
      "EditableOptions": "True" 
     }, 
     "visibleRule": "action = Create Or Update Resource Group || action = Select Resource Group || action = DeleteRG" 
    }, 


    } 
], 
"dataSourceBindings": [ 
    { 
     "target": "ResourceGroupName", 
     "endpointId": "$(ConnectedServiceName)", 
     "dataSourceName": "AzureResourceGroups" 
    }, 
    { 
     "target": "location", 
     "endpointId": "$(ConnectedServiceName)", 
     "dataSourceName": "AzureLocations" 
    }, 

], 

`

这是我的插件在VSTS的UI enter image description here

回答

0

您的端点输入

"name": "ConnectedServiceNameARM" 

但在数据绑定端点名称,而不ARM上月底

"endpointId": "$(ConnectedServiceName)" 

希望这有助于

你想也利用资源int选中组只

{ 
     "target": "AutomationAccount", 
     "endpointId": "$(ConnectedServiceName)", 
     "dataSourceName": "AutomationAccountNames", 
     "parameters": { 
      "ResourceGroupName": "$(ResourceGroupName)" 
     } 
    }