Open
Description
openedon Sep 23, 2024
Describe the bug
When I use the ManagedIdentity to get token for Federate Credential in scala, the below throw exception:
block()/blockFirst()/blockLast() are blocking, which is not supported in thread cosmos-parallel-1
The code snip is:
def initCosmosClient(): CosmosClient = {
println(s"Getting CosmosClient")
val managedIdentityCredential = new ManagedIdentityCredentialBuilder()
.clientId(miClientId)
.build()
val clientAssertionCredential = new ClientAssertionCredentialBuilder()
.tenantId(tenantId)
.clientId(appId)
.clientAssertion(() => {
try {
val token = managedIdentityCredential.getTokenSync(new TokenRequestContext().addScopes("api://AzureADTokenExchange/.default"))
if (token != null){
token.getToken
} else {
""
}
} catch {
case e: Exception => {
println(s"Getting CosmosClient with Exception ${e.getMessage}")
""
}
}
})
.additionallyAllowedTenants("*")
.build()
new CosmosClientBuilder()
.endpoint(configs.host)
.credential(clientAssertionCredential)
.buildClient()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
This issue points to a problem in the data-plane of the library.Issues that are reported by GitHub users external to the Azure organization.Workflow: More information is needed from author to address the issue.There has been no recent activity on this issue.The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Type
Projects
Status
Not Started