Package io.micronaut.azure.credentials
Class AzureCredentialFactory
java.lang.Object
io.micronaut.azure.credentials.AzureCredentialFactory
The factory creates the Azure SDK credentials based on the configuration
AzureCredentialsConfiguration
.- Since:
- 3.1
- Author:
- Pavol Gressa
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncom.azure.identity.AzureCliCredential
azureCliCredential
(com.azure.identity.AzureCliCredentialBuilder builder) The Azure CLI credential authenticates in a development environment with the enabled user or service principal in Azure CLI.com.azure.identity.AzureCliCredentialBuilder
azureCliCredentialBuilder
(AzureCredentialsConfiguration.AzureCliCredentialConfiguration configuration) TheAzureCliCredential
builder.com.azure.identity.ClientCertificateCredential
clientCertificateCredential
(com.azure.identity.ClientCertificateCredentialBuilder builder) This credential authenticates the created service principal through its client certificate.com.azure.identity.ClientCertificateCredentialBuilder
clientCertificateCredentialBuilder
(AzureCredentialsConfiguration.ClientCertificateCredentialConfiguration configuration) Creates theClientCertificateCredential
builder.com.azure.identity.ClientSecretCredential
clientSecretCredential
(com.azure.identity.ClientSecretCredentialBuilder builder) This credential authenticates the created service principal through its client secret (password).com.azure.identity.ClientSecretCredentialBuilder
clientSecretCredentialBuilder
(AzureCredentialsConfiguration.ClientSecretCredentialConfiguration configuration) Creates and configures theClientSecretCredential
builder.com.azure.identity.DefaultAzureCredential
defaultAzureCredential
(com.azure.identity.DefaultAzureCredentialBuilder builder) TheDefaultAzureCredential
is appropriate for most scenarios where the application ultimately runs in the Azure Cloud.com.azure.identity.DefaultAzureCredentialBuilder
TheDefaultAzureCredential
builder.com.azure.identity.EnvironmentCredential
environmentCredential
(com.azure.identity.EnvironmentCredentialBuilder builder) A credential provider that provides token credentials based on environment variables.com.azure.identity.EnvironmentCredentialBuilder
Fluent credential builder for instantiating aEnvironmentCredential
.com.azure.identity.IntelliJCredential
intelliJCredential
(com.azure.identity.IntelliJCredentialBuilder builder) The IntelliJ credential authenticates in a development environment with the account in Azure Toolkit for IntelliJ.com.azure.identity.IntelliJCredentialBuilder
intelliJCredentialBuilder
(AzureCredentialsConfiguration.IntelliJCredentialConfiguration configuration) TheIntelliJCredential
builder.com.azure.identity.ManagedIdentityCredential
managedIdentityCredential
(com.azure.identity.ManagedIdentityCredentialBuilder builder) The Managed Identity authenticates the managed identity (system or user assigned) of an Azure resource.com.azure.identity.ManagedIdentityCredentialBuilder
managedIdentityCredentialBuilder
(AzureCredentialsConfiguration.ManagedIdentityCredentialConfiguration configuration) Creates theManagedIdentityCredential
builder.com.azure.storage.common.StorageSharedKeyCredential
storageSharedKeyCredentialFromAccountNameAndKey
(AzureCredentialsConfiguration.StorageSharedKeyCredentialConfiguration configuration) Creates aStorageSharedKeyCredential
from an account name and key.com.azure.storage.common.StorageSharedKeyCredential
storageSharedKeyCredentialFromConnectionString
(AzureCredentialsConfiguration.StorageSharedKeyCredentialConfiguration configuration) Creates aStorageSharedKeyCredential
from a connection string.com.azure.identity.UsernamePasswordCredential
usernamePasswordCredential
(com.azure.identity.UsernamePasswordCredentialBuilder builder) The UsernamePasswordCredential helps to authenticate a public client application using the user credentials that don't require multi-factor authentication.com.azure.identity.UsernamePasswordCredentialBuilder
usernamePasswordCredentialBuilder
(AzureCredentialsConfiguration.UsernamePasswordCredentialConfiguration configuration) Creates and configures theUsernamePasswordCredential
builder.com.azure.identity.VisualStudioCodeCredential
visualStudioCodeCredential
(com.azure.identity.VisualStudioCodeCredentialBuilder builder) The Visual Studio Code credential enables authentication in development environments where VS Code is installed with the VS Code Azure Account extension.com.azure.identity.VisualStudioCodeCredentialBuilder
visualStudioCodeCredentialBuilder
(AzureCredentialsConfiguration.VisualStudioCodeCredentialConfiguration configuration) TheVisualStudioCodeCredential
builder.
-
Constructor Details
-
AzureCredentialFactory
public AzureCredentialFactory()
-
-
Method Details
-
clientCertificateCredentialBuilder
@Requires(condition=ClientCertificateCredentialsCondition.class) @Singleton public com.azure.identity.ClientCertificateCredentialBuilder clientCertificateCredentialBuilder(AzureCredentialsConfiguration.ClientCertificateCredentialConfiguration configuration) Creates theClientCertificateCredential
builder.- Parameters:
configuration
- the configuration- Returns:
- the builder
-
clientCertificateCredential
@Requires(beans=com.azure.identity.ClientCertificateCredentialBuilder.class) @Singleton public com.azure.identity.ClientCertificateCredential clientCertificateCredential(com.azure.identity.ClientCertificateCredentialBuilder builder) This credential authenticates the created service principal through its client certificate.- Parameters:
builder
- the builder- Returns:
- client certificate credentials
- See Also:
-
clientSecretCredentialBuilder
@Requires(property="azure.credential.client-secret.secret") @Singleton public com.azure.identity.ClientSecretCredentialBuilder clientSecretCredentialBuilder(AzureCredentialsConfiguration.ClientSecretCredentialConfiguration configuration) Creates and configures theClientSecretCredential
builder.- Parameters:
configuration
- the configuration- Returns:
- the builder
-
clientSecretCredential
@Requires(beans=com.azure.identity.ClientSecretCredentialBuilder.class) @Singleton public com.azure.identity.ClientSecretCredential clientSecretCredential(com.azure.identity.ClientSecretCredentialBuilder builder) This credential authenticates the created service principal through its client secret (password).- Parameters:
builder
- the builder- Returns:
- client secret credential
- See Also:
-
usernamePasswordCredentialBuilder
@Requires(property="azure.credential.username-password.username") @Requires(property="azure.credential.username-password.password") @Singleton public com.azure.identity.UsernamePasswordCredentialBuilder usernamePasswordCredentialBuilder(AzureCredentialsConfiguration.UsernamePasswordCredentialConfiguration configuration) Creates and configures theUsernamePasswordCredential
builder.- Parameters:
configuration
- the configuration- Returns:
- the builder
-
usernamePasswordCredential
@Requires(beans=com.azure.identity.UsernamePasswordCredentialBuilder.class) @Singleton public com.azure.identity.UsernamePasswordCredential usernamePasswordCredential(com.azure.identity.UsernamePasswordCredentialBuilder builder) The UsernamePasswordCredential helps to authenticate a public client application using the user credentials that don't require multi-factor authentication.- Parameters:
builder
- the builder- Returns:
- username password credential
- See Also:
-
managedIdentityCredentialBuilder
@Requires(property="azure.credential.managed-identity.enabled", notEquals="false", defaultValue="false") @Singleton public com.azure.identity.ManagedIdentityCredentialBuilder managedIdentityCredentialBuilder(AzureCredentialsConfiguration.ManagedIdentityCredentialConfiguration configuration) Creates theManagedIdentityCredential
builder.- Parameters:
configuration
- the configuration- Returns:
- the builder
-
managedIdentityCredential
@Requires(beans=com.azure.identity.ManagedIdentityCredentialBuilder.class) @Singleton public com.azure.identity.ManagedIdentityCredential managedIdentityCredential(com.azure.identity.ManagedIdentityCredentialBuilder builder) The Managed Identity authenticates the managed identity (system or user assigned) of an Azure resource. So, if the application is running inside an Azure resource that supports Managed Identity through IDENTITY/MSI, IMDS endpoints, or both, then this credential will get your application authenticated, and offers a great secretless authentication experience.- Parameters:
builder
- the builder- Returns:
- managed identity credential
- See Also:
-
azureCliCredentialBuilder
@Requires(property="azure.credential.cli.enabled", notEquals="false", defaultValue="false") @Singleton public com.azure.identity.AzureCliCredentialBuilder azureCliCredentialBuilder(AzureCredentialsConfiguration.AzureCliCredentialConfiguration configuration) TheAzureCliCredential
builder.- Parameters:
configuration
- the configuration- Returns:
- builder
-
azureCliCredential
@Requires(beans=com.azure.identity.AzureCliCredentialBuilder.class) @Singleton public com.azure.identity.AzureCliCredential azureCliCredential(com.azure.identity.AzureCliCredentialBuilder builder) The Azure CLI credential authenticates in a development environment with the enabled user or service principal in Azure CLI. It uses the Azure CLI given a user that is already logged into it, and uses the CLI to authenticate the application against Azure Active Directory.- Parameters:
builder
- the builder- Returns:
- azure cli credentials
- See Also:
-
intelliJCredentialBuilder
@Requires(property="azure.credential.intellij.enabled", notEquals="false", defaultValue="false") @Singleton public com.azure.identity.IntelliJCredentialBuilder intelliJCredentialBuilder(AzureCredentialsConfiguration.IntelliJCredentialConfiguration configuration) TheIntelliJCredential
builder.- Parameters:
configuration
- the configuration- Returns:
- builder
-
intelliJCredential
@Requires(beans=com.azure.identity.IntelliJCredentialBuilder.class) @Singleton public com.azure.identity.IntelliJCredential intelliJCredential(com.azure.identity.IntelliJCredentialBuilder builder) The IntelliJ credential authenticates in a development environment with the account in Azure Toolkit for IntelliJ. It uses the logged in user information on the IntelliJ IDE and uses it to authenticate the application against Azure Active Directory.- Parameters:
builder
- the builder- Returns:
- intellij idea credentials
- See Also:
-
visualStudioCodeCredentialBuilder
@Requires(property="azure.credential.visual-studio-code.enabled", notEquals="false", defaultValue="false") @Singleton public com.azure.identity.VisualStudioCodeCredentialBuilder visualStudioCodeCredentialBuilder(AzureCredentialsConfiguration.VisualStudioCodeCredentialConfiguration configuration) TheVisualStudioCodeCredential
builder.- Parameters:
configuration
- the configuration- Returns:
- builder
-
visualStudioCodeCredential
@Requires(beans=com.azure.identity.VisualStudioCodeCredentialBuilder.class) @Singleton public com.azure.identity.VisualStudioCodeCredential visualStudioCodeCredential(com.azure.identity.VisualStudioCodeCredentialBuilder builder) The Visual Studio Code credential enables authentication in development environments where VS Code is installed with the VS Code Azure Account extension. It uses the logged-in user information in the VS Code IDE and uses it to authenticate the application against Azure Active Directory.- Parameters:
builder
- the builder- Returns:
- visual studio code credentials
- See Also:
-
defaultAzureCredentialBuilder
@Singleton public com.azure.identity.DefaultAzureCredentialBuilder defaultAzureCredentialBuilder()TheDefaultAzureCredential
builder.- Returns:
- builder
-
defaultAzureCredential
@Requires(missingBeans=com.azure.core.credential.TokenCredential.class) @Singleton public com.azure.identity.DefaultAzureCredential defaultAzureCredential(com.azure.identity.DefaultAzureCredentialBuilder builder) TheDefaultAzureCredential
is appropriate for most scenarios where the application ultimately runs in the Azure Cloud.DefaultAzureCredential
combines credentials that are commonly used to authenticate when deployed, with credentials that are used to authenticate in a development environment.- Parameters:
builder
- the builder- Returns:
- default azure credentials
- See Also:
-
environmentCredentialBuilder
@Requires(condition=EnvironmentCredentialsCondition.class) @Singleton public com.azure.identity.EnvironmentCredentialBuilder environmentCredentialBuilder()Fluent credential builder for instantiating aEnvironmentCredential
.- Returns:
- the environment credential builder.
-
environmentCredential
@Requires(bean=com.azure.identity.EnvironmentCredentialBuilder.class) @Singleton public com.azure.identity.EnvironmentCredential environmentCredential(com.azure.identity.EnvironmentCredentialBuilder builder) A credential provider that provides token credentials based on environment variables. The environment variables expected are:
AZURE_CLIENT_ID
AZURE_CLIENT_SECRET
AZURE_TENANT_ID
or:
AZURE_CLIENT_ID
AZURE_CLIENT_CERTIFICATE_PATH
AZURE_TENANT_ID
or:
AZURE_CLIENT_ID
AZURE_USERNAME
AZURE_PASSWORD
- Parameters:
builder
- the environment credential builder.- Returns:
- the environment credential.
-