/azure-credentials-plugin

Jenkins Azure Credentials plugin

Primary LanguageJavaMIT LicenseMIT

Azure Credentials plugin

Jenkins Plugin to manage Azure Service Principal credentials.

Using existing credentials to login to Azure using the Java Azure SDK

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()
                ));

Getting an iterator to all SYSTEM owned Azure Credentials

CredentialsProvider.lookupCredentials(AzureCredentials.class, null, ACL.SYSTEM, Collections.<DomainRequirement>emptyList()