From a0023425aa84dc21a5df1a91c8bd1e4b12f77d38 Mon Sep 17 00:00:00 2001 From: Paolo Salvatori Date: Tue, 16 Jun 2026 11:35:14 +0200 Subject: [PATCH 1/5] Change test in Azure Functions App with Managed Identity sample --- .../python/scripts/input.txt | 2 +- .../python/scripts/test.sh | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/samples/function-app-managed-identity/python/scripts/input.txt b/samples/function-app-managed-identity/python/scripts/input.txt index 2963a6c..ea442d9 100644 --- a/samples/function-app-managed-identity/python/scripts/input.txt +++ b/samples/function-app-managed-identity/python/scripts/input.txt @@ -1 +1 @@ -Azure managed identities provide an identity for Azure services to use when connecting to other Azure services that support Microsoft Entra ID authentication, eliminating the need to manage credentials in code. They function as a special type of service principal, managed by Azure, and have two types: system-assigned (tied to a single resource's lifecycle) and user-assigned (a standalone resource that can be shared across multiple resources). Key benefits include simplified credential management and improved security, as Azure automatically handles the rotation and protection of credentials. \ No newline at end of file +Hi mate, how are you? \ No newline at end of file diff --git a/samples/function-app-managed-identity/python/scripts/test.sh b/samples/function-app-managed-identity/python/scripts/test.sh index 374a7a5..12da7f4 100755 --- a/samples/function-app-managed-identity/python/scripts/test.sh +++ b/samples/function-app-managed-identity/python/scripts/test.sh @@ -8,6 +8,15 @@ INPUT_CONTAINER_NAME="input" OUTPUT_CONTAINER_NAME="output" STORAGE_ACCOUNT_NAME="${PREFIX}storage${SUFFIX}" CURRENT_DIR="$(cd "$(dirname "$0")" && pwd)" +TEMP_OUTPUT_FILE="" + +cleanup() { + if [ -n "$TEMP_OUTPUT_FILE" ] && [ -f "$TEMP_OUTPUT_FILE" ]; then + rm -f "$TEMP_OUTPUT_FILE" + fi +} + +trap cleanup EXIT # Change the current directory to the script's directory cd "$CURRENT_DIR" || exit @@ -101,6 +110,23 @@ for ((i=1; i<=n; i++)); do if [ "$BLOB_EXISTS" == "true" ]; then echo "Processed file [$BLOB_NAME] found in the [$OUTPUT_CONTAINER_NAME] container." + TEMP_OUTPUT_FILE=$(mktemp) + + az storage blob download \ + --container-name "$OUTPUT_CONTAINER_NAME" \ + --name "$BLOB_NAME" \ + --file "$TEMP_OUTPUT_FILE" \ + --account-name "$STORAGE_ACCOUNT_NAME" \ + --auth-mode login 1>/dev/null + + echo "Input file [$FILE_PATH]:" + cat "$FILE_PATH" + + echo "" + echo "Processed output file [$BLOB_NAME]:" + cat "$TEMP_OUTPUT_FILE" + echo "" + exit 0 fi From 1e5d16d83b788df567b80209daffc54d3de64d9c Mon Sep 17 00:00:00 2001 From: Paolo Salvatori Date: Tue, 16 Jun 2026 11:40:33 +0200 Subject: [PATCH 2/5] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- samples/function-app-managed-identity/python/scripts/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/function-app-managed-identity/python/scripts/test.sh b/samples/function-app-managed-identity/python/scripts/test.sh index 12da7f4..22bebc9 100755 --- a/samples/function-app-managed-identity/python/scripts/test.sh +++ b/samples/function-app-managed-identity/python/scripts/test.sh @@ -110,7 +110,7 @@ for ((i=1; i<=n; i++)); do if [ "$BLOB_EXISTS" == "true" ]; then echo "Processed file [$BLOB_NAME] found in the [$OUTPUT_CONTAINER_NAME] container." - TEMP_OUTPUT_FILE=$(mktemp) + TEMP_OUTPUT_FILE="$(mktemp "${TMPDIR:-/tmp}/processed-output.XXXXXX")" || { echo "Failed to create temporary file." >&2; exit 1; } az storage blob download \ --container-name "$OUTPUT_CONTAINER_NAME" \ From 1836d1d28760ea5187b6f11c2a687186b78d609e Mon Sep 17 00:00:00 2001 From: Paolo Salvatori Date: Tue, 16 Jun 2026 11:40:48 +0200 Subject: [PATCH 3/5] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- samples/function-app-managed-identity/python/scripts/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/function-app-managed-identity/python/scripts/test.sh b/samples/function-app-managed-identity/python/scripts/test.sh index 22bebc9..02cea01 100755 --- a/samples/function-app-managed-identity/python/scripts/test.sh +++ b/samples/function-app-managed-identity/python/scripts/test.sh @@ -117,7 +117,7 @@ for ((i=1; i<=n; i++)); do --name "$BLOB_NAME" \ --file "$TEMP_OUTPUT_FILE" \ --account-name "$STORAGE_ACCOUNT_NAME" \ - --auth-mode login 1>/dev/null + --auth-mode login 1>/dev/null || { echo "Failed to download processed blob [$BLOB_NAME] from container [$OUTPUT_CONTAINER_NAME]." >&2; exit 1; } echo "Input file [$FILE_PATH]:" cat "$FILE_PATH" From 91ba5c6a04b41e94467402d3f21651439a93cbc7 Mon Sep 17 00:00:00 2001 From: Paolo Salvatori Date: Tue, 16 Jun 2026 11:41:00 +0200 Subject: [PATCH 4/5] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- samples/function-app-managed-identity/python/scripts/input.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/function-app-managed-identity/python/scripts/input.txt b/samples/function-app-managed-identity/python/scripts/input.txt index ea442d9..2963a6c 100644 --- a/samples/function-app-managed-identity/python/scripts/input.txt +++ b/samples/function-app-managed-identity/python/scripts/input.txt @@ -1 +1 @@ -Hi mate, how are you? \ No newline at end of file +Azure managed identities provide an identity for Azure services to use when connecting to other Azure services that support Microsoft Entra ID authentication, eliminating the need to manage credentials in code. They function as a special type of service principal, managed by Azure, and have two types: system-assigned (tied to a single resource's lifecycle) and user-assigned (a standalone resource that can be shared across multiple resources). Key benefits include simplified credential management and improved security, as Azure automatically handles the rotation and protection of credentials. \ No newline at end of file From 883c0de4d236746e385f768b386c28d40a6153ca Mon Sep 17 00:00:00 2001 From: Paolo Salvatori Date: Tue, 16 Jun 2026 11:46:24 +0200 Subject: [PATCH 5/5] Change --- samples/function-app-managed-identity/python/scripts/input.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/function-app-managed-identity/python/scripts/input.txt b/samples/function-app-managed-identity/python/scripts/input.txt index 2963a6c..ea442d9 100644 --- a/samples/function-app-managed-identity/python/scripts/input.txt +++ b/samples/function-app-managed-identity/python/scripts/input.txt @@ -1 +1 @@ -Azure managed identities provide an identity for Azure services to use when connecting to other Azure services that support Microsoft Entra ID authentication, eliminating the need to manage credentials in code. They function as a special type of service principal, managed by Azure, and have two types: system-assigned (tied to a single resource's lifecycle) and user-assigned (a standalone resource that can be shared across multiple resources). Key benefits include simplified credential management and improved security, as Azure automatically handles the rotation and protection of credentials. \ No newline at end of file +Hi mate, how are you? \ No newline at end of file