Jenkins

https://github.com/jenkinsci/azure-credentials-plugin

withCredentials([azureServicePrincipal('credentials_id')]) { sh 'az login --service-principal -u $AZURE_CLIENT_ID -p $AZURE_CLIENT_SECRET -t $AZURE_TENANT_ID' }

echo "My client id is $AZURE_CLIENT_ID" echo "My client secret is $AZURE_CLIENT_SECRET" echo "My tenant id is $AZURE_TENANT_ID" echo "My subscription id is $AZURE_SUBSCRIPTION_ID"

To get the credentials value for Jenins:

https://www.shellhacks.com/jenkins-credentials-plugin-decrypt-password/ TO get SSH Key and private key:

node {
  stage('Jenkins Credentials | Decrypt SSH key') {
    withCredentials([sshUserPrivateKey(credentialsId: 'credentials-id',
                                       keyFileVariable: 'key',
                                       usernameVariable: 'username')]) {
      creds = "\nUsername: ${username}\n"
      sh "cat ${key}"
    }
    println creds
  }
}