How to pass/read Azure key vault secrets in Maven task of Azure Pipeline?

How to pass/read Azure key vault secrets in Maven task of Azure Pipeline, to avoid saving credentials in code?

1 Like

Are you trying to run the job on cloud?

1 Like

Yes. While running on local, saving the user credentials in code was not an issue. But to run on cloud, I want to avoid this situation, for security purposes.

1 Like

You can either use a variable group, by linking it with Azure Key Vault.

Or you can also use Azure Key Vault task.

Here are few documents to help you:

1 Like

ok. But how to do it via Maven task?

1 Like

In Maven task, use the below variable syntax:

mavenPomFile: $(SomeVariable)

For example:

- task: Maven@...
  inputs:
    mavenPomFile: $(SomeVariable)
    .
    .
1 Like