Lab 2: Using Azure AI Foundry Agent Service¶
Welcome to Lab 2! π¶
In this lab, youβll learn how to build and extend the capabilities of your AI agents using Azure AI Foundry Agent Service.
Info
Azure AI Hub provides a unified interface for managing datasets, models, prompts, and workflows. It streamlines collaboration across teams, ensures compliance and governance, and offers monitoring tools to track the lifecycle of your AI assets from development to production.
Azure Foundry Project is a structured workspace that brings together all the resources, code, and configurations needed to build, train, and deploy AI solutions. It leverages best practices for organizing your AI workloads and integrates seamlessly with Azure AI Hub.
Setting up your environment π§¶
- Complete the steps in Getting Started to set up your environment.
-
In this lab, youβll use Azure AI Foundry Agents to build AI agents. To get started, youβll need to deploy the required resources to your Azure subscription.
-
Open a terminal and navigate to the root of your project.
-
Log in to your Azure account - Run the following command to authenticate with Azure. This command will prompt you to open a browser and enter a device code displayed in your terminal. After successful authentication, return to the terminal to continue.
azd auth login --use-device-code
- Create a new environment called
dev
and set it as the current environment:
azd env new dev azd env select dev
- Set the Azure region for your resources (you can change
australiaeast
to your preferred region):
azd env set AZURE_LOCATION australiaeast
- Deploy the Azure resources using the Infrastructure as Code (IaC) files in the
infra
directory:
azd up
This command will provision all the necessary Azure resources required for this lab. You can browse the resources in the Azure portal once the deployment is complete.
-
-
You will be connecting to these resources when running the code in this lab.
After deployment, copy all environment variables from
.azure/dev/.env
into the.env
file in the root of your code repository.cp .azure/dev/.env .env
-
In this lab, you will make external API calls from your AI agent to a mock service called Contoso Store API which simulates a store's backend operations.
The Contoso Store API is already deployed as part of the Azure resources you set up in the previous step.
For your agent to interact with this API, you need to update the API specification (Swagger file) with the correct endpoint URL:
Let's get started π©βπ»π€¶
Youβre now ready to start building AI agents using Azure AI Foundry Agent Service!
Start your first exercise for this lab here:
π LAB 2.1 : Code First Agent in Azure AI Foundry Agent Service
Happy coding!
Info
The samples uses DefaultAzureCredential
to authenticate with Azure services.
This would check for environment variables, managed identity, or Azure CLI credentials to authenticate.
When running from VS Code, ensure you have the logged-in Azure account by running:
az login --use-device-code