Skip to content

spmi collect/jitrollingbuild: Replace DefaultAzureCredential => AzureCliCredential #115067

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

Merged
merged 1 commit into from
Apr 26, 2025

Conversation

kunalspathak
Copy link
Member

No description provided.

@Copilot Copilot AI review requested due to automatic review settings April 25, 2025 22:28
@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Apr 25, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces the usage of DefaultAzureCredential with AzureCliCredential in several SuperPMI-related scripts to ensure authentication is performed using the Azure CLI method instead of the default chained credential.

  • Updated imports and instantiation in src/coreclr/scripts/superpmi.py
  • Replaced DefaultAzureCredential with AzureCliCredential in azure library functions within src/coreclr/scripts/jitutil.py
  • Altered credential usage in BlobServiceClient initialization in src/coreclr/scripts/jitrollingbuild.py

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
src/coreclr/scripts/superpmi.py Updated import and instantiation of Azure credential
src/coreclr/scripts/jitutil.py Changed DefaultAzureCredential to AzureCliCredential in imports and globals
src/coreclr/scripts/jitrollingbuild.py Replaced DefaultAzureCredential with AzureCliCredential in both import and credential instantiation

@@ -3701,14 +3701,14 @@ def list_superpmi_collections_container_via_azure_api(path_filter=lambda unused:
"""

require_azure_storage_libraries()
from jitutil import ContainerClient, DefaultAzureCredential
from jitutil import ContainerClient, AzureCliCredential
Copy link
Preview

Copilot AI Apr 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The update correctly replaces the DefaultAzureCredential with AzureCliCredential. Ensure that all dependent code using this credential behaves consistently with the new authentication flow.

Copilot uses AI. Check for mistakes.


superpmi_container_url = az_blob_storage_superpmi_container_uri

paths = []
ok = True
try:
az_credential = DefaultAzureCredential()
az_credential = AzureCliCredential()
Copy link
Preview

Copilot AI Apr 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instantiating AzureCliCredential here updates the authentication method. Confirm that the new credential’s behavior matches expectations in production scenarios.

Copilot uses AI. Check for mistakes.

@@ -537,13 +537,13 @@ def require_azure_storage_libraries(need_azure_storage_blob=True, need_azure_ide
Once we've done it once, we don't do it again.

For this to work for cross-module usage, after you call this function, you need to add a line like:
from jitutil import BlobClient, DefaultAzureCredential
from jitutil import BlobClient, AzureCliCredential
Copy link
Preview

Copilot AI Apr 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing the credential import here ensures consistency with the new Azure CLI–based authentication, which aligns with the intended changes.

Copilot uses AI. Check for mistakes.

naming all the types you want to use.

The full set of types this function loads:
BlobServiceClient, BlobClient, ContainerClient, DefaultAzureCredential
BlobServiceClient, BlobClient, ContainerClient, AzureCliCredential
Copy link
Preview

Copilot AI Apr 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the global variable update for Azure credential is fully integrated with AzureCliCredential and that the downstream usage does not rely on any specific behavior of DefaultAzureCredential.

Copilot uses AI. Check for mistakes.

@@ -457,7 +457,7 @@ def upload_blob(file, blob_name):

try:
from azure.storage.blob import BlobServiceClient
from azure.identity import DefaultAzureCredential
from azure.identity import AzureCliCredential
Copy link
Preview

Copilot AI Apr 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating the import here maintains consistency with the credential change. Verify that any fallback logic depending on DefaultAzureCredential is no longer necessary.

Copilot uses AI. Check for mistakes.

@@ -466,7 +466,7 @@ def upload_blob(file, blob_name):
logging.warning("See also https://learn.microsoft.com/azure/storage/blobs/storage-quickstart-blobs-python")
raise RuntimeError("Missing azure storage or identity packages.")

default_credential = DefaultAzureCredential()
default_credential = AzureCliCredential()
Copy link
Preview

Copilot AI Apr 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instantiation of AzureCliCredential replaces the previous credential and should provide the expected authentication behavior for BlobServiceClient. Confirm its integration in performance and error handling.

Copilot uses AI. Check for mistakes.

@kunalspathak
Copy link
Member Author

@hoyosjs

@hoyosjs
Copy link
Member

hoyosjs commented Apr 25, 2025

I've chatted with Jakob about this offline. AzurePipelinesCredential is the recommended cred here, but this will work. If this unblocks - LGTM

@hoyosjs
Copy link
Member

hoyosjs commented Apr 25, 2025

@jakobbotsch

@BruceForstall
Copy link
Contributor

/ba-g don't wait to unblock jitrollingbuild

@BruceForstall BruceForstall merged commit 9843ca2 into dotnet:main Apr 26, 2025
77 of 94 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants