Skip to content

Commit 3c0b66b

Browse files
authored
chore: cherry pick azcli login for azcopy and fix e2e (#7494)
1 parent b613b18 commit 3c0b66b

File tree

5 files changed

+8
-12
lines changed

5 files changed

+8
-12
lines changed

e2e/config/azure.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type AzureClient struct {
4343
StorageContainers *armstorage.BlobContainersClient
4444
CacheRulesClient *armcontainerregistry.CacheRulesClient
4545
Core *azcore.Client
46-
Credential *azidentity.DefaultAzureCredential
46+
Credential *azidentity.AzureCLICredential
4747
Maintenance *armcontainerservice.MaintenanceConfigurationsClient
4848
NetworkInterfaces *armnetwork.InterfacesClient
4949
PrivateDNSZoneGroup *armnetwork.PrivateDNSZoneGroupsClient
@@ -125,9 +125,9 @@ func NewAzureClient() (*AzureClient, error) {
125125
},
126126
}
127127

128-
credential, err := azidentity.NewDefaultAzureCredential(nil)
128+
credential, err := azidentity.NewAzureCLICredential(nil)
129129
if err != nil {
130-
return nil, fmt.Errorf("failed to create credential: %w", err)
130+
return nil, fmt.Errorf("creating azure cli credential: %w", err)
131131
}
132132

133133
plOpts := runtime.PipelineOptions{}

vhdbuilder/packer/convert-sig-to-classic-storage-account-blob.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ capture_benchmark "${SCRIPT_NAME}_grant_access_to_disk"
132132
echo "Uploading $disk_resource_id to ${CLASSIC_BLOB}/${CAPTURED_SIG_VERSION}.vhd"
133133

134134
echo "Setting azcopy environment variables with pool identity: $AZURE_MSI_RESOURCE_STRING"
135-
export AZCOPY_AUTO_LOGIN_TYPE="MSI"
136-
export AZCOPY_MSI_RESOURCE_STRING="$AZURE_MSI_RESOURCE_STRING"
135+
export AZCOPY_AUTO_LOGIN_TYPE="AZCLI"
137136
export AZCOPY_CONCURRENCY_VALUE="AUTO"
138137
export AZCOPY_LOG_LOCATION="$(pwd)/azcopy-log-files/"
139138
export AZCOPY_JOB_PLAN_LOCATION="$(pwd)/azcopy-job-plan-files/"
@@ -176,4 +175,4 @@ fi
176175
capture_benchmark "${SCRIPT_NAME}_revoke_access_and_delete_disk"
177176

178177
capture_benchmark "${SCRIPT_NAME}_overall" true
179-
process_benchmarks
178+
process_benchmarks

vhdbuilder/packer/imagecustomizer/scripts/publish-imagecustomizer-image.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ capture_benchmark "${SCRIPT_NAME}_prepare_upload_vhd_to_blob"
3939
echo "Uploading ${OUT_DIR}/${CONFIG}.vhd to ${CLASSIC_BLOB}/${CAPTURED_SIG_VERSION}.vhd"
4040

4141
echo "Setting azcopy environment variables with pool identity: $AZURE_MSI_RESOURCE_STRING"
42-
export AZCOPY_AUTO_LOGIN_TYPE="MSI"
43-
export AZCOPY_MSI_RESOURCE_STRING="$AZURE_MSI_RESOURCE_STRING"
42+
export AZCOPY_AUTO_LOGIN_TYPE="AZCLI"
4443
export AZCOPY_CONCURRENCY_VALUE="AUTO"
4544

4645
export AZCOPY_LOG_LOCATION="$(pwd)/azcopy-log-files/"

vhdbuilder/packer/produce-packer-settings-functions.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,7 @@ function prepare_windows_vhd() {
297297
windows_sigmode_source_image_version=""
298298

299299
# default: build VHD images from a marketplace base image
300-
export AZCOPY_AUTO_LOGIN_TYPE="MSI" # use Managed Identity for AzCopy authentication
301-
export AZCOPY_MSI_RESOURCE_STRING="${AZURE_MSI_RESOURCE_STRING}"
300+
export AZCOPY_AUTO_LOGIN_TYPE="AZCLI" # use AZCLI for AzCopy authentication
302301
export AZCOPY_LOG_LOCATION="$(pwd)/azcopy-log-files/"
303302
export AZCOPY_JOB_PLAN_LOCATION="$(pwd)/azcopy-job-plan-files/"
304303
mkdir -p "${AZCOPY_LOG_LOCATION}"

vhdbuilder/prefetch/scripts/optimize.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,7 @@ convert_specialized_sig_version_to_managed_image() {
229229
return 1
230230
fi
231231
echo "setting azcopy environment variables with pool identity: ${IMAGE_BUILDER_IDENTITY_ID}"
232-
export AZCOPY_AUTO_LOGIN_TYPE="MSI"
233-
export AZCOPY_MSI_RESOURCE_STRING="${IMAGE_BUILDER_IDENTITY_ID}"
232+
export AZCOPY_AUTO_LOGIN_TYPE="AZCLI"
234233
export AZCOPY_CONCURRENCY_VALUE="AUTO"
235234
echo "uploading $disk_resource_id to ${TEMP_VHD_URI}"
236235
azcopy copy "${disk_sas_url}" "${TEMP_VHD_URI}" --recursive=true || return $?

0 commit comments

Comments
 (0)