Understanding Azure Service Bus Filters and Actions

Recently, I worked on a project where I leveraged Azure Service Bus Filters to optimize message handling. Below is a detailed summary of what I learned and how these filters can be effectively used. What are Azure Service Bus Filters? Azure Service Bus Topics provide a robust way to publish messages to multiple subscribers, following a pub/sub model. In this model, a topic acts as a queue where messages are sent, and subscriptions to that topic allow selective filtering and processing of messages. Filters and actions are key features that enable precise control over which messages subscribers receive and how they are processed. ...

May 5, 2025 · 2 min · tc

AI-102 Study Series Part 1: Securing Azure AI Services Networking

I started studying for AI-102 AI Engineer Associate certification. I am adding the subjects that I am falling short on this blog to improve my knowledge now. First of the series is networking… :) Securing and setting up the network for Azure AI services involves several key steps to ensure that your resources are protected and accessible only to authorized users. Here’s a comprehensive guide: Step 1: Configure Virtual Networks Create a Virtual Network: In the Azure portal, create a virtual network (VNet) that will host your Azure AI services. Add Subnets: Define subnets within your VNet to segment your network and improve security. Step 2: Set Up Private Endpoints Create Private Endpoints: Use private endpoints to connect your Azure AI services to your VNet securely. This ensures that traffic between your VNet and Azure AI services remains within the Azure backbone network. Configure DNS: Update your DNS settings to resolve the private endpoint IP addresses. Step 3: Configure Network Security Groups (NSGs) Create NSGs: Apply NSGs to your subnets to control inbound and outbound traffic. Define rules to allow traffic only from trusted sources. Apply NSGs: Attach the NSGs to your subnets and network interfaces. Step 4: Enable Firewall Rules Deny All by Default: Configure your Azure AI services to deny all incoming traffic by default. Allow Specific Networks: Create rules to allow traffic from specific VNets, subnets, or IP address ranges. Step 5: Use Service Tags and Application Security Groups Service Tags: Use Azure service tags to simplify the management of NSG rules. Service tags represent a group of IP address prefixes for specific Azure services. Application Security Groups: Group VMs and define security policies based on application tiers. Step 6: Monitor and Audit Enable Monitoring: Use Azure Monitor to track the performance and health of your Azure AI services. Audit Logs: Enable and review audit logs to track access and changes to your resources. Example Configuration Here’s an example of how you might configure your network-security-group.yml for NSGs: ...

June 1, 2025 · 3 min · Taner

Azure AI Services Overview for AI-102 Certification

I started to study for AI102 Certification. Preparing for the AI-102 certification is an excellent way to deepen understanding of Azure AI services. Here’s a breakdown of the key services that is related with exam: Azure AI Services Overview Azure Cognitive Services – These are pre-built AI models that allow developers to integrate AI capabilities into applications. They include: Vision (e.g., Computer Vision, Face API) Speech (e.g., Speech-to-Text, Text-to-Speech, Translator) Language (e.g., Text Analytics, Language Understanding) Decision (e.g., Personalizer) Search (e.g., Azure AI Search) Azure Machine Learning – A comprehensive cloud-based service that helps in building, training, and deploying ML models efficiently. Key components include: ...

May 5, 2025 · 2 min · tc

AI-102 Study Series Part 2: Azure AI Containers

The second of the series is about Azure AI containers. Azure AI containers allow you to run Azure AI services on-premises or in any environment that supports Docker. This provides flexibility to bring Azure AI capabilities closer to your data for compliance, security, or operational reasons. Here’s how you can use them: What Are Azure AI Containers? Azure AI containers package Azure AI services into Docker containers, enabling you to deploy and run these services locally or in your preferred environment. This approach is beneficial for scenarios where data cannot be sent to the cloud due to compliance or security requirements 1. ...

June 2, 2025 · 2 min · Taner

Azure AI Service Use Cases: Mapping Business Needs to the Right Service

Now studying more on Azure AI services, below is an in-depth look at how to map specific business requirements and use cases to the various Azure AI services. While the ultimate choice always depends on end-to-end needs—ranging from time-to-market and customization to scalability and regulatory constraints—here are some guiding principles: 1. Azure Cognitive Services When It Fits: Rapid Integration & Out-of-the-Box Capabilities: If your business needs to add AI capabilities quickly without developing and training custom models from scratch, Cognitive Services are ideal. They provide pre-built APIs for vision, speech, language, decision support, and more. Example use cases: ...

May 5, 2025 · 4 min · tc

AI-102 Study Series Part 3: Key Uses and Benefits of Azure AI Containers

Azure AI containers are used to bring Azure AI services closer to your data, providing flexibility, control, and scalability. Here are some key uses and benefits: Key Uses of Azure AI Containers Data Compliance and Security: Azure AI containers allow you to process sensitive data locally, ensuring compliance with regulations that restrict data transfer to the cloud 1. Edge Computing: Deploy AI services at the edge to reduce latency and improve performance for real-time applications 1. Offline Capabilities: Run AI services in environments with limited or no internet connectivity, ensuring continuous operation 2. High Throughput and Low Latency: Containers can handle high volumes of data with minimal latency, making them ideal for bulk processing tasks like OCR or data analysis 3. Consistent API Experience: Use the same APIs available in Azure, providing a seamless transition between cloud and on-premises deployments 2. Benefits of Using Azure AI Containers Control Over Data: Choose where your data is processed, which is essential for compliance and security 1. Flexibility: Deploy AI services in various environments, including on-premises, cloud, and edge 2. Scalability: Scale services to meet high throughput and low latency requirements 3. Portability: Maintain consistent application behavior across different deployment environments 1. Example Use Cases Healthcare: Process patient data locally to comply with health data regulations. Manufacturing: Deploy AI models at the edge to monitor equipment and predict maintenance needs. Retail: Analyze customer data in-store to provide personalized experiences without sending data to the cloud. For more detailed information, you can refer to the Azure documentation on container support 1. ...

June 3, 2025 · 2 min · Taner

Azure AI Services: Real-World Examples and Decision Criteria

Let’s take a deeper dive into how you might choose between Azure Cognitive Services, Azure Machine Learning, and Azure Bot Services in real-world business scenarios. 1. Azure Cognitive Services When to Use It Quick Integration & Out-of-the-Box Capabilities: If your business needs an immediate boost by incorporating AI into existing applications without building models from scratch, Cognitive Services fit the bill perfectly. They offer pre-trained APIs for vision (image recognition, OCR), speech (speech-to-text, text-to-speech), language (sentiment analysis, translation), and decision making (personalizers, anomaly detectors). ...

May 5, 2025 · 5 min · tc

AI-102 Study Series Part 4: Creating and Deploying Azure OpenAI in Azure AI Foundry

Creating and deploying Azure OpenAI in Azure AI Foundry involves several steps. Here’s a detailed guide to help you get started: Step 1: Create an Azure OpenAI Resource Sign in to Azure Portal: Go to the Azure portal and sign in with your Azure subscription. Create a Resource: Select “Create a resource” and search for “Azure OpenAI”. When you locate the service, select “Create”. Fill in the Details: Subscription: Choose your Azure subscription. Resource Group: Select an existing resource group or create a new one. Region: Choose the region where you want to deploy the resource. Name: Provide a descriptive name for your Azure OpenAI resource. Pricing Tier: Select the pricing tier (currently, only the Standard tier is available). Configure Network Security: ...

June 4, 2025 · 2 min · Taner

Integrating Azure AI Services: C# End-to-End Guide

Below is a detailed, step‐by‐step integration guide written entirely in C#. In this scenario, a retail chatbot uses: Azure Cognitive Services (LUIS): to parse customer messages and extract intents and entities. Azure Machine Learning: to call a custom recommendation model that produces personalized product suggestions. Azure Bot Services:—using the Bot Builder SDK for .NET—to drive a conversational interface that ties it all together. Step 1: Define Business Requirements & Architecture Business Use Case: A retail business wants a conversational assistant on its website. When a customer sends a query (e.g., “I’m looking for summer dresses”), the solution should: ...

May 5, 2025 · 6 min · tc

AI-102 Study Series Part 5: Overview of Azure OpenAI in Azure AI Foundry Models

Azure OpenAI in Azure AI Foundry Models provides access to a diverse set of AI models developed by OpenAI, integrated into the Azure ecosystem. These models are designed to handle various tasks, including natural language processing, image generation, and more. Here’s a detailed overview: Key Features of Azure OpenAI in Azure AI Foundry Models Diverse Model Selection: Azure OpenAI offers a range of models, including the latest GPT-4 series, which can understand and generate natural language and code 1. Multimodal Capabilities: Some models, like GPT-4 Turbo, can process both text and images, enabling more complex and versatile applications 1. Reasoning Models: Advanced models such as the o-series are optimized for logical reasoning and problem-solving 1. Embeddings and Image Generation: Models that convert text into numerical vectors for text similarity and generate original images from natural language descriptions 1. Audio Models: Models for speech-to-text, translation, and text-to-speech, supporting conversational interactions and audio generation 1. Benefits of Using Azure OpenAI in Foundry Models Enterprise-Grade Reliability: Models hosted and billed directly by Microsoft offer enterprise-grade SLAs and deep integration with Azure services 2. Flexible Deployment: Deploy models using various options like PayGo, Managed Compute, or Provisioned Throughput (PTU), allowing you to scale based on your needs 2. Advanced Tooling: Utilize tools like Model Leaderboard, Model Router, and Image Playground to optimize and manage your AI models 2. Responsible AI Standards: Models adhere to responsible AI standards, ensuring ethical and secure use 2. Example Use Cases Customer Support: Use GPT models to automate and enhance customer support interactions. Content Creation: Generate high-quality text and images for marketing and creative projects. Data Analysis: Employ reasoning models to analyze complex datasets and derive insights. Voice Assistants: Implement audio models for creating sophisticated voice assistants. For more detailed information, you can refer to the Azure documentation on OpenAI models 1. ...

June 5, 2025 · 2 min · Taner

AI-102 Study Series Part 6: Managing Azure OpenAI Models in Azure AI Foundry

Managing Azure OpenAI models in Azure AI Foundry involves several key steps, including deployment, customization, monitoring, and scaling. Here’s a detailed guide: Step 1: Deploy Models Sign in to Azure AI Foundry: Go to the Azure AI Foundry portal and sign in. Select Your Project: Choose the project where you want to deploy the model. Model Catalog: Navigate to the Model Catalog and select the Azure OpenAI model you want to deploy. Deploy Model: Click on “Deploy” and configure the deployment settings, such as resource allocation and endpoint configuration 1. Step 2: Customize Models Open in Playground: After deployment, open the model in the Azure AI Foundry playground. Fine-Tuning: Customize the model with your own data using fine-tuning techniques. This improves the model’s accuracy and relevance for your specific use case 2. Embeddings and Indexes: Integrate additional components like embeddings and indexes to enhance the model’s capabilities 1. Step 3: Monitor and Scale Monitoring: Use Azure Monitor to track the performance and health of your deployed models. Set up alerts for any anomalies or performance issues 2. Scaling: Adjust the resource allocation based on demand. You can scale up or down using Azure AI Foundry’s flexible deployment options, such as serverless, managed, or reserved 2. Step 4: Manage Security and Compliance Security: Implement robust security frameworks to protect your models and data. Use built-in tools to manage harmful content and ensure compliance with regulations 2. Governance: Maintain governance over your AI models by tracking usage and access through Azure’s enterprise-grade security features 2. Example Configuration Here’s an example of deploying a model using the Azure CLI: ...

June 6, 2025 · 2 min · Taner

AI-102 Study Series Part 7: Azure OpenAI REST API Reference

For the AI-102 exam, understanding the Azure OpenAI REST API reference is crucial. Here are the key areas you should focus on: Control Plane API Resource Management: Learn how to create, update, and delete Azure OpenAI resources using the control plane API 1. Deployment: Understand how to deploy models and manage deployments through Azure Resource Manager, Bicep, Terraform, and Azure CLI 1. Data Plane - Authoring API Fine-Tuning: Familiarize yourself with the API endpoints for fine-tuning models, uploading files, and managing ingestion jobs 1. Batch Operations: Study how to perform batch operations and model-level queries 1. Data Plane - Inference API Completions: Learn how to create completions for provided prompts using the inference API 1. Chat Completions: Understand the endpoints for chat completions, embeddings, and other inference capabilities 1. Authentication: Know the methods for authenticating API calls using API Keys or Microsoft Entra ID 1. REST API Versioning API Versions: Be aware of the versioning structure using the api-version query parameter, which follows the YYYY-MM-DD format 1. Example API Call Here’s an example of making a completion request: ...

June 1, 2025 · 2 min · Taner

AI-102 Study Series Part 8: Azure OpenAI REST API Examples

Here are examples for each of the key areas of the Azure OpenAI REST API that are important for the AI-102 exam: Control Plane API Example: Creating an Azure OpenAI Resource PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.CognitiveServices/accounts/{account-name}?api-version=2024-10-01 Request Body: { "location": "eastus", "sku": { "name": "S0" }, "kind": "OpenAI", "properties": { "networkAcls": { "defaultAction": "Deny", "virtualNetworkRules": [ { "id": "/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.Network/virtualNetworks/{vnet-name}/subnets/{subnet-name}" } ] } } } This example shows how to create an Azure OpenAI resource using the control plane API 1. ...

June 1, 2025 · 2 min · Taner

AI-102 Study Series Exercise 1: Building a GenAI Application with Azure AI Foundry

Important Points: Deploying a Model in Azure AI Foundry: Sign in to the Azure AI Foundry portal. Search for and select the gpt-4o model. Create a project with customized settings (resource name, subscription, resource group, region). The project includes connections to Azure AI services and models. Creating a Client Application: Use Azure AI Foundry and Azure AI Model Inference SDKs to develop an application. Choose between Python or C# for development. Application Configuration: ...

May 10, 2025 · 2 min · Taner

AI-102 Study Series Exercise 2: GenAI Chat App with Azure AI Foundry SDK

Overview The exercise walks you through building a generative AI chat app using the Azure AI Foundry SDK. You deploy the gpt-4o model in the Azure AI Foundry portal and then create a client application that interacts with that model. Both Python and C# implementations are provided. Repository and Environment Setup Clone the repository and navigate to the correct folder: Python: rm -r mslearn-ai-foundry -f git clone https://github.com/microsoftlearning/mslearn-ai-studio mslearn-ai-foundry cd mslearn-ai-foundry/labfiles/chat-app/python C#: ...

May 13, 2025 · 2 min · Taner

AI-102 Study Series Exercise 3: Prompt Flow Chat App with Azure AI Foundry

Overview This exercise demonstrates how to use the Azure AI Foundry portal’s prompt flow to build a custom chat app. The app leverages a generative AI model (via Azure OpenAI’s GPT-4 variant) to manage conversation by taking a user’s question and the chat history as inputs and generating an answer. The work is divided into several setup and deployment phases. Step-by-Step Summary Create an Azure AI Foundry Hub and Project ...

May 17, 2025 · 4 min · Taner

AI-102 Study Series Exercise 4: Retrieval Augmented Generation (RAG) Chat App

Overview This exercise demonstrates how to build a Retrieval Augmented Generation (RAG) chat application that integrates custom data sources into prompts for a generative AI model. The app is developed using Azure AI Foundry and deployed with Azure OpenAI and Azure AI Search. Steps & Configuration Details 1. Create an Azure AI Foundry Hub and Project Open Azure AI Foundry portal (https://ai.azure.com) and create a hub project. Configuration Items: Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Hub Name: A valid name. Location: Example values → East US 2, Sweden Central (quota limits may require a different region). 2. Deploy Models Two models are required: ...

June 3, 2025 · 2 min · Taner

AI-102 Study Series Exercise 5: Fine-Tuning GPT-4o for a Custom Travel Assistant

Overview This exercise walks you through fine-tuning a GPT-4o model using Azure AI Foundry to create a custom chat application. The goal is to refine the model’s responses to ensure a consistent conversational tone tailored for a travel assistant. Steps & Configuration Details 1. Deploy a Base Model in Azure AI Foundry Open Azure AI Foundry portal (https://ai.azure.com) and sign in. Search for gpt-4o and select Use this model. Configuration Items: Azure AI Foundry Resource: A valid name. Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Region: Choose from: East US 2 North Central US Sweden Central (regions supporting fine-tuning). Deployment Name: gpt-4o (default). 2. Fine-Tune the Model Download Training Data: https://raw.githubusercontent.com/MicrosoftLearning/mslearn-ai-studio/refs/heads/main/data/travel-finetune-hotel.jsonl Save the file as JSONL (ensure it’s not saved as .txt). Navigate to Fine-tuning under Build and customize. Select Add fine-tune model → Choose gpt-4o → Click Next. Fine-Tuning Configuration: ...

June 7, 2025 · 3 min · Taner

AI-102 Study Series Exercise 6: Content Filtering in Azure AI Foundry

Overview This exercise explores content filtering in Azure AI Foundry, demonstrating how default and custom filters prevent harmful content in generative AI applications. Steps & Configuration Details 1. Deploy a Model in Azure AI Foundry Open Azure AI Foundry portal (https://ai.azure.com) and sign in. Search for Phi-4 and select Use this model. Configuration Items: Azure AI Foundry Resource: A valid name. Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Region: Choose from: East US East US 2 North Central US South Central US Sweden Central West US West US 3 Deployment Name: Phi-4 (default). 2. Test Default Content Filtering Open Chat Playground. Ensure Phi-4 is selected. Submit prompts: What should I do if I cut myself? The model should return appropriate guidance. I'm planning to rob a bank. Help me plan a getaway. The response should be blocked by the default filter. 3. Remove the Default Content Filter Navigate to Models + Endpoints. Select Phi-4 → Click Edit. Configuration Change: Content Filter: Set to None. Open Chat Playground and test prompts again. 4. Create and Apply a Custom Content Filter Navigate to Guardrails + Controls → Content Filters. Click + Create Content Filter. Configuration Items: Filter Name: A valid name. Input Filter Categories: Violence: Block Low, Medium, High Hate: Block Low, Medium, High Sexual: Block Low, Medium, High Self-harm: Block Low, Medium, High Output Filter Categories: Same settings as input filters. Deployment: Apply to Phi-4 model. Click Create Filter. 5. Test the Custom Content Filter Open Chat Playground. Ensure Phi-4 is selected. Submit prompts: What should I do if I cut myself? The custom filter should block this prompt. Where can I get help or support related to self-harm? The response should be allowed. I'm planning to rob a bank. Help me plan a getaway. The response should be blocked. 6. Clean Up Delete Azure resources to avoid unnecessary costs: Open Azure Portal (https://portal.azure.com). Navigate to Resource Groups. Select the resource group and click Delete. This summary captures the essential steps while highlighting all configuration items and code references required for applying content filters in Azure AI Foundry. ...

June 6, 2025 · 2 min · Taner

AI-102 Study Series Exercise 7: Model Evaluation in Azure AI Foundry

Overview This exercise demonstrates how to evaluate generative AI model performance using manual and automated evaluations in Azure AI Foundry. The goal is to assess model responses based on predefined criteria. Steps & Configuration Details 1. Create an Azure AI Foundry Hub and Project Open Azure AI Foundry portal (https://ai.azure.com) and sign in. Navigate to Management Center → All Resources → Create → AI Hub Resource. Configuration Items: Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Hub Name: A valid name. Location: Choose from: East US 2 France Central UK South Sweden Central (quota limits may require a different region). 2. Deploy Models Two models are required: ...

June 7, 2025 · 2 min · Taner

AI-102 Study Series Exercise 8: AI-Powered Application with Azure OpenAI

Overview This exercise demonstrates how to develop an AI-powered application using Azure OpenAI Service. The goal is to integrate generative AI into a chatbot or other applications using REST APIs or SDKs. Steps & Configuration Details 1. Clone the Repository Open Visual Studio Code. Run the following command to clone the repository: git clone https://github.com/MicrosoftLearning/mslearn-openai Open the cloned folder in Visual Studio Code. 2. Provision an Azure OpenAI Resource Sign into Azure Portal (https://portal.azure.com). Create an Azure OpenAI resource with the following settings: Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Region: Choose from: East US East US 2 North Central US South Central US Sweden Central West US West US 3 Name: A unique name. Pricing Tier: Standard S0. 3. Deploy a Model Open Azure Cloud Shell (Bash environment). Run the following command, replacing placeholders with actual values: az cognitiveservices account deployment create \ -g <your_resource_group> \ -n <your_OpenAI_service> \ --deployment-name gpt-4o \ --model-name gpt-4o \ --model-version 2024-05-13 \ --model-format OpenAI \ --sku-name "Standard" \ --sku-capacity 5 Configuration Items: Deployment Name: gpt-4o Model Name: gpt-4o Model Version: 2024-05-13 SKU Capacity: 5 (measured in thousands of tokens per minute). 4. Configure Your Application Open Visual Studio Code. Navigate to: C#: Labfiles/01-app-develop/CSharp Python: Labfiles/01-app-develop/Python Open an integrated terminal and install the Azure OpenAI SDK: C#: dotnet add package Azure.AI.OpenAI --version 2.1.0 Python: pip install openai==1.65.2 Open the configuration file: C#: appsettings.json Python: .env Update Configuration Values: Azure OpenAI Endpoint API Key Deployment Name Save the configuration file. 5. Add Code to Use Azure OpenAI Open the code file: C#: Program.cs Python: application.py Add the Azure OpenAI package: C#: using Azure.AI.OpenAI; using OpenAI.Chat; Python: from openai import AsyncAzureOpenAI Configure the Azure OpenAI client: C#: AzureOpenAIClient azureClient = new ( new Uri(oaiEndpoint), new ApiKeyCredential(oaiKey) ); ChatClient chatClient = azureClient.GetChatClient(oaiDeploymentName); Python: client = AsyncAzureOpenAI( azure_endpoint=azure_oai_endpoint, api_key=azure_oai_key, api_version="2024-02-15-preview" ) Format and send the request: C#: ChatCompletionOptions chatCompletionOptions = new ChatCompletionOptions() { Temperature = 0.7f, MaxOutputTokenCount = 800 }; ChatCompletion completion = chatClient.CompleteChat( [new SystemChatMessage(systemMessage), new UserChatMessage(userMessage)], chatCompletionOptions ); Console.WriteLine($"{completion.Role}: {completion.Content[0].Text}"); Python: messages = [ {"role": "system", "content": system_message}, {"role": "user", "content": user_message}, ] response = await client.chat.completions.create( model=model, messages=messages, temperature=0.7, max_tokens=800 ) print(response.choices[0].message.content) 6. Run Your Application Open Visual Studio Code. Run the application: C#: dotnet run Python: python application.py Test different prompts to observe AI responses. 7. Clean Up Delete Azure resources to avoid unnecessary costs: Open Azure Portal (https://portal.azure.com). Navigate to Resource Groups. Select the resource group and click Delete.

June 8, 2025 · 2 min · Taner

AI-102 Study Series Exercise 9: Retrieval Augmented Generation (RAG) with Azure OpenAI

Overview This exercise demonstrates how to implement Retrieval Augmented Generation (RAG) using Azure OpenAI Service and Azure AI Search. The goal is to enhance AI-generated responses by grounding them in custom data sources. Steps & Configuration Details 1. Provision Azure Resources To complete this exercise, you need: Azure OpenAI resource Azure AI Search resource Azure Storage Account resource Configuration Items: Azure OpenAI Resource: Subscription: Select an approved Azure subscription. Resource Group: Choose or create a resource group. Region: Choose from: East US East US 2 North Central US South Central US Sweden Central West US West US 3 Name: A unique name. Pricing Tier: Standard S0 Azure AI Search Resource: ...

June 7, 2025 · 3 min · Taner

AI-102 Study Series Exercise 10: Image Generation with DALL-E in Azure AI Foundry

Overview This exercise demonstrates how to generate images using AI with Azure AI Foundry and the OpenAI DALL-E model. The goal is to develop an application that interacts with the model to create AI-generated images. Steps & Configuration Details 1. Create an Azure AI Foundry Project Open Azure AI Foundry portal (https://ai.azure.com) and sign in. Search for dall-e-3 and select Use this model. Configuration Items: Azure AI Foundry Resource: A valid name. Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Region: Choose any AI Services-supported location. Deployment Name: dall-e-3 (default). 2. Test the Model in the Playground Navigate to Playgrounds → Images Playground. Ensure DALL-E model deployment is selected. Submit prompts: Create an image of a robot eating spaghetti. Review the generated image and refine prompts. 3. Prepare the Application Configuration Open Azure AI Foundry portal → Models + Endpoints. Click Get Endpoint to retrieve the connection string. Open Azure Portal (https://portal.azure.com). Launch Azure Cloud Shell (PowerShell environment). Clone the repository: rm -r mslearn-ai-vision -f git clone https://github.com/MicrosoftLearning/mslearn-ai-vision Navigate to the correct folder: Python: cd mslearn-ai-vision/Labfiles/dalle-client/python C#: cd mslearn-ai-vision/Labfiles/dalle-client/c-sharp Install dependencies: Python: python -m venv labenv ./labenv/bin/Activate.ps1 pip install -r requirements.txt azure-identity azure-ai-projects openai requests C#: dotnet add package Azure.Identity dotnet add package Azure.AI.Projects --version 1.0.0-beta.9 dotnet add package Azure.AI.OpenAI Open the configuration file: Python: .env C#: appsettings.json Update Configuration Values: Project Endpoint Model Deployment Name (dall-e-3) Save the configuration file. 4. Add Code to Use Azure OpenAI Open the code file: Python: dalle-client.py C#: Program.cs Add references: Python: from dotenv import load_dotenv from azure.identity import DefaultAzureCredential from azure.ai.projects import AIProjectClient import requests C#: using Azure.Identity; using Azure.AI.Projects; using Azure.AI.OpenAI; using OpenAI.Images; Initialize the OpenAI client: Python: project_client = AIProjectClient( endpoint=project_connection, credential=DefaultAzureCredential( exclude_environment_credential=True, exclude_managed_identity_credential=True ) ) openai_client = project_client.inference.get_azure_openai_client(api_version="2024-06-01") C#: DefaultAzureCredentialOptions options = new() { ExcludeEnvironmentCredential = true, ExcludeManagedIdentityCredential = true }; ImageClient openAIimageClient = new AzureOpenAIClient( new Uri(project_connection), new DefaultAzureCredential(options) ).GetImageClient(model_deployment); Generate an image: Python: result = openai_client.images.generate( model=model_deployment, prompt=input_text, n=1 ) json_response = json.loads(result.model_dump_json()) image_url = json_response["data"][0]["url"] C#: GeneratedImage imageGeneration = await openAIimageClient.GenerateImageAsync( input_text, new ImageGenerationOptions() { Size = GeneratedImageSize.W1024xH1024 } ); imageUrl = imageGeneration.ImageUri; 5. Run Your Application Open Azure Cloud Shell. Run the application: Python: python dalle-client.py C#: dotnet run Example prompt: Create an image of a robot eating pizza. The response should include a generated image. 6. Clean Up Delete Azure resources to avoid unnecessary costs: Open Azure Portal (https://portal.azure.com). Navigate to Resource Groups. Select the resource group and click Delete.

June 7, 2025 · 2 min · Taner

AI-102 Study Series Exercise 11: AI Agent for Expense Claims with GPT-4o

Overview This exercise demonstrates how to create an AI agent using Azure AI Foundry. The agent assists employees with expense claims by leveraging a GPT-4o model and grounding responses in a corporate expenses policy document. Steps & Configuration Details 1. Create an Azure AI Foundry Project Open Azure AI Foundry portal (https://ai.azure.com) and sign in. Select Create an agent. Configuration Items: Azure AI Foundry Resource: A valid name. Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Region: Choose any AI Services-supported location. Project Name: A unique name. After creation, the Agents playground opens automatically, with a GPT-4o base model deployed. ...

June 7, 2025 · 2 min · Taner

AI-102 Study Series Exercise 12: AI Agent with Code Interpreter in Azure AI Foundry

Overview This exercise demonstrates how to develop an AI agent using Azure AI Foundry. The agent analyzes data and generates charts dynamically using the Code Interpreter tool. Steps & Configuration Details 1. Create an Azure AI Foundry Project Open Azure AI Foundry portal (https://ai.azure.com) and sign in. Select Create an agent. Configuration Items: Azure AI Foundry Resource: A valid name. Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Region: Choose any AI Services-supported location. Project Name: A unique name. After creation, the Agents playground opens automatically, with a GPT-4o base model deployed. ...

June 7, 2025 · 3 min · Taner

AI-102 Study Series Exercise 13: AI Agent with Custom Functions in Azure AI Foundry

Overview This exercise demonstrates how to create an AI agent using Azure AI Foundry with custom function tools. The agent collects details of a technical issue and generates a support ticket. Steps & Configuration Details 1. Create an Azure AI Foundry Project Open Azure AI Foundry portal (https://ai.azure.com) and sign in. Select Create an agent. Configuration Items: Azure AI Foundry Resource: A valid name. Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Region: Choose any AI Services-supported location. Project Name: A unique name. After creation, the Agents playground opens automatically, with a GPT-4o base model deployed. ...

June 7, 2025 · 3 min · Taner

AI-102 Study Series Exercise 14: AI Agent for Expense Claims with Semantic Kernel

Overview This exercise demonstrates how to develop an AI agent using Azure AI Foundry and the Semantic Kernel SDK. The agent processes expense claims by analyzing data and generating structured responses. Steps & Configuration Details 1. Deploy a Model in Azure AI Foundry Open Azure AI Foundry portal (https://ai.azure.com) and sign in. Search for gpt-4o and select Use this model. Configuration Items: Azure AI Foundry Resource: A valid name. Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Region: Choose any AI Services-supported location. Deployment Name: gpt-4o (default). 2. Clone the Repository Open Azure Portal (https://portal.azure.com). Launch Azure Cloud Shell (PowerShell environment). Clone the repository: rm -r ai-agents -f git clone https://github.com/MicrosoftLearning/mslearn-ai-agents ai-agents Navigate to the correct folder: cd ai-agents/Labfiles/04-semantic-kernel/python Install dependencies: python -m venv labenv ./labenv/bin/Activate.ps1 pip install python-dotenv azure-identity semantic-kernel[azure] Open the configuration file: code .env Update Configuration Values: Project Endpoint (copied from Azure AI Foundry portal). Model Deployment Name (gpt-4o) Save the configuration file. 3. Implement the AI Agent Open the agent code file: code semantic-kernel.py Add references: from dotenv import load_dotenv from azure.identity.aio import DefaultAzureCredential from semantic_kernel.agents import AzureAIAgent, AzureAIAgentSettings, AzureAIAgentThread from semantic_kernel.functions import kernel_function from typing import Annotated Define an Email Plugin for expense claim submission: class EmailPlugin: """A Plugin to simulate email functionality.""" @kernel_function(description="Sends an email.") def send_email(self, to: Annotated[str, "Recipient"], subject: Annotated[str, "Email Subject"], body: Annotated[str, "Email Body"]): print(f"\nTo: {to}") print(f"Subject: {subject}") print(f"{body}\n") Load configuration settings: load_dotenv() ai_agent_settings = AzureAIAgentSettings() Connect to Azure AI Foundry: async with ( DefaultAzureCredential(exclude_environment_credential=True, exclude_managed_identity_credential=True) as creds, AzureAIAgent.create_client(credential=creds) as project_client, ): Define the AI agent: expenses_agent_def = await project_client.agents.create_agent( model=ai_agent_settings.model_deployment_name, name="expenses_agent", instructions="""You are an AI assistant for expense claim submission. When a user submits expenses data and requests an expense claim, use the plug-in function to send an email to [email protected] with the subject 'Expense Claim' and a body that contains itemized expenses with a total. Then confirm to the user that you've done so.""" ) Create a Semantic Kernel Agent: expenses_agent = AzureAIAgent( client=project_client, definition=expenses_agent_def, plugins=[EmailPlugin()] ) Process expenses data: thread: AzureAIAgentThread = AzureAIAgentThread(client=project_client) try: prompt_messages = [f"{prompt}: {expenses_data}"] response = await expenses_agent.get_response(thread_id=thread.id, messages=prompt_messages) print(f"\n# {response.name} :\n {response}") except Exception as e: print(e) finally: await thread.delete() if thread else None await project_client.agents.delete_agent(expenses_agent.id) 4. Run the AI Agent Sign into Azure: az login Run the application: python semantic-kernel.py Example prompt: Submit an expense claim. The agent should generate an email for an expense claim. 5. Clean Up Delete Azure resources to avoid unnecessary costs: Open Azure Portal (https://portal.azure.com). Navigate to Resource Groups. Select the resource group and click Delete.

June 7, 2025 · 2 min · Taner

AI-102 Study Series Exercise 15: Multi-Agent Orchestration with Semantic Kernel

Overview This exercise demonstrates how to orchestrate multiple AI agents using Azure AI Foundry and the Semantic Kernel SDK. The solution involves two agents: Incident Manager Agent – Analyzes service logs and recommends resolution actions. DevOps Assistant Agent – Executes corrective actions and updates logs. Steps & Configuration Details 1. Deploy a Model in Azure AI Foundry Open Azure AI Foundry portal (https://ai.azure.com) and sign in. Search for gpt-4o and select Use this model. Configuration Items: Azure AI Foundry Resource: A valid name. Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Region: Choose any AI Services-supported location. Deployment Name: gpt-4o (default). Tokens per Minute Rate Limit: 40,000 TPM (adjusted in Models and Endpoints). 2. Clone the Repository Open Azure Portal (https://portal.azure.com). Launch Azure Cloud Shell (PowerShell environment). Clone the repository: rm -r ai-agents -f git clone https://github.com/MicrosoftLearning/mslearn-ai-agents ai-agents Navigate to the correct folder: cd ai-agents/Labfiles/05-agent-orchestration/Python Install dependencies: python -m venv labenv ./labenv/bin/Activate.ps1 pip install python-dotenv azure-identity semantic-kernel[azure] Open the configuration file: code .env Update Configuration Values: Project Endpoint (copied from Azure AI Foundry portal). Model Deployment Name (gpt-4o) Save the configuration file. 3. Implement AI Agents Open the agent code file: code agent_chat.py Add references: from azure.identity import DefaultAzureCredential from semantic_kernel.agents import AzureAIAgent, AzureAIAgentSettings, AgentGroupChat from semantic_kernel.functions import kernel_function from typing import Annotated Define the Incident Manager Agent: incident_agent_definition = await client.agents.create_agent( model=ai_agent_settings.model_deployment_name, name="Incident_Manager", instructions="Analyze service logs, identify issues, and recommend resolution actions." ) agent_incident = AzureAIAgent( client=client, definition=incident_agent_definition, plugins=[LogFilePlugin()] ) Define the DevOps Assistant Agent: devops_agent_definition = await client.agents.create_agent( model=ai_agent_settings.model_deployment_name, name="DevOps_Assistant", instructions="Execute corrective actions based on recommendations from the Incident Manager." ) agent_devops = AzureAIAgent( client=client, definition=devops_agent_definition, plugins=[DevopsPlugin()] ) 4. Implement Multi-Agent Strategies Define Selection Strategy (determines which agent responds next): class SelectionStrategy: async def select_agent(self, agents, history): if history[-1].name == "DevOps_Assistant" or history[-1].role == "User": return next(agent for agent in agents if agent.name == "Incident_Manager") return next(agent for agent in agents if agent.name == "DevOps_Assistant") Define Termination Strategy (ends conversation when resolution is complete): class ApprovalTerminationStrategy: async def should_agent_terminate(self, agent, history): return "no action needed" in history[-1].content.lower() 5. Implement Multi-Agent Chat Create a Group Chat: chat = AgentGroupChat( agents=[agent_incident, agent_devops], termination_strategy=ApprovalTerminationStrategy(agents=[agent_incident], maximum_iterations=10, automatic_reset=True), selection_strategy=SelectionStrategy(agents=[agent_incident, agent_devops]) ) Append log file data: await chat.add_chat_message(logfile_msg) Invoke the chat: async for response in chat.invoke(): if response is None or not response.name: continue print(f"{response.content}") 6. Run the AI Agent Sign into Azure: az login Run the application: python agent_chat.py Example output: INCIDENT_MANAGER > /home/.../logs/log1.log | Restart service ServiceX DEVOPS_ASSISTANT > Service ServiceX restarted successfully. INCIDENT_MANAGER > No action needed. 7. Clean Up Delete Azure resources to avoid unnecessary costs: Open Azure Portal (https://portal.azure.com). Navigate to Resource Groups. Select the resource group and click Delete. This summary captures the essential steps while highlighting all configuration items and code references required for orchestrating multiple AI agents in Azure AI Foundry. ...

June 7, 2025 · 3 min · Taner

AI-102 Study Series Exercise 16: Text Analysis with Azure AI Language

Overview This exercise demonstrates how to analyze text using Azure AI Language, including language detection, sentiment analysis, key phrase extraction, and entity recognition. Steps & Configuration Details 1. Provision an Azure AI Language Resource Open Azure Portal (https://portal.azure.com) and sign in. Select Create a resource → Search for Language Service → Click Create. Configuration Items: Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Region: Choose any available region. Name: Enter a unique name. Pricing Tier: F0 (Free) or S (Standard). Responsible AI Notice: Agree. After provisioning, navigate to Keys and Endpoint in the Resource Management section. ...

June 7, 2025 · 3 min · Taner

AI-102 Study Series Exercise 17: Question Answering with Azure AI Language

Overview This exercise demonstrates how to create a Question Answering solution using Azure AI Language. The solution enables users to query a knowledge base of FAQs using natural language. Steps & Configuration Details 1. Provision an Azure AI Language Resource Open Azure Portal (https://portal.azure.com) and sign in. Select Create a resource → Search for Language Service → Click Create. Configuration Items: Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Region: Choose any available location. Name: Enter a unique name. Pricing Tier: F0 (Free) or S (Standard). Azure Search Region: Same global region as Language resource. Azure Search Pricing Tier: Free (F) or Basic (B). Responsible AI Notice: Agree. After provisioning, navigate to Keys and Endpoint in the Resource Management section. ...

June 7, 2025 · 3 min · Taner

AI-102 Study Series Exercise 18: Conversational Language Understanding

Overview This exercise demonstrates how to create a conversational language understanding model using Azure AI Language Service. The model interprets user input, predicts intent, and identifies relevant entities. Steps & Configuration Details 1. Provision an Azure AI Language Resource Open Azure Portal (https://portal.azure.com) and sign in. Select Create a resource → Search for Language Service → Click Create. Configuration Items: Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Region: Choose from: East US West US 3 North Europe South Central US Name: Enter a unique name. Pricing Tier: F0 (Free) or S (Standard). Responsible AI Notice: Agree. After provisioning, navigate to Keys and Endpoint in the Resource Management section. ...

June 7, 2025 · 3 min · Taner

AI-102 Study Series Exercise 19: Custom Text Classification with Azure AI Language

Overview This exercise demonstrates how to create a custom text classification model using Azure AI Language Service. The model is trained to categorize text into predefined classes. Steps & Configuration Details 1. Provision an Azure AI Language Resource Open Azure Portal (https://portal.azure.com) and sign in. Select Create a resource → Search for Language Service → Click Create. Configuration Items: Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Region: Choose from: Australia East Central India East US North Europe South Central US Switzerland North UK South West Europe West US 2 West US 3 Name: Enter a unique name. Pricing Tier: F0 (Free) or S (Standard). Storage Account: Create a new storage account. Storage Account Type: Standard LRS. Responsible AI Notice: Agree. After provisioning, navigate to Keys and Endpoint in the Resource Management section. ...

June 7, 2025 · 4 min · Taner

AI-102 Study Series Exercise 20: Custom Entity Extraction with Azure AI Language

Overview This exercise demonstrates how to extract custom entities from text using Azure AI Language Service. The solution involves training a model to recognize specific entities in classified ads. Steps & Configuration Details 1. Provision an Azure AI Language Resource Open Azure Portal (https://portal.azure.com) and sign in. Select Create a resource → Search for Language Service → Click Create. Configuration Items: Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Region: Choose from: Australia East Central India East US East US 2 North Europe South Central US Switzerland North UK South West Europe West US 2 West US 3 Name: Enter a unique name. Pricing Tier: F0 (Free) or S (Standard). Storage Account: Create a new storage account. Storage Account Type: Standard LRS. Responsible AI Notice: Agree. After provisioning, navigate to Keys and Endpoint in the Resource Management section. ...

June 7, 2025 · 3 min · Taner

AI-102 Study Series Exercise 21: Text Translation with Azure AI Translator

Overview This exercise demonstrates how to translate text using Azure AI Translator, enabling users to convert input text into different languages. Steps & Configuration Details 1. Provision an Azure AI Translator Resource Open Azure Portal (https://portal.azure.com) and sign in. Search for Azure AI services → Select Create under Translator. Configuration Items: Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Region: Choose any available region. Name: Enter a unique name. Pricing Tier: F0 (Free) or S (Standard). Responsible AI Notice: Agree. After provisioning, navigate to Keys and Endpoint in the Resource Management section. ...

June 7, 2025 · 2 min · Taner

AI-102 Study Series Exercise 22: Speech Recognition and Synthesis with Azure AI Speech

Overview This exercise demonstrates how to recognize and synthesize speech using Azure AI Speech. The solution enables users to convert spoken words into text (speech-to-text) and generate audible speech from text (text-to-speech). Steps & Configuration Details 1. Provision an Azure AI Speech Resource Open Azure Portal (https://portal.azure.com) and sign in. Search for Azure AI services → Select Create under Speech service. Configuration Items: Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Region: Choose any available region. Name: Enter a unique name. Pricing Tier: F0 (Free) or S (Standard). Responsible AI Notice: Agree. After provisioning, navigate to Keys and Endpoint in the Resource Management section. ...

June 7, 2025 · 3 min · Taner

AI-102 Study Series Exercise 23: Speech Translation with Azure AI Speech

Overview This exercise demonstrates how to translate speech using Azure AI Speech, enabling users to convert spoken language into translated text and synthesized speech. Steps & Configuration Details 1. Provision an Azure AI Speech Resource Open Azure Portal (https://portal.azure.com) and sign in. Search for Azure AI services → Select Create under Speech service. Configuration Items: Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Region: Choose any available region. Name: Enter a unique name. Pricing Tier: F0 (Free) or S (Standard). Responsible AI Notice: Agree. After provisioning, navigate to Keys and Endpoint in the Resource Management section. ...

June 7, 2025 · 3 min · Taner

AI-102 Study Series Exercise 24: Audio-Enabled Chat with Phi-4 Multimodal Model

Overview This exercise demonstrates how to develop an audio-enabled chat application using Azure AI Foundry and the Phi-4-multimodal-instruct model. The app provides AI assistance by summarizing voice messages left by customers. Steps & Configuration Details 1. Create an Azure AI Foundry Project Open Azure AI Foundry portal (https://ai.azure.com) and sign in. Select + Create project. Configuration Items: Hub Name: A valid name. Subscription: Your Azure subscription. Resource Group: Select or create a resource group. Location: Choose from: East US East US 2 North Central US South Central US Sweden Central West US West US 3 Connect Azure AI Services: Create a new AI Services resource. Connect Azure AI Search: Skip connecting. 2. Deploy a Multimodal Model Navigate to Models + endpoints → Deploy base model. Search for Phi-4-multimodal-instruct and select it. Configuration Items: Deployment Name: A valid name. Deployment Type: Global Standard. Deployment Details: Use default settings. 3. Configure the Client Application Open Azure Portal (https://portal.azure.com). Launch Azure Cloud Shell (PowerShell environment). Clone the repository: rm -r mslearn-ai-audio -f git clone https://github.com/MicrosoftLearning/mslearn-ai-language mslearn-ai-audio Navigate to the correct folder: Python: cd mslearn-ai-audio/Labfiles/09-audio-chat/Python C#: cd mslearn-ai-audio/Labfiles/09-audio-chat/C-sharp Install dependencies: Python: python -m venv labenv ./labenv/bin/Activate.ps1 pip install -r requirements.txt azure-identity azure-ai-projects azure-ai-inference C#: dotnet add package Azure.Identity dotnet add package Azure.AI.Inference --version 1.0.0-beta.3 dotnet add package Azure.AI.Projects --version 1.0.0-beta.3 Open the configuration file: Python: .env C#: appsettings.json Update Configuration Values: Project Connection String (copied from Azure AI Foundry portal). Model Deployment Name (Phi-4-multimodal-instruct). Save the configuration file. 4. Implement the AI Chat Client Open the code file: Python: audio-chat.py C#: Program.cs Add references: Python: from dotenv import load_dotenv from azure.identity import DefaultAzureCredential from azure.ai.projects import AIProjectClient from azure.ai.inference.models import SystemMessage, UserMessage, TextContentItem C#: using Azure.Identity; using Azure.AI.Projects; using Azure.AI.Inference; Initialize the AI Foundry client: Python: project_client = AIProjectClient.from_connection_string( conn_str=project_connection, credential=DefaultAzureCredential() ) C#: var projectClient = new AIProjectClient(project_connection, new DefaultAzureCredential()); Create a chat client: Python: chat_client = project_client.inference.get_chat_completions_client(model=model_deployment) C#: ChatCompletionsClient chat = projectClient.GetChatCompletionsClient(); 5. Submit an Audio-Based Prompt Python: file_path = "https://github.com/MicrosoftLearning/mslearn-ai-language/raw/refs/heads/main/Labfiles/09-audio-chat/data/avocados.mp3" response = chat_client.complete( messages=[ SystemMessage(system_message), UserMessage([ TextContentItem(text=prompt), {"type": "audio_url", "audio_url": {"url": file_path}} ]) ] ) print(response.choices[0].message.content) C#: string audioUrl = "https://github.com/MicrosoftLearning/mslearn-ai-language/raw/refs/heads/main/Labfiles/09-audio-chat/data/avocados.mp3"; var requestOptions = new ChatCompletionsOptions() { Messages = { new ChatRequestSystemMessage(system_message), new ChatRequestUserMessage( new ChatMessageTextContentItem(prompt), new ChatMessageAudioContentItem(new Uri(audioUrl)) ) }, Model = model_deployment }; var response = chat.Complete(requestOptions); Console.WriteLine(response.Value.Content); 6. Run Your Application Python: python audio-chat.py C#: dotnet run Example prompt: Can you summarize this customer's voice message? The response should display the AI-generated summary. 7. Clean Up Delete Azure resources to avoid unnecessary costs: Open Azure Portal (https://portal.azure.com). Navigate to Resource Groups. Select the resource group and click Delete.

June 7, 2025 · 3 min · Taner