Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cake-bot
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Oleksandr Barabash
cake-bot
Commits
2ff3d582
Commit
2ff3d582
authored
Aug 17, 2022
by
Oleksandr Barabash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed to force ManagedIdentityCredential
parent
c0bb1ebe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
10 deletions
+3
-10
cosmos_client.py
utils/cosmos_client.py
+3
-10
No files found.
utils/cosmos_client.py
View file @
2ff3d582
...
...
@@ -2,14 +2,12 @@
import
asyncio
import
uuid
from
concurrent
import
futures
from
datetime
import
datetime
from
typing
import
Any
,
Dict
,
Optional
,
Union
,
Iterable
,
List
from
typing
import
Any
,
Dict
,
Optional
,
Union
,
List
import
azure.cosmos.cosmos_client
as
cosmos_client
import
azure.cosmos.exceptions
as
exceptions
from
azure.cosmos
import
DatabaseProxy
,
ContainerProxy
from
azure.identity
import
DefaultAzureCredential
,
ClientSecretCredential
,
\
ManagedIdentityCredential
,
ChainedTokenCredential
from
azure.identity
import
ManagedIdentityCredential
from
botbuilder.core
import
TurnContext
from
botbuilder.schema
import
ChannelAccount
from
marshmallow
import
EXCLUDE
...
...
@@ -18,8 +16,6 @@ from entities.json.acknowledge import Acknowledge
from
entities.json.acknowledge_schema
import
AcknowledgeSchema
from
entities.json.camel_case_mixin
import
timestamp_factory
from
entities.json.conversation_reference
import
ConversationReference
from
entities.json.conversation_reference_schema
import
\
ConversationReferenceSchema
from
entities.json.initiation
import
Initiation
from
entities.json.notification
import
NotificationCosmos
...
...
@@ -54,11 +50,8 @@ class CosmosClient:
""" Cosmos Client class """
def
__init__
(
self
,
host
:
str
,
master_key
:
str
):
self
.
executor
=
futures
.
ThreadPoolExecutor
()
default_credentials
=
DefaultAzureCredential
()
mgmt_credentials
=
ManagedIdentityCredential
()
credentials
=
ChainedTokenCredential
(
mgmt_credentials
,
default_credentials
)
self
.
client
=
cosmos_client
.
CosmosClient
(
host
,
credentials
)
self
.
client
=
cosmos_client
.
CosmosClient
(
host
,
mgmt_credentials
)
# self.client = cosmos_client.CosmosClient(host,
# dict(masterKey=master_key))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment