Skip to content

Commit a82afea

Browse files
[Storage] Fix Entra ID support in Blob perf tests, update other packages (#42169)
1 parent b3e716b commit a82afea

File tree

8 files changed

+45
-35
lines changed

8 files changed

+45
-35
lines changed

sdk/storage/azure-storage-blob/perf-resources.bicep

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
param baseName string = resourceGroup().name
22
param location string = resourceGroup().location
33

4-
resource storageAccount 'Microsoft.Storage/storageAccounts@2019-06-01' = {
4+
resource storageAccount 'Microsoft.Storage/storageAccounts@2025-01-01' = {
55
name: '${baseName}blob'
66
location: location
77
kind: 'BlockBlobStorage'
@@ -17,5 +17,3 @@ var connectionString = 'DefaultEndpointsProtocol=https;AccountName=${name};Accou
1717
output AZURE_STORAGE_ACCOUNT_NAME string = name
1818
output AZURE_STORAGE_ACCOUNT_KEY string = key
1919
output AZURE_STORAGE_CONNECTION_STRING string = connectionString
20-
output STANDARD_STORAGE_CONNECTION_STRING string = connectionString
21-
output STORAGE_CONNECTION_STRING string = connectionString

sdk/storage/azure-storage-blob/perf-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Project: sdk/storage/azure-storage-blob
55
PrimaryPackage: azure-storage-blob
66

77
PackageVersions:
8-
- azure-core: 1.31.0
9-
azure-storage-blob: 12.18.3
8+
- azure-core: 1.35.0
9+
azure-storage-blob: 12.26.0
1010
- azure-core: source
1111
azure-storage-blob: source
1212

sdk/storage/azure-storage-blob/tests/perfstress_tests/_test_base.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,10 @@ def __init__(self, arguments):
3434

3535
if not _ServiceTest.service_client or self.args.no_client_share:
3636
if self.args.use_entra_id:
37-
tenant_id = self.get_from_env("AZURE-STORAGE-BLOB_TENANT_ID")
38-
client_id = self.get_from_env("AZURE-STORAGE-BLOB_CLIENT_ID")
39-
client_secret = self.get_from_env("AZURE-STORAGE-BLOB_CLIENT_SECRET")
40-
sync_token_credential = SyncClientSecretCredential(
41-
tenant_id,
42-
client_id,
43-
client_secret
44-
)
45-
async_token_credential = AsyncClientSecretCredential(
46-
tenant_id,
47-
client_id,
48-
client_secret
49-
)
5037
account_name = self.get_from_env("AZURE_STORAGE_ACCOUNT_NAME")
38+
sync_token_credential = self.get_credential(is_async=False)
39+
async_token_credential = self.get_credential(is_async=True)
40+
5141
# We assume these tests will only be run on the Azure public cloud for now.
5242
url = f"https://{account_name}.blob.core.windows.net"
5343
_ServiceTest.service_client = SyncBlobServiceClient(account_url=url, credential=sync_token_credential, **self._client_kwargs)

sdk/storage/azure-storage-file-datalake/perf-resources.bicep

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
param baseName string = resourceGroup().name
22
param location string = resourceGroup().location
33

4-
resource storageAccount 'Microsoft.Storage/storageAccounts@2019-06-01' = {
4+
resource storageAccount 'Microsoft.Storage/storageAccounts@2025-01-01' = {
55
name: '${baseName}dlake'
66
location: location
77
kind: 'BlockBlobStorage'
@@ -19,12 +19,4 @@ var key = storageAccount.listKeys().keys[0].value
1919
// EndpointSuffix is required by azure-storage-file-datalake 12.7.0 and earlier (fixed in #24779)
2020
var connectionString = 'DefaultEndpointsProtocol=https;AccountName=${name};AccountKey=${key};EndpointSuffix=core.windows.net'
2121

22-
// .NET
23-
output DATALAKE_STORAGE_ACCOUNT_NAME string = name
24-
output DATALAKE_STORAGE_ACCOUNT_KEY string = key
25-
26-
// Java, JS
27-
output STORAGE_CONNECTION_STRING string = connectionString
28-
29-
// Python
3022
output AZURE_STORAGE_CONNECTION_STRING string = connectionString

sdk/storage/azure-storage-file-datalake/perf-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Project: sdk/storage/azure-storage-file-datalake
55
PrimaryPackage: azure-storage-file-datalake
66

77
PackageVersions:
8-
- azure-core: 1.31.0
9-
azure-storage-file-datalake: 12.18.0
8+
- azure-core: 1.35.0
9+
azure-storage-file-datalake: 12.21.0
1010
- azure-core: source
1111
azure-storage-file-datalake: source
1212

sdk/storage/azure-storage-file-share/perf-resources.bicep

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
param baseName string = resourceGroup().name
22
param location string = resourceGroup().location
33

4-
resource storageAccount 'Microsoft.Storage/storageAccounts@2019-06-01' = {
4+
resource storageAccount 'Microsoft.Storage/storageAccounts@2025-01-01' = {
55
name: '${baseName}files'
66
location: location
77
kind: 'FileStorage'
@@ -26,5 +26,3 @@ var connectionString = 'DefaultEndpointsProtocol=https;AccountName=${name};Accou
2626
output AZURE_STORAGE_ACCOUNT_NAME string = name
2727
output AZURE_STORAGE_ACCOUNT_KEY string = key
2828
output AZURE_STORAGE_CONNECTION_STRING string = connectionString
29-
output STANDARD_STORAGE_CONNECTION_STRING string = connectionString
30-
output STORAGE_CONNECTION_STRING string = connectionString

sdk/storage/azure-storage-file-share/perf-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Project: sdk/storage/azure-storage-file-share
55
PrimaryPackage: azure-storage-file-share
66

77
PackageVersions:
8-
- azure-core: 1.31.0
9-
azure-storage-file-share: 12.20.0
8+
- azure-core: 1.35.0
9+
azure-storage-file-share: 12.22.0
1010
- azure-core: source
1111
azure-storage-file-share: source
1212

tools/azure-sdk-tools/devtools_testutils/perfstress_tests/_perf_stress_base.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
import argparse
1010
import pstats
1111
import cProfile
12-
from typing import Optional
12+
from typing import Optional, TYPE_CHECKING
13+
14+
if TYPE_CHECKING:
15+
from azure.core.credentials import TokenCredential
1316

1417

1518
PSTATS_PRINT_DEFAULT_SORT_KEY = pstats.SortKey.TIME
@@ -218,6 +221,35 @@ def get_from_env(variable: str) -> str:
218221
if not value:
219222
raise ValueError("Undefined environment variable {}".format(variable))
220223
return value
224+
225+
@staticmethod
226+
def get_credential(is_async: bool = False) -> "TokenCredential":
227+
# If AzurePipelinesCredential is detected, use it.
228+
service_connection_id = os.environ.get("AZURESUBSCRIPTION_SERVICE_CONNECTION_ID")
229+
client_id = os.environ.get("AZURESUBSCRIPTION_CLIENT_ID")
230+
tenant_id = os.environ.get("AZURESUBSCRIPTION_TENANT_ID")
231+
system_access_token = os.environ.get("SYSTEM_ACCESSTOKEN")
232+
if service_connection_id and client_id and tenant_id and system_access_token:
233+
if is_async:
234+
from azure.identity.aio import AzurePipelinesCredential
235+
else:
236+
from azure.identity import AzurePipelinesCredential
237+
238+
return AzurePipelinesCredential(
239+
tenant_id=tenant_id,
240+
client_id=client_id,
241+
service_connection_id=service_connection_id,
242+
system_access_token=system_access_token,
243+
)
244+
245+
# Fall back to DefaultAzureCredential
246+
if is_async:
247+
from azure.identity.aio import DefaultAzureCredential
248+
else:
249+
from azure.identity import DefaultAzureCredential
250+
251+
return DefaultAzureCredential(exclude_managed_identity_credential=True)
252+
221253

222254
def _save_profile(self, sync: str, output_path: Optional[str] = None) -> None:
223255
"""

0 commit comments

Comments
 (0)