This project automates image processing using Azure Logic Apps and Linux shell scripting. The workflow includes:
✅ Uploading images to Azure Blob Storage.
✅ A Logic App triggers a shell script when a new image is uploaded.
✅ A Linux-based script processes the images (resize, watermark, etc.).
✅ The processed images are stored in another Blob container.
- Step 1: Set Up Azure Blob Storage
- Step 2: Deploy a Linux VM (or Use ACI)
- Step 3: Write the Image Processing Shell Script
- Step 4: Set Up Azure Logic Apps
- Step 5: Set Up an API to Run the Script
- Step 6: Test the System
- 📊 Summary
- 🎯 Learning Outcomes
- 📚 Official Documentation
- 📞 Contact
- Storage Setup Script: Infrastructure/storage_setup.sh
- This script creates an Azure Storage Account with two containers:
- raw-images → Stores the original images.
- processed-images → Stores the processed images.
- This script creates an Azure Storage Account with two containers:
- VM Setup Script: Infrastructure/vm_setup.sh
- This script creates an Azure Linux VM or sets up Azure Container Instances (ACI) for running the image processing script.
- Image Processing Script: Scripts/process_images.sh
- This script fetches images from Blob Storage, processes them, and uploads the processed images back to Blob Storage.
-
Create a Logic App:
- Go to the Azure portal and create a new Logic App.
-
Add Trigger: When a Blob is Added or Modified:
- Choose the trigger "When a blob is added or modified (V2)".
- Configure it to point to your raw-images container in your Azure Blob Storage.
- This trigger will activate the Logic App whenever a new image is uploaded or an existing image is updated.
-
Add Action: HTTP Request:
- After the blob trigger, add a new action for the HTTP request.
- Choose the action "HTTP".
- Set the method to POST and provide the URL for your Flask API endpoint (e.g.,
http://<your-vm-ip>:8080/run-script
). - In the body, you can include any relevant data if necessary (e.g., the name of the blob or any other parameters).
-
Add Trigger: When an HTTP Request is Received:
- If you want to manually trigger the processing, add a second trigger by choosing "When an HTTP request is received".
- This will allow you to invoke the Logic App via an HTTP request whenever you need to process the images.
-
Configure the Logic App:
- Once you have set up both triggers, you can define the workflow further by connecting additional actions as needed, such as logging or sending notifications.
- API Script: APIs/app.py
- This Flask API allows the Logic App to trigger the image processing script.
-
Upload an Image to
raw-images
:az storage blob upload --container-name raw-images --account-name store4serverless --file sample.jpg
-
Trigger the Logic App:
- This is automatically triggered by the blob upload.
-
Test the Flask API Manually (if needed):
curl -X POST http://<your-vm-ip>:8080/run-script
-
Execute the Image Processing Script Manually (for testing):
cd Scripts ./process_images.sh
-
Check the
processed-images
Container to see if the processed image appears.
Step | Task | Files |
---|---|---|
1️⃣ | Set up Azure Blob Storage | storage_setup.sh |
2️⃣ | Deploy Linux VM / ACI | vm_setup.sh |
3️⃣ | Write Shell Script | process_images.sh |
4️⃣ | Set Up Logic App | Azure Portal |
5️⃣ | Create API to Trigger Script | app.py |
6️⃣ | Test the Workflow | Azure CLI |
✅ Hands-on Azure Logic Apps for automation.
✅ Advanced Bash scripting for image processing.
✅ Real-world Azure Blob Storage Management.
✅ Deployment of serverless solutions using ACI or VM.
✅ Secure VM automation with Flask APIs & HTTP triggers.
- Azure Logic Apps Documentation 📄
- Azure Blob Storage Documentation 📄
- Flask Documentation 📄
- Bash Scripting Guide 📄
For any help or inquiries regarding this project, feel free to reach out to me at search4akash@outlook.com!