Skip to content

Commit

Permalink
Compatibility support for AZ CLI v2.25.0 (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chambras authored Jun 24, 2021
1 parent c2cbbfe commit f7a7580
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
21 changes: 9 additions & 12 deletions src/scripts/config/mlz_config_create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit f7a7580

Please sign in to comment.