简体   繁体   中英

Blob storage java sdk authorize by azure AD

Do we have any way BlobServiceClient with Azure AD infomation(username/password). Here is code im using for connectionString but i cannot find any function for AD:

new BlobServiceClientBuilder().connectionString(connectionString).buildClient();

No, there is no way to do this. But you can use clientId,clientSecret and tenantId to generate credential, then connect to blob storage.

Code Snippet:

ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder()
        .clientId(clientId)
        .clientSecret(clientSecret)
        .tenantId(tenantId)
        .build();

BlobServiceClient blobServiceClient = new BlobServiceClientBuilder().credential(clientSecretCredential).endpoint(endpoint).buildClient();

API document:

https://docs.microsoft.com/en-us/java/api/com.azure.storage.blob.blobserviceclientbuilder?view=azure-java-stable

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM