Skip to content

Commit 08b810d

Browse files
author
Luke Luong
committed
Change performance diagnostics to use Managed Identity
1 parent 657da85 commit 08b810d

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

microsoft/testsuites/vm_extensions/azureperformancediagnostics.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
AzureNodeSchema,
2929
check_or_create_storage_account,
3030
get_node_context,
31-
get_storage_credential,
31+
add_system_assign_identity,
3232
list_blobs,
3333
)
3434
from lisa.sut_orchestrator.azure.features import AzureExtension
@@ -91,12 +91,15 @@ def verify_azure_performance_diagnostics(
9191
log=log,
9292
)
9393

94-
account_credential = get_storage_credential(
95-
credential=platform.credential,
96-
subscription_id=platform.subscription_id,
97-
cloud=platform.cloud,
98-
account_name=storage_account_name,
99-
resource_group_name=resource_group_name,
94+
# Assign system identity to VM
95+
# This MSI will be pre-configured with the necessary role assigments to Storage Account from Subscription level
96+
# Permissions required: Storage Account Contributor, Storage Blob Data Contributor, Storage Blob Data Contributor
97+
add_system_assign_identity(
98+
platform=platform,
99+
resource_group_name=node_context.resource_group_name,
100+
vm_name=node_context.vm_name,
101+
location=node_context.location,
102+
log=log,
100103
)
101104

102105
# Run VM Extension
@@ -116,7 +119,7 @@ def verify_azure_performance_diagnostics(
116119

117120
protected_settings = {
118121
"storageAccountName": storage_account_name,
119-
"storageAccountKey": account_credential.get("account_key"),
122+
"authenticationType": "SystemManagedIdentity"
120123
}
121124

122125
extension_result = extension.create_or_update(
@@ -167,11 +170,11 @@ def _is_supported_linux_distro(self, node: Node) -> bool:
167170
CentOs: [6, 7],
168171
Oracle: [6, 7],
169172
Debian: [8, 9, 10, 11],
170-
Ubuntu: [14, 16, 18, 20],
173+
Ubuntu: [14, 16, 18, 20, 22],
171174
Suse: [12, 15],
172175
SLES: [12, 15],
173176
AlmaLinux: [8],
174-
CBLMariner: [2],
177+
CBLMariner: [2, 3], #AzureLinux uses CBLMariner class
175178
}
176179

177180
for distro in supported_major_versions:

0 commit comments

Comments
 (0)