Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Lab 1 - Getting the Java API up and running in Azure

This workshop is adapting the ToDo Application Azure sample with a Java API. The sample comprises a "complete ToDo application that includes everything you need to build and deploy an Azure solution. This application uses the Azure Developer CLI (azd) to get you up and running on Azure quickly, React.js for the Web application, Java for the API and Azure Database for PostgreSQL flexible server for storage. It includes application code, tools, and pipelines that serve as a foundation from which you can build upon and customize when creating your own solutions."

If you want to learn more about the sample and it's architecture, you can check out the GitHub repo linked above. For this workshop, we're only interested in the Java API which will serve as the backend for the ToDo application we'll be building with Power Apps.

So let's jump in and get the ToDo Java API up and running in Azure.

Step 1 - Download the prerequisites

The following prerequisites are required to install this application. Please ensure that you have them all installed locally.

Step 2 - Installing the azd template (Adapted from here)

The fastest way for you to get this API up and running on Azure is to use the azd up command. This single command will create and configure all the necessary Azure resources that we need.

  1. Open a terminal (like Command Prompt) and create a new empty folder called Java_ToDo.
mkdir Java_ToDo
  1. Then change into the newly created folder.
cd Java_ToDo
  1. Run the following command to initialize the project.
azd init --template Azure-Samples/ASA-Samples-Web-Application -b azd-conp

This command will clone the code to your current folder and prompt you for the following information:

Environment Name: This will be used as a prefix for the resource group that will be created to hold all Azure resources. This name should be unique within your Azure subscription.

  1. Run the following command to login to your Azure account.
azd auth login

This command will open your browser; prompting you to sign into your Azure account.

Once you have successfully authenticated, you'll see this message in your browser:

Message confirming that you have authenticated with Azure

Close the browser tab and return to the terminal.

  1. Run the following command to enable Azure Spring Apps feature for AZD.
azd config set alpha.springapp on
  1. Run the following command to package a deployable copy of your application, provision the template's infrastructure to Azure and also deploy the application code to those newly provisioned resources.
azd up

This command will prompt you for the following information:

Azure Subscription: The Azure Subscription where your resources will be deployed.

Azure Location: The Azure location where your resources will be deployed.

Note: This may take a while to complete as it executes three commands:

  • azd package (packages a deployable copy of your application)
  • azd provision (provisions Azure resources)
  • azd deploy (deploys application code)

You will see a progress indicator as it packages, provisions and deploys your application.

When azd up is complete, it will output the deployed ToDo Web application endpoint:

Screenshot of URLs that were created and deployed

Copy the deployed Web endpoint and add the suffix of /swagger-ui.html, paste in your browser and launch the ToDo OpenAPI definition.

Note: Bookmark this API URL or keep it somewhere safe for later reference in Lab 3.

Screenshot of the ToDo OpenAPI definition

We will be adding some data in the next lab.

Note: The azd up command will create Azure resources that will incur costs to your Azure subscription. Once you are done with the workshop, You can clean up those resources manually via the Azure portal or with the azd down command.