diff options
author | Paul Yu <pauyu@microsoft.com> | 2022-11-14 23:22:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-14 23:22:02 +0300 |
commit | eafa28287e15b51a2aa20a227056f0af43d20275 (patch) | |
tree | 0f411627b91ba04b9d1d3664b4e12fe003000c47 /src/azure-cli/install.sh | |
parent | e00724a0c6d4c4f8fab166e065d2b00c7357514b (diff) |
Add new option to install azure-cli extensions (#165)
* Add new option for azure-cli extensions
* Update to install az extensions as $_REMOTE_USER
* Skip unknown extensions
* Change azure cli extension option type to string
* Adding test for azure-cli extensions
Diffstat (limited to 'src/azure-cli/install.sh')
-rwxr-xr-x | src/azure-cli/install.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/azure-cli/install.sh b/src/azure-cli/install.sh index de5d65d..99b4af5 100755 --- a/src/azure-cli/install.sh +++ b/src/azure-cli/install.sh @@ -13,6 +13,7 @@ set -e rm -rf /var/lib/apt/lists/* AZ_VERSION=${VERSION:-"latest"} +AZ_EXTENSIONS=${EXTENSIONS} MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc" AZCLI_ARCHIVE_ARCHITECTURES="amd64" @@ -185,6 +186,17 @@ if [ "${use_pip}" = "true" ]; then fi fi +# If Azure CLI extensions are requested, loop through and install +if [ ${#AZ_EXTENSIONS[@]} -gt 0 ]; then + echo "Installing Azure CLI extensions: ${AZ_EXTENSIONS}" + extensions=(`echo ${AZ_EXTENSIONS} | tr ',' ' '`) + for i in "${extensions[@]}" + do + echo "Installing ${i}" + su ${_REMOTE_USER} -c "az extension add --name ${i} -y" || continue + done +fi + # Clean up rm -rf /var/lib/apt/lists/* |