简体   繁体   中英

Maven using azure CICD - How to secure my user credentials

I am having my test case ready in local environment and ready to shift in azure CICD pipeline.

TO run the test case I need few settings including User credentials. Now when I move my code from local to clod I can't pass user credential because of security concern.

I read some article on Azure Key Vault to save secrets and then we can read it in pipeline.

But any one know how can I pass/read Azure key vault secrets in Maven task of Azure Pipeline so that I have don't have to save credentials in code itself.

Other solutions also welcome.

One of the option would be use variable group . You may link variable group with Azure Key Vault:

在此处输入图片说明

And then when you use this variable group in pipeline you will get secrets available as variables.

So if you have secret MyPassword in Azure Key Vault and you will follow all above steps then in pipeline you may reffer to it as $(MyPassword) .

Another options is to use Azure Key Vault task

In the simplest manner you can use secret variable: 在此处输入图片说明

Or secret variable in variable group:

在此处输入图片说明

In Maven task you can use variable like this mavenPomFile: $(YourVariables) :

- task: Maven@3
  inputs:
    mavenPomFile: $(YourVariables)
    publishJUnitResults: true
    testResultsFiles: '**/surefire-reports/TEST-*.xml'
    javaHomeOption: 'JDKVersion'
    mavenVersionOption: 'Default'
    mavenAuthenticateFeed: false
    effectivePomSkip: false
    sonarQubeRunAnalysis: false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM