Jenkins의 Secret Text를 사용하여 Azure API Key를 숨기면서 az 명령을 실행합니다.
이 Docker 이미지를 사용하여 Jenkins에서 VM을 시작/중지하고 싶었지만 Azure 서비스 프린시 펄의 Token과 응용 프로그램 ID를 어떻게 은폐하는지 고민했습니다.
Jenkins Secret Text가 매우 사용하기 쉽기 때문에 소개하고 싶습니다.
Azure를 예로 들었지만,이 메커니즘은 무엇이든 사용할 수 있습니다.
환경
Azure CLI Docker 이미지 실행 방법
$ docker run --rm -e AZURE_APPLICATION_ID=[Your Application ID] \
-e AZURE_SECRET=[Your Secret] \
-e AZURE_TENANT_ID=[Your Tenant ID] \
-e CMD="/usr/local/bin/az vm start -g [ResourceGroup] -n [VM Name]" azurecli:v1.0
여기의 Secret 등을 어떻게든 은폐하고 싶네요.
Jenkins 환경 변수로 가능합니까?

Jenkins 작업에서 갑자기 $ {AZURE_SECRET}과 같은 형태로 사용할 수 있기 때문에 매우 편리하지만 두 가지 문제점이있었습니다.
따라서이 방법은 채택되지 않습니다.
Jenkins 자격증명
Jenkins 자격증명을 활용하여 앞서 두 가지 문제점을 해결할 수 있었습니다.
각각 어떻게 대책했는지 봅니다.
Jenkins를 여러 사람이 사용하는 경우 누구나 키를 사용할 수 있으며 설정 값이 둥글게 보입니다.






작업 실행 후 콘솔 출력에 설정 값이 원으로 보입니다.









Reference
이 문제에 관하여(Jenkins의 Secret Text를 사용하여 Azure API Key를 숨기면서 az 명령을 실행합니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/shingo_kawahara/items/393f3723045644572a85텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)