Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility support for AZ CLI v2.25.0 #263

Merged
merged 3 commits into from
Jun 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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