protected String fetchAccessToken() {
        try {
            val microsoft = casProperties.getEmailProvider().getMicrosoft();
            val clientCredentialParameters = ClientCredentialParameters.builder(microsoft.getScopes()).build();
            val clientApplication = ConfidentialClientApplication
                .builder(SpringExpressionLanguageValueResolver.getInstance().resolve(microsoft.getClientId()),
                    ClientCredentialFactory.createFromSecret(SpringExpressionLanguageValueResolver.getInstance().resolve(microsoft.getClientSecret())))
                .authority("https://login.microsoftonline.com/%s".formatted(SpringExpressionLanguageValueResolver.getInstance().resolve(microsoft.getTenantId())))
                .build();
            return clientApplication.acquireToken(clientCredentialParameters).get().accessToken();
        } catch (final Exception e) {
            throw new RuntimeException("Failed to acquire access token", e);
        }
    }
This is {@link MicrosoftEmailSenderCustomizer}.

@author Misagh Moayyed
@since 7.2.0
support/cas-server-support-mail-microsoft/src/main/java/org/apereo/cas/mail/MicrosoftEmailSenderCustomizer.java