ACloudGuru Azure Resume Challenge

ACloudGuru Azure Resume Challenge

Overview

I came across the latest #cloudguruchallenge and decided to give it a try. I work mainly with AWS on a day to day basis but have been looking at getting some exposure to Azure as well. So this looked like a great opportunity to do so. I am currently preparing for my AWS Developer Associate exam and didn't want to go too deep into Azure right before the exam, but I do plan on once I'm done with the AWS exam to revisit this project and deep-dive into some more topics.

The Challenge

The challenge was to create a static website that is hosted on Azure Blob Storage and then have an API call to an Azure Function to get the website visitors count from a CosmosDB and update the count as well. Then using Azure CDN to enable HTTPS and custom domain support. Then for CI/CD as well you had to use GitHub Actions to deploy any changes you make to your website or API and also build in tests for the API.

How I did it

As I use the AWS CLI allot I decided to do a majority of this challenge with the Azure CLI to create my resources that I needed and then I used Visual Studio to create my Azure Function and upload/push my Function from VS Code.

Here are a few of the Azure CLI I used to create my resources, I did end up using a Python script in the end to run these commands automatically in order.

This was used to create a resource group so I could automatically group all the resources I planned on using in this challenge together. carbon.png

Then I went on to create my database account that will hold my website visitor counter, so that the Azure Function could later retrieve the count, update it and save it in the database. I used CosmosDB for this.

carbon (1).png The step above will create your CosmosDB account and now that you have a CosmosDB account you can go ahead and create the actual database that will hold your information.

carbon (2).png Now that our database is create we can now create the container for that database, assigned it a partition key and this is where your actual data will be in. The Azure Docs on containers gave me a good overview as to what containers are and how they work.

carbon (3).png

For the Azure Function I used VS Code with the Azure Extension to build my function locally and once tested I uploaded it via VS Code to my Azure Functions App. I used Python as my language for my Azure Function.

carbon (5).png With this Function, it will retrieve my counter information from the CosmosDB, it will add 1 to that count and then will turn the response into JSON format so that I can display it on the frontend by calling the Azure Function API with JavaScript and then display the count on the resume page.

Had to dig in allot into bindings and how they work for my Azure Function. Which basically allows me in my Python code to work with the CosmosDB data (binding directions for in and out - so that I can get the data from the DB alter it and POST it back into my DB and update the information that I needed).

I will do a second post later mainly on the VS Code with Azure extension and how I created the Function from the VS Code IDE, to keep this post shorter.

Azure CDN / HTTPS and custom domain

Was great learning about the CDN, implementing HTTPS with it and then linking up a custom domain to the CDN. Working with AWS Route 53 and AWS CloudFront was great to be able to compare the two to each other. Azure CDN made it extremely easy to setup HTTPS and add the custom domain to your static site.

GitHub Actions

For the CI/CD for this challenge, GitHub Actions was used for the Frontend portion as well as for the Backend with some testing on the API to make sure the data returned was valid before going forward.

The Challenge Questions

Hardest part

Coming mostly from working with AWS, getting into Azure Functions wasn't too difficult understanding how it worked but getting to know the bindings and creating those bindings in the function.json and understanding how the integrated with each other was where my time was spend the most on.

Which part I enjoyed most

Building the Azure Function locally and then deploying it to Azure. The fact you could test out your function locally before submitting it to Azure online was a great way to build the Azure Function and doing tests, specially if you are just out learning it for the first time. But enjoyed testing out and configuring the Azure CDN/HTTPS and custom domain as well, seeing how it integrated seamlessly with the Blob Static Website.

Biggest Takeaway

That doing a challenge like this or any hands-on project is truly the only way to learn and really understand any topic you are working on. The Azure Docs are really great at explaining topics and the infrastructure but after doing it seeing how all the pieces fits into each other, really gives you in-depth view of each service.

Conclusion

I will be doing this exact challenge but on AWS to help prepare for the AWS Developer Associate and also to compare between AWS and Azure on the same concepts but between the two platforms.