Nil*_*pal 10 azure azure-cli azure-devops azure-pipelines azure-pipelines-yaml
我无法从 azureCLI 任务触发 azure 管道构建
任务 :
- task: AzureCLI@2
inputs:
azureSubscription: 'Free Trial(My subscription)'
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
az --version
echo "Running : az account show"
az account show
#export AZURE_DEVOPS_EXT_PAT='mypat'
$env:AZURE_DEVOPS_EXT_PAT='mypat'
az pipelines create --name newPipeline --org https://dev.azure.com/AbiNilOrg/ --project azure-devops-kubernetes-terraform --branch master
Run Code Online (Sandbox Code Playgroud)
输出有错误:
Running : az account show
{
"environmentName": "AzureCloud",
"homeTenantId": "***",
"id": "73c1af29-384c-4574-bd88-92d7bb392cfc",
"isDefault": true,
"managedByTenants": [],
"name": "Free Trial",
"state": "Enabled",
"tenantId": "***",
"user": {
"name": "***",
"type": "servicePrincipal"
}
}
WARNING: This command is in preview and under development. Reference and support
levels: https://aka.ms/CLI_refstatus
ERROR: The requested resource requires user authentication:
https://dev.azure.com/AbiNilOrg/azure-devops-kubernetes-
terraform/_apis/serviceendpoint/endpoints
##[error]Script failed with exit code: 1
Run Code Online (Sandbox Code Playgroud)
据我所知,azure 无法形成正确的 URI 来到达休息点
ERROR: The requested resource requires user authentication:
https://dev.azure.com/AbiNilOrg/azure-devops-kubernetes-
terraform/_apis/serviceendpoint/endpoints
Run Code Online (Sandbox Code Playgroud)
URI 的后缀serviceendpoint/endpoints不正确。
ADO 伙计们,如果对此有任何想法,请帮忙!
提前致谢!尼洛帕尔
当你设置后,env:AZURE_DEVOPS_EXT_PAT
你仍然需要通过调用登录:
az devops login --organization https://dev.azure.com/contoso
Run Code Online (Sandbox Code Playgroud)
因为:
如果您已使用 az login 交互登录或使用用户名和密码登录,则无需提供令牌,因为 az devops 命令现在支持通过 az login 登录。但是,不支持通过 az login 登录服务主体,在这种情况下需要 PAT 令牌。
这里的任务是通过服务主体登录场景,您也可以在帐户显示中看到:
az devops login --organization https://dev.azure.com/contoso
Run Code Online (Sandbox Code Playgroud)
有关更多详细信息,请查看此处的文档
归档时间: |
|
查看次数: |
10843 次 |
最近记录: |