[英]Jenkins azure deploy error: az login error issuer
I have my groovy script to deploy a simple api(nodejs) on azure app service.我有我的 groovy 脚本来在 azure 应用程序服务上部署一个简单的 api(nodejs)。
pipeline {
agent none
environment {
//app service
DEV_SERVICE_NAME = 'xxxxxx'
...
...
AZURE_DEV_USER_ID = 'abcdefghijk'
AZURE_DEV_PASSWORD = 'xxxxxx'
AZURE_ACTIVE_DIRECTORY_TENANT_ID = 'xxxxxx'
}
stage('Service Deployment (DEV)'){
agent { label 'master'}
steps {
//Install all packages
bat "npm i --production"
..
..
bat "CALL az login --service-principal --username $env.AZURE_DEV_USER_ID --password $env.AZURE_DEV_PASSWORD --tenant $env.AZURE_ACTIVE_DIRECTORY_TENANT_ID"
..
..
}
so, when jenkins builds, fails, and print an error因此,当 jenkins 构建、失败并打印错误时
C:\jenkins\workspace\loud_feature-deploy-api-on-azure@2>CALL az login --service-principal --username
null --password null --tenant null
usage: az login [-h] [--verbose] [--debug]
[--output {json,jsonc,table,tsv,yaml,yamlc,none}]
[--query JMESPATH] [--username USERNAME] [--password PASSWORD]
[--service-principal] [--tenant TENANT]
[--allow-no-subscriptions] [-i] [--use-device-code]
[--use-cert-sn-issuer]
az login: error: 'issuer'
so, I have 2 questions.所以,我有两个问题。
I have tried to reproduce your issue by following this Jenkins document but was successfully able to echo environment variables that are set.我试图通过遵循此Jenkins 文档来重现您的问题,但成功地能够回显设置的环境变量。 Regarding AZURE_DEV_PASSWORD variable in your case, I believe that its not better approach to have secure information like password in the pipeline so I would suggest you to just add an Azure service principal to Jenkins credential and then write an Jenkins pipeline script by having ' withCredentials([azureServicePrincipal('SERVICEPRINCIPALCREDENTIALID')]) ' and then by using ' sh ' part to have Azure CLI command to deploy api(nodejs) on azure app service as appropriate.关于您的案例中的 AZURE_DEV_PASSWORD 变量,我认为在管道中使用密码等安全信息并不是更好的方法,因此我建议您只需将 Azure 服务主体添加到 Jenkins 凭据,然后通过使用 ' withCredentials( [azureServicePrincipal('SERVICEPRINCIPALCREDENTIALID')]) ' 然后通过使用 ' sh ' 部分让 Azure CLI 命令根据需要在 azure 应用服务上部署 api(nodejs)。 For more information with regards to it, please refer this Azure document or this Jenkins plugin article or this Jenkins blog.有关它的更多信息,请参阅此Azure 文档或此Jenkins 插件文章或此Jenkins 博客。
Hope this helps!希望这可以帮助! Cheers!干杯!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.