|
15 | 15 | import azure.batch.models as bm |
16 | 16 | from azure.batch import BatchServiceClient |
17 | 17 | from azure.core.exceptions import HttpResponseError |
18 | | -from azure.identity import DefaultAzureCredential |
19 | 18 | from azure.mgmt.batch import BatchManagementClient |
20 | 19 | from snakemake_interface_common.exceptions import WorkflowError |
21 | 20 | from snakemake_interface_executor_plugins.executors.base import SubmittedJobInfo |
|
30 | 29 | from snakemake_executor_plugin_azure_batch.constant import AZURE_BATCH_RESOURCE_ENDPOINT |
31 | 30 | from snakemake_executor_plugin_azure_batch.util import ( |
32 | 31 | AzureIdentityCredentialAdapter, |
| 32 | + CustomAzureCredential, |
33 | 33 | read_stream_as_string, |
34 | 34 | unpack_compute_node_errors, |
35 | 35 | unpack_task_failure_information, |
@@ -278,29 +278,25 @@ def __post_init__(self): |
278 | 278 |
|
279 | 279 | def init_batch_client(self): |
280 | 280 | """ |
281 | | - Initialize the BatchServiceClient and BatchManagementClient using |
282 | | - DefaultAzureCredential. |
| 281 | + Initialize the BatchServiceClient and BatchManagementClient |
283 | 282 |
|
284 | 283 | Sets: |
285 | 284 | - self.batch_client |
286 | 285 | - self.batch_mgmt_client |
287 | 286 | """ |
288 | 287 | try: |
289 | 288 |
|
290 | | - # initialize BatchServiceClient |
291 | | - default_credential = DefaultAzureCredential( |
292 | | - exclude_managed_identity_credential=True |
293 | | - ) |
294 | 289 | adapted_credential = AzureIdentityCredentialAdapter( |
295 | | - credential=default_credential, resource_id=AZURE_BATCH_RESOURCE_ENDPOINT |
| 290 | + credential=CustomAzureCredential(), |
| 291 | + resource_id=AZURE_BATCH_RESOURCE_ENDPOINT, |
296 | 292 | ) |
297 | 293 | self.batch_client = BatchServiceClient( |
298 | 294 | adapted_credential, self.settings.account_url |
299 | 295 | ) |
300 | 296 |
|
301 | 297 | # initialize BatchManagementClient |
302 | 298 | self.batch_mgmt_client = BatchManagementClient( |
303 | | - credential=default_credential, |
| 299 | + credential=CustomAzureCredential(), |
304 | 300 | subscription_id=self.settings.subscription_id, |
305 | 301 | ) |
306 | 302 |
|
|
0 commit comments