dotnet/runtime · error · RuntimeError

Azure failed to download

Error message

Azure failed to download

What it means

Raised by download_with_azure() in jitutil.py. It opens a BlobClient and tries blob.download_blob(); if the download or the local write throws, ok is set False and, when fail_if_not_found is True, the function raises 'Azure failed to download'. The accompanying logs (via report_azure_error) point to CLI authentication.

Solutions

  1. Run `az login` to authenticate the Azure CLI, then retry.
  2. Install the Azure CLI if missing (see https://learn.microsoft.com/cli/azure/install-azure-cli).
  3. Verify the URI/blob exists (e.g. check the git hash / collection name) — a 404 with fail_if_not_found surfaces here.
  4. Check disk space and write permissions for target_location; retry on transient network errors.

Example fix

// before
python superpmi.py download ...   # 'Azure failed to download'
// after
az login
python superpmi.py download ...
Defensive patterns

Strategy: retry

Validate before calling

import subprocess
if subprocess.call(["az", "account", "show"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) != 0:
    raise SystemExit("Not logged in to Azure CLI; run `az login` before downloading")

Try / catch

from jitutil import download_with_azure
for attempt in range(3):
    try:
        ok = download_with_azure(uri, target, fail_if_not_found=True)
        break
    except RuntimeError:
        if attempt == 2:
            raise
        logging.warning("Azure download failed, retrying (%d/3)", attempt + 1)

Prevention

When it happens

Trigger: Azure blob download fails due to no `az login`, expired credentials, a 404 (blob missing) with fail_if_not_found=True, a network/IO error, or a local disk write error while streaming the blob.

Common situations: Forgot to run `az login`; Azure CLI not installed; the blob/git-hash does not exist in storage; transient network failure; insufficient disk space or permissions on target_location.

Related errors


AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10). Data as JSON: /api/errors/641d62732c07a926. Report an issue: GitHub.

Appendix: source

Thrown at src/coreclr/scripts/jitutil.py:649

    ok = True
    az_credential = AzureCliCredential()
    blob = BlobClient.from_blob_url(uri, credential=az_credential)
    with open(target_location, "wb") as my_blob:
        try:
            download_stream = blob.download_blob(retry_total=0)
            try:
                my_blob.write(download_stream.readall())
            except Exception as ex1:
                logging.error("Error writing data to %s", target_location)
                report_azure_error()
                ok = False
        except Exception as ex2:
            logging.error("Azure error downloading %s", uri)
            report_azure_error()
            ok = False

    if not ok and fail_if_not_found:
        raise RuntimeError("Azure failed to download")
    return ok

################################################################################
##
## File downloading functions
##
################################################################################


def download_progress_hook(count, block_size, total_size):
    """ A hook for urlretrieve to report download progress

    Args:
        count (int)               : current block index
        block_size (int)          : size of a block
        total_size (int)          : total size of a payload
    """
    sys.stdout.write("\rDownloading {0:.1f}/{1:.1f} MB...".format(min(count * block_size, total_size) / 1024 / 1024, total_size / 1024 / 1024))

View on GitHub (pinned to 60108ba66e)