Blog Post

Azure Tools Blog
3 MIN READ

Azure CLI Windows MSI Upgrade Issue: Root Cause, Mitigation, and Performance Improvements

Alex-wdy's avatar
Alex-wdy
Icon for Microsoft rankMicrosoft
Feb 03, 2026

Azure CLI on Windows MSI Upgrade Issue

Summary

About six months ago, some Windows users experienced an Azure CLI crash after upgrading via the MSI installer from Azure CLI 2.76.0 (or earlier) to 2.77.0 (or later). The failure occurred immediately on startup with: “ImportError: DLL load failed while importing win32file: The specified module could not be found.” This post explains what happened, why upgrades were affected (while clean installs typically worked), and what you can do to recover.

Who is affected?

You are likely affected if:

  • You installed Azure CLI using the Windows MSI installer.
  • You upgraded from Azure CLI 2.76.0 (or earlier) to 2.77.0 (or later) without fully uninstalling first.
  • After the upgrade, any az command fails with the win32file ImportError on startup.

Symptoms

Typical error output (Azure CLI/Azure PowerShell):

ImportError: DLL load failed while importing win32file: The specified module could not be found.

Immediate recovery

  1. Upgrade to the latest version 2.83.0
  2. If you want to install other versions of Azure CLI, perform a clean reinstall by uninstalling Microsoft Azure CLI from Windows Settings → Apps, deleting any remaining install folder (such as the CLI2 directory), reinstalling the latest Azure CLI using MSI or winget, and then verifying the installation with az --version.

Root cause analysis

During an affected MSI upgrade, the Azure CLI installation directory ended up missing a set of native Python extension files (.pyd files) required by the Windows integration layer. MSI logging showed components being blocked with messages indicating MSI believed the existing (older) key file was “newer” than the incoming one.

The root cause was an interaction between Windows Installer file versioning rules and a third‑party dependency packaging change. Azure CLI 2.76.0/2.77.0 consumed pywin32 311, whose .pyd binaries were missing Windows version resource metadata. When upgrading from a previous Azure CLI build that contained version-stamped pywin32 binaries (e.g., pywin32 306), MSI could treat the older versioned files as higher priority than the incoming non-versioned files. As a result, MSI could remove the old files during upgrade but skip installing the new ones, leaving the install incomplete.

Version mapping observed

Azure CLI version

Python

pywin32

pywin32 .pyd version resource

≤ 2.75.0

3.12

306

Present (e.g., 3.12.306.0)

2.76.0

3.12

311

Missing / empty

2.77.0+

3.13

311

Missing / empty

If you need to collect MSI logs (for support)

Run the installer with verbose logging (example):

msiexec /i "azure-cli-2.77.0.msi" /l*vx "C:\temp\azure-cli-install.log"

References

 

Windows MSI Upgrade Performance Optimization

The MSI upgrade process for Azure CLI on Windows has been significantly improved.

Previously, Windows Installer performed per‑file version comparisons—particularly expensive for Python runtime files—which made upgrades slow and sometimes inconsistent.

With the new logic, which skips the comparison and performs an overwrite installation. Upgrades now use a streamlined clean‑install process, resulting in faster and more reliable MSI upgrades.

Performance Improvements

Scenario

Before

After

Improvement

Fresh Install

Baseline

~5% faster

5% faster

Upgrade

Long due to file-by-file version comparison

~23% faster

23% faster

This update makes upgrades noticeably faster and more reliable by removing old files first and skipping slow per‑file version checks.

For more details, please refer to: [Packaging] Optimize MSI upgrade performance by simplifying file replacement logic by wangzelin007 · Pull Request #32678 · Azure/azure-cli

 

We encourage you to upgrade to the latest version of the Azure CLI. This will not only resolve the issue but also improve installation performance. Here is our release note.
If you encounter any problems, please feel free to report them on Azure CLI GitHub.

Updated Feb 02, 2026
Version 1.0
No CommentsBe the first to comment