Last active
June 2, 2025 02:53
-
-
Save dinowang/fb51fec722760be626890dda4c5bba17 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
az upgrade --all false | |
remote_versions=$(az extension list-available --query "[?installed].{name:name, version:version}") | |
local_versions=$(az extension list --query "[].{name:name, installed_version:version}") | |
versions=$(jq -n --argjson local "$local_versions" --argjson remote "$remote_versions" ' | |
reduce $local[] as $l ( | |
{}; | |
.[$l.name] = { | |
name: $l.name, | |
installed_version: $l.installed_version, | |
version: ($remote[] | select(.name == $l.name) | .version) | |
} | |
) | |
') | |
outdated=$(echo "$versions" | jq -r '.[] | select(.installed_version != .version) | .name + "," + .version') | |
if [ "$outdated" = "" ]; then | |
echo "No outdated azcli extensions found." | |
else | |
for line in $(echo $outdated); do | |
name=$(echo $line | cut -d, -f1) | |
version=$(echo $line | cut -d, -f2) | |
echo az extension update --name "$name" --allow-preview true --verbose | |
echo $version release history: https://github.com/Azure/azure-cli-extensions/blob/main/src/$name/HISTORY.rst | |
az extension update --name "$name" --allow-preview true --verbose | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment