dotnet/runtime · error · RuntimeError

Missing azure storage or identity packages.

Error message

Missing azure storage or identity packages.

What it means

Thrown by upload_command() when the import of azure.storage.blob (BlobServiceClient) or azure.identity (AzureCliCredential) fails. The upload path requires authenticated Azure SDK access to write blobs to the clrjit2 storage account, which requires both Python packages to be installed.

Source

Thrown at src/coreclr/scripts/jitrollingbuild.py:467

                logging.warning("Couldn't find any JIT changes! Just using the argument git_hash")
            else:
                jit_git_hash = change_list_hashes[0]
                logging.info("Using git_hash {}".format(jit_git_hash))

    logging.info("Uploading:")
    for item in files:
        logging.info("  {}".format(item))

    try:
        from azure.storage.blob import BlobServiceClient
        from azure.identity import AzureCliCredential

    except:
        logging.warning("Please install:")
        logging.warning("  pip install azure-storage-blob")
        logging.warning("  pip install azure-identiy")
        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 = AzureCliCredential()

    blob_service_client = BlobServiceClient(account_url=az_blob_storage_account_uri, credential=default_credential)
    blob_folder_name = "{}/{}/{}/{}/{}".format(az_builds_root_folder, jit_git_hash, coreclr_args.host_os, coreclr_args.arch, coreclr_args.build_type)

    total_bytes_uploaded = 0

    # Should we compress the JIT on upload? It would save space, but it makes it slightly more complicated to use
    # because you can't just "wget" or otherwise download the file and use it immediately -- you need to unzip first.
    # So for now, don't compress it.
    compress_jit = False

    with TempDir() as temp_location:
        for file in files:
            if compress_jit:
                # Zip compress the file we will upload
                zip_name = os.path.basename(file) + ".zip"

View on GitHub (pinned to 290d5ab72c)

Solutions

  1. Install both packages: 'pip install azure-storage-blob azure-identity'.
  2. On Windows, if pip is not on PATH: 'py -3 -m pip install azure-storage-blob azure-identity'.
  3. Verify the packages are installed for the correct Python interpreter: 'python -c "import azure.storage.blob; import azure.identity"'.
  4. Ensure you have also run 'az login' to authenticate with Azure CLI before attempting the upload.

Example fix

# before: missing packages
python jitrollingbuild.py upload -git_hash abc123
# -> RuntimeError: Missing azure storage or identity packages.

# after: install packages then retry
pip install azure-storage-blob azure-identity
az login
python jitrollingbuild.py upload -git_hash abc123
Defensive patterns

Strategy: validation

Validate before calling

# Check Azure packages before calling upload
import importlib
def can_import_azure():
    try:
        importlib.import_module('azure.storage.blob')
        importlib.import_module('azure.identity')
        return True
    except ImportError:
        return False

if not can_import_azure():
    print('Missing Azure packages. Run: pip install azure-storage-blob azure-identity')

Type guard

def azure_packages_available() -> bool:
    try:
        import azure.storage.blob  # noqa
        import azure.identity     # noqa
        return True
    except ImportError:
        return False

Try / catch

try:
    upload_command(coreclr_args)
except RuntimeError as e:
    if 'azure storage or identity' in str(e):
        import subprocess
        subprocess.run(['pip', 'install', 'azure-storage-blob', 'azure-identity'])
        raise  # Re-raise so user retries after install
    raise

Prevention

When it happens

Trigger: At lines 458-467, the script tries 'from azure.storage.blob import BlobServiceClient' and 'from azure.identity import AzureCliCredential'. If either import raises an exception (bare except), line 467 raises RuntimeError with instructions to pip install the packages.

Common situations: Running in a fresh Python environment or virtualenv without the Azure SDK packages installed. The packages are installed but for a different Python version (e.g., installed for python3.8 but running with python3.10). Corporate proxy or pip configuration prevents installing packages. The azure-identity package name was misspelled in the install command (the script's own warning message has a typo: 'azure-identiy').

Related errors


AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06). Data as JSON: /api/errors/0a26ec1bcc2cf8b8. Report an issue: GitHub.