Cosmos DB Entra ID auth does not work today.
- You can set a credential here:
|
self.credential: Union[TokenCredential, None] = credential |
- The credential is also loaded here:
|
if self._config.url: |
|
if not self._config.credential: |
|
raise ValueError( |
|
storage_errors.InvalidConfiguration.format( |
|
"Credential is required when using a custom service URL" |
|
) |
|
) |
|
return CosmosClient( |
|
account_url=self._config.url, credential=self._config.credential |
|
) |
- However, this entire section does not make sense:
|
if self._config.url: |
|
if not self._config.credential: |
|
raise ValueError( |
|
storage_errors.InvalidConfiguration.format( |
|
"Credential is required when using a custom service URL" |
|
) |
|
) |
|
return CosmosClient( |
|
account_url=self._config.url, credential=self._config.credential |
|
) |
What is wrong about this section:
- You are referencing an
account_url parameter, which does not exist. Reference: https://learn.microsoft.com/en-us/python/api/overview/azure/cosmos-readme?view=azure-python
- Connection policies, consistency levels and other configs are onl set for key authentication but not for Entra ID authentication:
|
connection_policy = self._config.cosmos_client_options.get( |
|
"connection_policy", documents.ConnectionPolicy() |
|
) |
- I also don't understand why you have a property in the config for the
cosmos_db_endpoint and another one for the url. Those should be the same and you should just use one.
Cosmos DB Entra ID auth does not work today.
Agents-for-python/libraries/microsoft-agents-storage-cosmos/microsoft_agents/storage/cosmos/cosmos_db_storage_config.py
Line 65 in 9537e44
Agents-for-python/libraries/microsoft-agents-storage-cosmos/microsoft_agents/storage/cosmos/cosmos_db_storage.py
Lines 56 to 65 in 9537e44
Agents-for-python/libraries/microsoft-agents-storage-cosmos/microsoft_agents/storage/cosmos/cosmos_db_storage.py
Lines 56 to 65 in 9537e44
What is wrong about this section:
account_urlparameter, which does not exist. Reference: https://learn.microsoft.com/en-us/python/api/overview/azure/cosmos-readme?view=azure-pythonAgents-for-python/libraries/microsoft-agents-storage-cosmos/microsoft_agents/storage/cosmos/cosmos_db_storage.py
Lines 67 to 69 in 9537e44
cosmos_db_endpointand another one for theurl. Those should be the same and you should just use one.