Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Use aio version of credentials only with blob storage (#106)
Browse files Browse the repository at this point in the history
* Use aio version of credentials only with blob storage

* Add aiohttp dependency

* Fixes test

* Updates changelog
  • Loading branch information
desertaxle authored Jun 22, 2023
1 parent c38ce8a commit 44805ac
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Security

## 0.2.10

Released on June 22nd, 2023.

### Fixed

- Fixed credentials imports to ensure async credential classes are only used with async clients - [#106](https://github.com/PrefectHQ/prefect-azure/pull/106)

## 0.2.9

Released on June 21st, 2023.
Expand Down
9 changes: 5 additions & 4 deletions prefect_azure/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import functools
from typing import TYPE_CHECKING, Any, Dict, Optional

from azure.identity.aio import ClientSecretCredential, DefaultAzureCredential
from azure.identity import ClientSecretCredential, DefaultAzureCredential
from azure.identity.aio import DefaultAzureCredential as ADefaultAzureCredential
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
from azure.mgmt.resource import ResourceManagementClient
from pydantic import Field, SecretStr, root_validator
Expand Down Expand Up @@ -158,7 +159,7 @@ async def example_get_client_flow():
if self.connection_string is None:
return BlobServiceClient(
account_url=self.account_url,
credential=DefaultAzureCredential(),
credential=ADefaultAzureCredential(),
)

return BlobServiceClient.from_connection_string(
Expand Down Expand Up @@ -202,7 +203,7 @@ async def example_get_blob_client_flow():
return BlobClient(
account_url=self.account_url,
container_name=container,
credential=DefaultAzureCredential(),
credential=ADefaultAzureCredential(),
blob_name=blob,
)

Expand Down Expand Up @@ -247,7 +248,7 @@ async def example_get_container_client_flow():
return ContainerClient(
account_url=self.account_url,
container_name=container,
credential=DefaultAzureCredential(),
credential=ADefaultAzureCredential(),
)

container_client = ContainerClient.from_connection_string(
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ prefect>=2.10.5
azure_mgmt_containerinstance>=10.0
azure_identity>=1.10
azure-mgmt-resource>=21.2
aiohttp

2 changes: 1 addition & 1 deletion tests/test_aci_infrastructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest
from anyio.abc import TaskStatus
from azure.core.exceptions import HttpResponseError, ResourceNotFoundError
from azure.identity.aio import ClientSecretCredential, DefaultAzureCredential
from azure.identity import ClientSecretCredential, DefaultAzureCredential
from azure.mgmt.containerinstance.models import (
EnvironmentVariable,
ImageRegistryCredential,
Expand Down

0 comments on commit 44805ac

Please sign in to comment.