fix: revert UAMI assignment to only require AZURE_MSI_RESOURCE_STRING#8059
Merged
awesomenix merged 1 commit intomainfrom Mar 10, 2026
Merged
fix: revert UAMI assignment to only require AZURE_MSI_RESOURCE_STRING#8059awesomenix merged 1 commit intomainfrom
awesomenix merged 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR restores the original behavior for attaching a user-assigned managed identity (UAMI) to Packer build VMs by keying the assignment solely off AZURE_MSI_RESOURCE_STRING, resolving Windows VHD build failures where azcopy login --login-type=MSI falls back to the VM’s system-assigned identity and hits 403s.
Changes:
- Revert UAMI assignment gating in
produce-packer-settings.shto only requireAZURE_MSI_RESOURCE_STRING. - Ensure
msi_resource_stringsis populated whenever the UAMI resource ID is provided, independent ofPRIVATE_PACKAGES_URL.
timmy-wright
approved these changes
Mar 10, 2026
cameronmeissner
requested changes
Mar 10, 2026
Contributor
cameronmeissner
left a comment
There was a problem hiding this comment.
we should gate this behind windows builds specifically - this was done to ensure that linux packer VMs aren't over-permissioned, particularly with respect to builds within the TME tenant.
PR #7660 added PRIVATE_PACKAGES_URL as a required condition for attaching the UAMI to the Packer VM. This broke Windows VHD builds where PRIVATE_PACKAGES_URL is not set, causing azcopy 403 errors when downloading from blob storage (AuthorizationPermissionMismatch). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
cameronmeissner
approved these changes
Mar 10, 2026
janenotjung-hue
pushed a commit
that referenced
this pull request
Mar 11, 2026
…#8059) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
saewoni
pushed a commit
that referenced
this pull request
Mar 20, 2026
…#8059) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Windows VHD builds are failing with azcopy 403
AuthorizationPermissionMismatcherrors when trying to download container images (e.g.servercore.tar) fromwcctagentbakerstorageblob storage.All 6 Windows VHD build jobs fail:
build_win_2022_v1,build_win_2022_v2,build_win_23H2_v1,build_win_23H2_v2,build_win_2025_v1,build_win_2025_v2.Failed build: https://msazure.visualstudio.com/CloudNativeCompute/_build/results?buildId=156157838
Root Cause
PR #7660 changed the UAMI assignment condition in
produce-packer-settings.shfrom:to:
This means the User-Assigned Managed Identity is only attached to the Packer VM when both
AZURE_MSI_RESOURCE_STRINGandPRIVATE_PACKAGES_URLare set. Windows VHD build pipelines setAZURE_MSI_RESOURCE_STRINGbut notPRIVATE_PACKAGES_URL, so the UAMI never gets assigned to the Packer VM.Inside the Packer VM,
configure-windows-vhd.ps1callsazcopy.exe login --login-type=MSI, which then authenticates with the VM's system-assigned identity (which lacks Storage Blob Data Reader on the source storage account) instead of the intended UAMI.Fix
Revert the condition to only require
AZURE_MSI_RESOURCE_STRING, restoring the original behavior where the UAMI is assigned whenever it is configured, regardless ofPRIVATE_PACKAGES_URL.Testing