{"record":{"id":"7d08c1af38b8fd0f","repo":"dotnet/runtime","slug":"missing-azure-storage-package","errorCode":null,"errorMessage":"Missing Azure Storage package.","messagePattern":"Missing Azure Storage package\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/coreclr/scripts/jitutil.py","lineNumber":596,"sourceCode":"        except:\n            azure_storage_blob_import_ok = False\n\n    azure_identity_import_ok = True\n    if need_azure_identity:\n        try:\n            from azure.identity import AzureCliCredential\n        except:\n            azure_identity_import_ok = False\n\n    if not azure_storage_blob_import_ok or not azure_identity_import_ok:\n        logging.error(\"One or more required Azure Storage packages is missing.\")\n        logging.error(\"\")\n        logging.error(\"Please install:\")\n        logging.error(\"  pip install azure-storage-blob azure-identity\")\n        logging.error(\"or (Windows):\")\n        logging.error(\"  py -3 -m pip install azure-storage-blob azure-identity\")\n        logging.error(\"See also https://learn.microsoft.com/azure/storage/blobs/storage-quickstart-blobs-python\")\n        raise RuntimeError(\"Missing Azure Storage package.\")\n\n    # The Azure packages spam all kinds of output to the logging channels.\n    # Restrict this to only ERROR and CRITICAL.\n    for name in logging.Logger.manager.loggerDict.keys():\n        if 'azure' in name:\n            logging.getLogger(name).setLevel(logging.ERROR)\n\n\ndef report_azure_error():\n    \"\"\" Report an Azure error\n    \"\"\"\n    logging.error(\"A problem occurred accessing Azure. Are you properly authenticated using the Azure CLI?\")\n    logging.error(\"Install the Azure CLI from https://learn.microsoft.com/cli/azure/install-azure-cli.\")\n    logging.error(\"Then log in to Azure using `az login`.\")\n\n\ndef download_with_azure(uri, target_location, fail_if_not_found=True):\n    \"\"\" Do an URI download using Azure blob storage API. Compared to urlretrieve,","sourceCodeStart":578,"sourceCodeEnd":614,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/coreclr/scripts/jitutil.py#L578-L614","documentation":"Thrown by require_azure_storage_libraries() in jitutil.py when either azure-storage-blob or azure-identity Python packages fail to import. This is a lazy check: the function is called only when Azure SDK APIs are actually needed (authenticated downloads/uploads), and it caches the result so it only checks once per process.","triggerScenarios":"require_azure_storage_libraries() is called from download_with_azure() or from scripts that need BlobServiceClient/BlobClient/ContainerClient/AzureCliCredential. If the try/except for 'from azure.storage.blob import ...' or 'from azure.identity import AzureCliCredential' catches an ImportError, line 596 raises with pip install instructions.","commonSituations":"Fresh Python environment without Azure SDK installed. The packages are installed in a different Python environment than the one running the script. Corporate environment blocks pip installs. Package version incompatibility causing import errors even when installed.","solutions":["Install both packages: 'pip install azure-storage-blob azure-identity'.","Verify import works: 'python -c \"from azure.storage.blob import BlobServiceClient; from azure.identity import AzureCliCredential\"'.","If using a virtualenv, ensure it is activated before running the script.","Run 'az login' to authenticate after installing packages."],"exampleFix":"# before: missing packages\npython superpmi.py asmdiffs\n# -> RuntimeError: Missing Azure Storage package.\n\n# after: install and authenticate\npip install azure-storage-blob azure-identity\naz login\npython superpmi.py asmdiffs","handlingStrategy":"validation","validationCode":"# Check Azure packages before calling functions that need them\nimport importlib\ndef azure_libraries_available():\n    try:\n        importlib.import_module('azure.storage.blob')\n        importlib.import_module('azure.identity')\n        return True\n    except ImportError:\n        return False\n\nif not azure_libraries_available():\n    print('Missing Azure packages. Run: pip install azure-storage-blob azure-identity')","typeGuard":"def has_azure_storage_packages() -> bool:\n    try:\n        import azure.storage.blob.BlobServiceClient  # noqa\n        import azure.identity.AzureCliCredential      # noqa\n        return True\n    except ImportError:\n        return False","tryCatchPattern":"try:\n    require_azure_storage_libraries()\nexcept RuntimeError as e:\n    if 'Missing Azure Storage' in str(e):\n        import subprocess\n        subprocess.run(['pip', 'install', 'azure-storage-blob', 'azure-identity'], check=True)\n        require_azure_storage_libraries()  # retry after install\n    raise","preventionTips":["Pre-install Azure packages: 'pip install azure-storage-blob azure-identity'.","Use a requirements.txt or virtualenv to ensure consistent package availability.","Run 'az login' before using authenticated Azure Storage operations."],"tags":["azure","dependencies","python-packages","jitutil"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}