I have local jenkins setup with admin access.
I have configured plugins as per this https://support.cloudbees.com/hc/en-us/articles/203802500-Injecting-Secrets-into-Jenkins-Build-Jobs.
Though, I am still unclear about how to inject secrets in Jenkins multibranch pipeline jobs. I could not see any configurations option to either set the environemntal variables as well. PS - I do not want to commit secrets in git ;)
Need to inject them as secrets from Jenkins.
I used credentials plugin to store credentials and credentials binding plugin to map them to environmental variables. Here is how I did it:
withCredentials([string(credentialsId: 'AZURE_SUBSCRIPTION_ID', variable: 'AZURE_SUBSCRIPTION_ID')]) {
}
withCredentials([string(credentialsId: 'AZURE_CLIENT_ID', variable: 'AZURE_CLIENT_ID')]) {
}
withCredentials([string(credentialsId: 'AZURE_TENANT_ID', variable: 'AZURE_TENANT_ID')]) {
}
withCredentials([string(credentialsId: 'AZURE_CLIENT_SECRET', variable: 'AZURE_CLIENT_SECRET')]) {
}