Skip to content

Commit

Permalink
fix: always specify agent identity ID when logging into azure for lin…
Browse files Browse the repository at this point in the history
…ux (#5408)

Co-authored-by: Cameron Meissner <[email protected]>
  • Loading branch information
cameronmeissner and Cameron Meissner authored Dec 11, 2024
1 parent eb360a6 commit 16c95f2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packer.mk
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,17 @@ endif
endif

az-login:
@echo "Logging into Azure with agent VM MSI..."
ifeq (${MODE},windowsVhdMode)
ifeq ($(origin MANAGED_IDENTITY_ID), undefined)
@echo "Logging in with Hosted Pool's Default Managed Identity"
@az login --identity
else
@echo "Logging in with Hosted Pool's Managed Identity: ${MANAGED_IDENTITY_ID}"
@az login --identity --username ${MANAGED_IDENTITY_ID}
endif
else
@echo "Logging into Azure with identity: ${AZURE_MSI_RESOURCE_STRING}..."
@az login --identity --username ${AZURE_MSI_RESOURCE_STRING}
endif
@echo "Using the subscription ${SUBSCRIPTION_ID}"
@az account set -s ${SUBSCRIPTION_ID}
Expand Down

0 comments on commit 16c95f2

Please sign in to comment.