Learn what you need to set up and configure your development environment before we start to build our example generative AI app.
What we cover:​
- Installing required development tools and services on your local machine
- Configuring the Azure Cosmos DB that the back-end application uses
- Setting up the Azure Key Vault that will store application secrets
- Creating a Microsoft Entra ID app registration to enable Microsoft Account sign-in for our app
Introduction​
As we introduced in the previous post, this series walks you through building an example AI-powered content generation app for Best For You Organics Company. This app will help our fictitious company support a new skin-care product by generating a variety of marketing materials, including social media posts, blog articles, and email campaigns. Tailored specifically for the skin-care industry, the app will allow them to efficiently create and customize content for different platforms, enabling them to more effectively reach their target audience.
In this blog, we take you through setting up your local development environment and configuring several essential services in the Azure portal. You install tools, such as Git, Java, and Node.js, and set up Azure resources, such as Azure Cosmos DB and Azure Key Vault.
Local machine setup​
Before diving into the Azure components, let’s ensure that your local development machine is equipped with all the tools you need to build the app.
Step 1. Install Git.​
Git is essential for version control and managing your project’s source code.
- Download Git. Go to Install and set up Git, and download the installer for your operating system.
- Installation. Run the installer. Unless you have specific preferences, use the default settings.
- Verify installation. Open your terminal and run:
git --version
Step 2. Install Java (17 and 21).​
Your Spring Boot back end requires both Java 17 and 21.
- Download. Obtain both versions from Download the Microsoft Build of OpenJDK.
- Configure. You can manage multiple Java versions using update alternatives (Linux) or SDKMAN (for Linux/Mac). For Windows, use Java Development Kit (JDK) tools, like JDKTool.
- Verify installation. Open your terminal and run:
java -version
Step 3. Install the Azure CLI.​
The Azure CLI is essential for managing your Azure resources from the terminal.
- Download the Azure CLI. Follow the instructions in How to install the Azure CLI.
- Sign in to Azure. After installing the Azure CLI, sign in. Open your terminal and run:
az login
Step 4. Install Node.js and set up React.​
We use Node.js for managing front-end dependencies and running the React development server.
- Install Node.js. Go to Node.js, and download the appropriate version for your system.
- Verify installation. Confirm that Node.js is correctly installed. Open your terminal and run:
node -v && npm -v
Step 5. Install an integrated development environment.​
You can use your preferred integrated development environment (IDE), but we recommend Visual Studio Code and IntelliJ IDEA for Java and JavaScript development.
Both IDEs support Azure integrations through plugins for managing Azure resources and services.
Azure setup​
Now that your local environment is ready, let’s configure the Azure resources you need to build and run the app.
Step 1. Set up Azure basics.​
Before you start configuring resources, choose the Azure account you want to use. If you want to use the Azure CLI to configure Azure resources, perform a few configuration steps:
- Create a new account—unless you already have one (optional).
If you don’t have an existing Azure account that you want to use when creating Azure resources, create a new one. Go to the Azure portal and sign up. Choose the subscription plan that fits your business needs. - Configure the Azure CLI, if you want use it (optional).
The steps throughout this series include instructions for using either the browser-based Azure portal or the command-line Azure CLI tool. If you want to use the Azure CLI but don’t already have it installed, follow these steps:- Follow the instructions provided at Install Azure CLI.
- Verify the installation. Open your terminal or command prompt and run:
az --version
After installing and verifying the Azure CLI, follow these steps to sign in, list your subscriptions, and select a subscription:
- Sign in to Azure. Run the following command:
az login
This opens a web browser for you to authenticate your Azure account. After successful authentication, the CLI automatically lists your subscriptions and asks you to select one by number.
-
Select a subscription. After you sign in, a prompt is displayed.
-
Type the number corresponding to the subscription you want to select, and press
Enter
. After you select the subscription, it is set as the default for your current session.
Step 2. Create Azure Cosmos DB resource (MongoDB API).​
Cosmos DB will serve as the database for storing your application data, such as customer information and product details.
Azure portal instructions​
-
Go to the Azure Portal and search for "Cosmos DB".
-
Click on "Create" and select MongoDB API.
-
You will see two options: Request unit (RU) database account and vCore cluster (Recommended). Choose Request unit (RU) database account.
-
Configure the Request Units per second (RU/s) based on your application's scale (e.g., 400 RU/s as a starting point for small applications). The RU/s determines how many operations Cosmos DB can handle per second, so adjust it according to your expected load and usage.
-
Proceed with the rest of the setup, such as specifying the resource group, region, and database name.
-
Once the Cosmos DB account is created, you can add a database and collections to organize your data.
CLI instructions​
- Create a resource group (if you don’t already have one) by running the following command:
az group create --name <resource-group-name> --location <location>
-
Create an Azure Cosmos DB account with MongoDB API.
Use the following command to create an Azure Cosmos DB account with the MongoDB API, and specify throughput in Request Units per second (RU/s):
az cosmosdb create \
--name <cosmos-account-name> \
--resource-group <resource-group-name> \
--kind MongoDB \
--locations regionName=<location> failoverPriority=0 isZoneRedundant=False \
--default-consistency-level Eventual \
--enable-automatic-failover false
-
Create a MongoDB database with a specific throughput.
After creating the Azure Cosmos DB account, create a MongoDB database and set the throughput (RU/s):
az cosmosdb mongodb database create \
--account-name <cosmos-account-name> \
--name <database-name> \
--resource-group <resource-group-name>
Step 3. Create Azure Storage account.​
Our Azure Storage account is used to store any static files (for example, product brochures or images).
Azure portal instructions​
- In the Azure portal, search for storage account and create a new one.
- Choose Blob Storage for storing documents and media.
- Complete the resource creation wizard, and select Create to deploy the storage account.