The repo demonstrates Azure SDK usage via a complete application. This application takes in an image, uploads it to Blog Storage and enqueues a message into a Queue. A process receives that message and uses Form Recognizer to extract the text from the image, then uses Text Analytics to get the sentiment of the text, and then stores the results in a Cosmos DB.
The following are required to run this application.
- A Terminal - We tested this with Git Bash and WSL - it will not currently work with PowerShell or Windows Command Prompt. The Terraform deployment currently only works on Linux compatible systems. You will need to run all the commands below in your selected terminal.
- Install Azure CLI
- Install Terraform
- Install Git
- Install VS Code
- Install Docker
- An Azure Subscription
The following Azure resources will be deployed with the Terraform script.
- Resource Group
- Storage Account
- Cognitive Services Form Recognizer
- Cognitive Services Text Analytics
- Cosmos DB
- App Service: Plan
- App Service: Web Apps
- App Service: API Apps
- Application Insights
- Open Git Bash or WSL - The same terminal you used to install the pre-reqs above.
NOTE: Known issue: The following terraform deployment doesn't work in WSL2. We are investigating that issue for now use Git Bash.
- Clone Repo
git clone https://github.com/jongio/azsdkdemo
- Azure CLI Login
az login
- Create Azure Resources with Terraform
- CD to
iac/terraform
- Terraform init:
terraform init
- Terraform plan:
terraform plan -var="basename=azsdkdemo1" --out tf.plan
Change the
basename
variable fromazsdkdemo1
to something that will be globally unique. It will be used as part of Azure resource names, so keep it short, lowercase, and no special characters. - Terraform apply:
terraform apply tf.plan
- CD to
- Update
.env
file- Rename
.env.tmp
to.env
- Copy and paste the terraform output values to the .env file.
NOTE: .env files do not allow spaces around the
=
, so please remove any spaces after you copy and paste.
- Rename
- CD to
src
folder for the language you would like to run, i.e. for .NET, cd tosrc/net
for Python, cd tosrc/python
Run docker-compose up --build
- Navigate to http://localhost:1080
- Add an Image
- Enter url into text box and click "Submit"
- Or click "Add Random Meme"
- The image will be added to the grid. Wait for the service to pick it up. You will eventually see the text and the image border color will change indicating the image text sentiment.