Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change performance diagnostics to use Managed Identity #3509

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions microsoft/testsuites/vm_extensions/azureperformancediagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
from lisa.sut_orchestrator import AZURE
from lisa.sut_orchestrator.azure.common import (
AzureNodeSchema,
add_system_assign_identity,
check_or_create_storage_account,
get_node_context,
get_storage_credential,
list_blobs,
)
from lisa.sut_orchestrator.azure.features import AzureExtension
Expand Down Expand Up @@ -60,7 +60,7 @@ def before_case(self, log: Logger, **kwargs: Any) -> None:
storage account key, which we cannot use currently.
Will change it back once the extension works with MSI.
""",
priority=5,
priority=1,
requirement=simple_requirement(
supported_features=[AzureExtension],
),
Expand Down Expand Up @@ -91,12 +91,19 @@ def verify_azure_performance_diagnostics(
log=log,
)

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

# Run VM Extension
Expand All @@ -116,7 +123,7 @@ def verify_azure_performance_diagnostics(

protected_settings = {
"storageAccountName": storage_account_name,
"storageAccountKey": account_credential.get("account_key"),
"authenticationType": "SystemManagedIdentity",
}

extension_result = extension.create_or_update(
Expand Down Expand Up @@ -167,11 +174,12 @@ def _is_supported_linux_distro(self, node: Node) -> bool:
CentOs: [6, 7],
Oracle: [6, 7],
Debian: [8, 9, 10, 11],
Ubuntu: [14, 16, 18, 20],
Ubuntu: [14, 16, 18, 20, 22],
Suse: [12, 15],
SLES: [12, 15],
AlmaLinux: [8],
CBLMariner: [2],
# AzureLinux uses CBLMariner class
CBLMariner: [2, 3],
}

for distro in supported_major_versions:
Expand Down
Loading