VSTS任务 - Azure RM服务参考

时间:2017-09-07 12:22:06

标签: azure-devops

我正在开发VSTS Task,它将填充AzureRM的输入数据。任何人都知道帮助找出数据绑定参考(标记为xxxxxxx)?我想获得有关自动化帐户的数据,但我无法找到它。非常感谢。

"inputs":[
    {
        "name": "ConnectedServiceName",
        "type": "connectedService:AzureRM",
        "label": "Azure RM Subscription",
        "required": true,
        "helpMarkDown": "Azure Resource Manager subscription",
    },
    {
        "name": "ResourceGroupName",
        "label": "Resource Group",
        "type": "pickList",
        "required": true,
        "helpMarkDown": "Provide the name of a resource group.",
        "properties": {
        "EditableOptions": "True"
    },
    {
        "name": "AutomationAccount",
        "type": "pickList",
        "label": "Automation Account Name",
        "required": true,
        "helpMarkDown": "Select or Type Automation Account Name",
        "properties": {
            "EditableOptions": "True"
        }
    }
],
"dataSourceBindings": [
    {
        "target": "ResourceGroupName",
        "endpointId": "$(ConnectedServiceName)",
        "dataSourceName": "AzureResourceGroups"
    },
    {
        "target": "AutomationAccount",
        "endpointId": "$(ConnectedServiceName)",
        "dataSourceName": "xxxxxxxxxxxxxxxxx"
    },
]

2 个答案:

答案 0 :(得分:1)

我找到了。在AzureRM服务端点的REST Api中

    "dataSources":  [
                        "@{name=TestConnection; endpointUrl={{{endpoint.url}}}/subscriptions/{{{endpoint.subscriptionId}}}?api-version=2016-06-01; resourceUrl=; resultSelector=jsonpath:$}",
                        "@{name=AzureResourceGroups; endpointUrl={{{endpoint.url}}}/subscriptions/{{{endpoint.subscriptionId}}}/resourcegroups?api-version=2016-02-01; resourceUrl=; resultSelector=jsonpath:$.value[*].name}",
                        "@{name=AzureStorageAccountRM; endpointUrl={{{endpoint.url}}}/subscriptions/{{{endpoint.subscriptionId}}}/providers/Microsoft.Storage/storageAccounts?api-version=2015-06-15; resourceUrl=; resultSelector=jsonpath:$.value[*].name}",
                        "@{name=AzureRMStorageAccountByLocation; endpointUrl={{{endpoint.url}}}/subscriptions/{{{endpoint.subscriptionId}}}/providers/Microsoft.Storage/storageAccounts?api-version=2015-06-15; resourceUrl=; resultSelector=jsonpath:$.value[?(@.location ==\u0027{{location}}\u0027)].name}",
                        "@{name=AzureRMStorageAccountIdByName; endpointUrl={{{endpoint.url}}}/subscriptions/{{{endpoint.subscriptionId}}}/providers/Microsoft.Storage/storageAccounts?api-version=2015-06-15; resourceUrl=; resultSelector=jsonpath:$.value[?(@.name ==\u0027{{storageAccountName}}\u0027)].id}",
                        "@{name=AzureVirtualMachinesV2Id; endpointUrl={{{endpoint.url}}}/subscriptions/{{{endpoint.subscriptionId}}}/providers/Microsoft.Compute/virtualMachines?api-version=2015-06-15; resourceUrl=; resultSelector=jsonpath:$.value[*].id}",
                        "@{name=AzureRMWebAppNames; endpointUrl={{{endpoint.url}}}/subscriptions/{{{endpoint.subscriptionId}}}/providers/Microsoft.Web/sites?api-version=2015-08-01; resourceUrl=; resultSelector=jsonpath:$.value[*].name}",
                        "@{name=AzureRMServerfarmId; endpointUrl={{{endpoint.url}}}/subscriptions/{{{endpoint.subscriptionId}}}/providers/Microsoft.Web/sites?api-version=2015-08-01; resourceUrl=; resultSelector=jsonpath:$.value[?(@.name==\u0027{{WebAppName}}\u0027)].properties}",
                        "@{name=AzureAppKind; endpointUrl={{{endpoint.url}}}/subscriptions/{{{endpoint.subscriptionId}}}/providers/Microsoft.Web/sites?api-version=2015-08-01; resourceUrl=; resultSelector=jsonpath:$.value[?(@.name==\u0027{{WebAppName}}\u0027)].properties}",
                        "@{name=AzureRMWebAppKind; endpointUrl={{{endpoint.url}}}/{{{ServerfarmId}}}?api-version=2015-08-01; resourceUrl=; resultSelector=jsonpath:$}",
                        "@{name=AzureRMWebAppResourceGroup; endpointUrl={{{endpoint.url}}}/subscriptions/{{{endpoint.subscriptionId}}}/providers/Microsoft.Web/sites?api-version=2015-08-01; resourceUrl=; resultSelector=jsonpath:$.value[?(@.name==\u0027{{WebAppName}}\u0027)].properties.resourceGroup}",
                        "@{name=AzureRMWebAppSlotsId; endpointUrl={{{endpoint.url}}}/subscriptions/{{{endpoint.subscriptionId}}}/resourceGroups/{{{ResourceGroupName}}}/providers/Microsoft.Web/sites/$(WebAppName)/slots?api-version=2015-08-01; resourceUrl=; resultSelector=jsonpath:$.value[*].id}",
                        "@{name=AzureRMLoadBalancers; endpointUrl={{{endpoint.url}}}/subscriptions/{{{endpoint.subscriptionId}}}/resourceGroups/{{{ResourceGroupName}}}/providers/Microsoft.Network/loadBalancers?api-version=2016-09-01; resourceUrl=; resultSelector=jsonpath:$.value[*].name}",
                        "@{name=AzureLocations; endpointUrl={{{endpoint.url}}}/subscriptions/$(endpoint.subscriptionId)/locations?api-version=2016-09-01; resourceUrl=; resultSelector=jsonpath:$.value[*].displayName}",
                        "@{name=AzureLocations2; endpointUrl={{{endpoint.url}}}/subscriptions/$(endpoint.subscriptionId)/locations?api-version=2016-09-01; resourceUrl=; resultSelector=jsonpath:$.value[*]}",
                        "@{name=AzureRMContainerRegistries; endpointUrl={{{endpoint.url}}}/subscriptions/{{{endpoint.subscriptionId}}}/providers/Microsoft.ContainerRegistry/registries?api-version=2017-03-01; resourceUrl=; resultSelector=jsonpath:$.value[*]}",
                        "@{name=AzureKeyVaults; endpointUrl={{{endpoint.url}}}/subscriptions/{{{endpoint.subscriptionId}}}/providers/Microsoft.KeyVault/vaults?api-version=2016-10-01; resourceUrl=; resultSelector=jsonpath:$.value[*].name}",
                        "@{name=AzureKeyVaultsList; endpointUrl={{{endpoint.url}}}/subscriptions/{{{endpoint.subscriptionId}}}/providers/Microsoft.KeyVault/vaults?api-version=2016-10-01; resourceUrl=; resultSelector=jsonpath:$.value[*]}",
                        "@{name=AzureKeyVaultListVaults; endpointUrl={{{endpoint.url}}}/subscriptions/{{{endpoint.subscriptionId}}}/providers/Microsoft.KeyVault/vaults?api-version=2016-10-01; resourceUrl=; resultSelector=jsonpath:$}",
                        "@{name=AzureKeyVaultListVaultsWithSkipToken; endpointUrl={{{endpoint.url}}}/subscriptions/{{{endpoint.subscriptionId}}}/providers/Microsoft.KeyVault/vaults?api-version=2016-10-01\u0026$skiptoken={{{SkipToken}}}; resourceUrl=; resultSelector=jsonpath:$}",
                        "@{name=AzureKeyVaultListSecretsTestConnection; endpointUrl=https://{{{KeyVaultName}}}.{{{endpoint.AzureKeyVaultDnsSuffix}}}/secrets?maxresults=1\u0026api-version=2016-10-01; resourceUrl={{{endpoint.AzureKeyVaultServiceEndpointResourceId}}}; resultSelector=jsonpath:$}",
                        "@{name=AzureKeyVaultGetSecretTestConnection; endpointUrl=https://{{{KeyVaultName}}}.{{{endpoint.AzureKeyVaultDnsSuffix}}}/secrets/nonexistingrandomsecretname?api-version=2016-10-01; resourceUrl={{{endpoint.AzureKeyVaultServiceEndpointResourceId}}}; resultSelector=jsonpath:$}",
                        "@{name=AzureKeyVaultSecrets; endpointUrl=https://{{{KeyVaultName}}}.{{{endpoint.AzureKeyVaultDnsSuffix}}}/secrets?api-version=2016-10-01; resourceUrl={{{endpoint.AzureKeyVaultServiceEndpointResourceId}}}; resultSelector=jsonpath:$}",
                        "@{name=AzureKeyVaultSecretsWithSkipToken; endpointUrl=https://{{{KeyVaultName}}}.{{{endpoint.AzureKeyVaultDnsSuffix}}}/secrets?api-version=2016-10-01\u0026$skiptoken={{{SkipToken}}}; resourceUrl={{{endpoint.AzureKeyVaultServiceEndpointResourceId}}}; resultSelector=jsonpath:$}",
                        "@{name=AzureVirtualMachineScaleSetNames; endpointUrl={{{endpoint.url}}}/subscriptions/{{{endpoint.subscriptionId}}}/providers/Microsoft.Compute/virtualMachineScaleSets?api-version=2017-03-30; resourceUrl=; resultSelector=jsonpath:$.value[*].name}",
                        "@{name=AzureRMDependencyData; endpointUrl={{{endpoint.url}}}/metadata/endpoints?api-version=1.0; resourceUrl=; resultSelector=jsonpath:$}"
                    ],

答案 1 :(得分:0)

实际上有一篇关于服务端点的博客文章:Service endpoints – Data sources

看起来您也可以执行与服务端点相同的Rest调用,以使用

检索整个结构
https://YourVSTSSubscription.visualstudio.com/defaultcollection/_apis/distributedtask/serviceendpointtypes?type=AzureRM