From cd05337b20d7f9af17abf9319d43fc5cec30bf4f Mon Sep 17 00:00:00 2001 From: Marcelo Zambrana Villarroel Date: Thu, 24 Jun 2021 12:12:43 -0400 Subject: [PATCH 1/2] Compatibility support for AZ CLI v2.25.0 --- .devcontainer/Dockerfile | 2 +- src/Dockerfile | 2 +- src/scripts/config/mlz_config_create.sh | 23 ++++++++++------------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 8be5c4c4c..2236406d8 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -14,7 +14,7 @@ ARG TFLINT_VERSION=0.29.1 ARG TFLINT_AZURERM=0.10.1 # Azure CLI version -ARG AZURE_CLI_VERSION=2.22.0-1~focal +ARG AZURE_CLI_VERSION=2.25.0-1~focal # Update distro (software-properties-common installs the add-apt-repository command) RUN apt-get update \ diff --git a/src/Dockerfile b/src/Dockerfile index 5232c378b..a15fc0be8 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -14,7 +14,7 @@ ARG TFLINT_VERSION=0.29.1 ARG TFLINT_AZURERM=0.10.1 # Azure CLI version -ARG AZURE_CLI_VERSION=2.22.0-1~focal +ARG AZURE_CLI_VERSION=2.25.0-1~focal # Update distro (software-properties-common installs the add-apt-repository command) RUN apt-get update \ diff --git a/src/scripts/config/mlz_config_create.sh b/src/scripts/config/mlz_config_create.sh index fd2d10994..cfeaec1c2 100755 --- a/src/scripts/config/mlz_config_create.sh +++ b/src/scripts/config/mlz_config_create.sh @@ -114,26 +114,23 @@ wait_for_sp_property() { # Create Azure AD application registration and Service Principal # TODO: Lift the subscription scoping out of here and move into conditional echo "INFO: verifying service principal ${mlz_sp_name} is unique..." -if [[ -z $(az ad sp list --filter "displayName eq '${mlz_sp_name}'" --query "[].displayName" -o tsv) ]];then +if [[ -z $(az ad sp list --filter "displayName eq 'http://${mlz_sp_name}'" --query "[].displayName" -o tsv) ]];then echo "INFO: creating service principal ${mlz_sp_name}..." - sp_pwd=$(az ad sp create-for-rbac \ - --name "http://${mlz_sp_name}" \ + sp_creds=($(az ad sp create-for-rbac \ + --name "http://mlz-dev-terraform-sp" \ --skip-assignment true \ - --query password \ + --query '[password, appId]' \ --only-show-errors \ - --output tsv) + --output tsv)) - wait_for_sp_creation "http://${mlz_sp_name}" - wait_for_sp_property "http://${mlz_sp_name}" "appId" - wait_for_sp_property "http://${mlz_sp_name}" "objectId" + sp_pwd=${sp_creds[0]} + sp_clientid=${sp_creds[1]} - sp_clientid=$(az ad sp show \ - --id "http://${mlz_sp_name}" \ - --query appId \ - --output tsv) + wait_for_sp_creation $sp_clientid + wait_for_sp_property $sp_clientid "objectId" sp_objid=$(az ad sp show \ - --id "http://${mlz_sp_name}" \ + --id "${sp_clientid}" \ --query objectId \ --output tsv) From e51037e2346b0a723b7a2d66fd9a7705b317afb3 Mon Sep 17 00:00:00 2001 From: Marcelo Zambrana Villarroel Date: Thu, 24 Jun 2021 12:12:43 -0400 Subject: [PATCH 2/2] Compatibility support for AZ CLI v2.25.0 --- .devcontainer/Dockerfile | 2 +- src/Dockerfile | 2 +- src/scripts/config/mlz_config_create.sh | 21 +++++++++------------ 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 8be5c4c4c..2236406d8 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -14,7 +14,7 @@ ARG TFLINT_VERSION=0.29.1 ARG TFLINT_AZURERM=0.10.1 # Azure CLI version -ARG AZURE_CLI_VERSION=2.22.0-1~focal +ARG AZURE_CLI_VERSION=2.25.0-1~focal # Update distro (software-properties-common installs the add-apt-repository command) RUN apt-get update \ diff --git a/src/Dockerfile b/src/Dockerfile index 5232c378b..a15fc0be8 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -14,7 +14,7 @@ ARG TFLINT_VERSION=0.29.1 ARG TFLINT_AZURERM=0.10.1 # Azure CLI version -ARG AZURE_CLI_VERSION=2.22.0-1~focal +ARG AZURE_CLI_VERSION=2.25.0-1~focal # Update distro (software-properties-common installs the add-apt-repository command) RUN apt-get update \ diff --git a/src/scripts/config/mlz_config_create.sh b/src/scripts/config/mlz_config_create.sh index fd2d10994..d86e8e123 100755 --- a/src/scripts/config/mlz_config_create.sh +++ b/src/scripts/config/mlz_config_create.sh @@ -114,26 +114,23 @@ wait_for_sp_property() { # Create Azure AD application registration and Service Principal # TODO: Lift the subscription scoping out of here and move into conditional echo "INFO: verifying service principal ${mlz_sp_name} is unique..." -if [[ -z $(az ad sp list --filter "displayName eq '${mlz_sp_name}'" --query "[].displayName" -o tsv) ]];then +if [[ -z $(az ad sp list --filter "displayName eq 'http://${mlz_sp_name}'" --query "[].displayName" -o tsv) ]];then echo "INFO: creating service principal ${mlz_sp_name}..." - sp_pwd=$(az ad sp create-for-rbac \ + sp_creds=($(az ad sp create-for-rbac \ --name "http://${mlz_sp_name}" \ --skip-assignment true \ - --query password \ + --query '[password, appId]' \ --only-show-errors \ - --output tsv) + --output tsv)) - wait_for_sp_creation "http://${mlz_sp_name}" - wait_for_sp_property "http://${mlz_sp_name}" "appId" - wait_for_sp_property "http://${mlz_sp_name}" "objectId" + sp_pwd=${sp_creds[0]} + sp_clientid=${sp_creds[1]} - sp_clientid=$(az ad sp show \ - --id "http://${mlz_sp_name}" \ - --query appId \ - --output tsv) + wait_for_sp_creation $sp_clientid + wait_for_sp_property $sp_clientid "objectId" sp_objid=$(az ad sp show \ - --id "http://${mlz_sp_name}" \ + --id "${sp_clientid}" \ --query objectId \ --output tsv)