Jenkins Plugin to manage Azure Service Principal credentials.
- Bash Script for creating a service principal
- General information on how to use credentials in Jenkins
ServicePrincipal servicePrincipal = AzureCredentials.getServicePrincipal("<credentials_id>");
Azure azClient = Azure.authenticate(new ApplicationTokenCredentials(
servicePrincipal.getClientId(),
servicePrincipal.getTenant(),
servicePrincipal.getClientSecret(),
new AzureEnvironment(
servicePrincipal.getAuthenticationEndpoint(),
servicePrincipal.getServiceManagementURL(),
servicePrincipal.getResourceManagerEndpoint(),
servicePrincipal.getGraphEndpoint()
));
CredentialsProvider.lookupCredentials(AzureCredentials.class, null, ACL.SYSTEM, Collections.<DomainRequirement>emptyList()