Azure登录Jenkins管道

问题描述 投票:0回答:1

我正尝试使用Azure Credentials插件通过Jenkins管道登录Azure(Ubuntu 16.04作为Jenkins slave使用最新的Azure CLI):

 stage("Pushing to Azure Storage") {
            withCredentials([azureServicePrincipal(credentialsId: 'AzureServicePrincipal',
                                    subscriptionIdVariable: 'SUBS_ID',
                                    clientIdVariable: 'CLIENT_ID',
                                    clientSecretVariable: 'CLIENT_SECRET',
                                    tenantIdVariable: 'TENANT_ID')]) {
        sh 'az login --service-principal -u $CLIENT_ID -p $CLIENT_SECRET -t $TENANT_ID'
    }
}

结果是以下错误:

* [PushTest]运行shell脚本+ az登录--service-principal -u **** -p **** -t **** / tmp / jenkins / workspace / PushTest @ tmp / durable-7425816d / script。 sh:2:/tmp/jenkins/workspace/PushTest@tmp/durable-7425816d/script.sh:az:not found *

脚本返回退出代码127

azure jenkins azure-devops jenkins-pipeline azure-cli
1个回答
0
投票

您发布的错误显示找不到az。这意味着您在执行shell脚本的Jenkins节点中没有安装Azure CLI。所以你只需要在其中安装Azure CLI。

© www.soinside.com 2019 - 2024. All rights reserved.