Skip to content

Comments

[Do Not Merge] Adding sample code for auth using azure credentials.#1

Draft
mbhaskar wants to merge 1 commit intomainfrom
auth-using-credential
Draft

[Do Not Merge] Adding sample code for auth using azure credentials.#1
mbhaskar wants to merge 1 commit intomainfrom
auth-using-credential

Conversation

@mbhaskar
Copy link
Collaborator

@mbhaskar mbhaskar commented Jan 15, 2021

Sample code to demo the AAD based authentication

    @Bean
    public CosmosClientBuilder cosmosClientBuilder() {
        DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build();
        return new CosmosClientBuilder()
                       .endpoint(properties.getUri())
                       .credential(credential)
                       .directMode(directConnectionConfig);
    }

Note:
Make sure you use an existing database and container and supply them to the config accordingly as RBAC auth may be able work only on document operations.

** Do not merge this code into this sample until we create a new sample for demonstrating above and then we can put this code there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant