Skip to content
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
Original file line number Diff line number Diff line change
@@ -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.
Hi mate, how are you?
26 changes: 26 additions & 0 deletions samples/function-app-managed-identity/python/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 "${TMPDIR:-/tmp}/processed-output.XXXXXX")" || { echo "Failed to create temporary file." >&2; exit 1; }

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 "Failed to download processed blob [$BLOB_NAME] from container [$OUTPUT_CONTAINER_NAME]." >&2; exit 1; }

echo "Input file [$FILE_PATH]:"
cat "$FILE_PATH"

echo ""
echo "Processed output file [$BLOB_NAME]:"
cat "$TEMP_OUTPUT_FILE"
echo ""

exit 0
fi

Expand Down
Loading