developer
239 TopicsMastering Query Fields in Azure AI Document Intelligence with C#
Introduction Azure AI Document Intelligence simplifies document data extraction, with features like query fields enabling targeted data retrieval. However, using these features with the C# SDK can be tricky. This guide highlights a real-world issue, provides a corrected implementation, and shares best practices for efficient usage. Use case scenario During the cause of Azure AI Document Intelligence software engineering code tasks or review, many developers encountered an error while trying to extract fields like "FullName," "CompanyName," and "JobTitle" using `AnalyzeDocumentAsync`: The error might be similar to Inner Error: The parameter urlSource or base64Source is required. This is a challenge referred to as parameter errors and SDK changes. Most problematic code are looks like below in C#: BinaryData data = BinaryData.FromBytes(Content); var queryFields = new List<string> { "FullName", "CompanyName", "JobTitle" }; var operation = await client.AnalyzeDocumentAsync( WaitUntil.Completed, modelId, data, "1-2", queryFields: queryFields, features: new List<DocumentAnalysisFeature> { DocumentAnalysisFeature.QueryFields } ); One of the reasons this failed was that the developer was using `Azure.AI.DocumentIntelligence v1.0.0`, where `base64Source` and `urlSource` must be handled internally. Because the older examples using `AnalyzeDocumentContent` no longer apply and leading to errors. Practical Solution Using AnalyzeDocumentOptions. Alternative Method using manual JSON Payload. Using AnalyzeDocumentOptions The correct method involves using AnalyzeDocumentOptions, which streamlines the request construction using the below steps: Prepare the document content: BinaryData data = BinaryData.FromBytes(Content); reate AnalyzeDocumentOptions: var analyzeOptions = new AnalyzeDocumentOptions(modelId, data) { Pages = "1-2", Features = { DocumentAnalysisFeature.QueryFields }, QueryFields = { "FullName", "CompanyName", "JobTitle" } }; - `modelId`: Your trained model’s ID. - `Pages`: Specify pages to analyze (e.g., "1-2"). - `Features`: Enable `QueryFields`. - `QueryFields`: Define which fields to extract. Run the analysis: Operation<AnalyzeResult> operation = await client.AnalyzeDocumentAsync( WaitUntil.Completed, analyzeOptions ); AnalyzeResult result = operation.Value; The reason this works: The SDK manages `base64Source` automatically. This approach matches the latest SDK standards. It results in cleaner, more maintainable code. Alternative method using manual JSON payload For advanced use cases where more control over the request is needed, you can manually create the JSON payload. For an example: var queriesPayload = new { queryFields = new[] { new { key = "FullName" }, new { key = "CompanyName" }, new { key = "JobTitle" } } }; string jsonPayload = JsonSerializer.Serialize(queriesPayload); BinaryData requestData = BinaryData.FromString(jsonPayload); var operation = await client.AnalyzeDocumentAsync( WaitUntil.Completed, modelId, requestData, "1-2", features: new List<DocumentAnalysisFeature> { DocumentAnalysisFeature.QueryFields } ); When to use the above: Custom request formats Non-standard data source integration Key points to remember Breaking changes exist between preview versions and v1.0.0 by checking the SDK version. Prefer `AnalyzeDocumentOptions` for simpler, error-free integration by using built-In classes. Ensure your content is wrapped in `BinaryData` or use a direct URL for correct document input: Conclusion In this article, we have seen how you can use AnalyzeDocumentOptions to significantly improves how you integrate query fields with Azure AI Document Intelligence in C#. It ensures your solution is up-to-date, readable, and more reliable. Staying aware of SDK updates and evolving best practices will help you unlock deeper insights from your documents effortlessly. Reference Official AnalyzeDocumentAsync Documentation. Official Azure SDK documentation. Azure Document Intelligence C# SDK support add-on query field.Getting Started with Azure MCP Server: A Guide for Developers
The world of cloud computing is growing rapidly, and Azure is at the forefront of this innovation. If you're a student developer eager to dive into Azure and learn about Model Context Protocol (MCP), the Azure MCP Server is your perfect starting point. This tool, currently in Public Preview, empowers AI agents to seamlessly interact with Azure services like Azure Storage, Cosmos DB, and more. Let's explore how you can get started! 🎯 Why Use the Azure MCP Server? The Azure MCP Server revolutionizes how AI agents and developers interact with Azure services. Here's a glimpse of what it offers: Exploration Made Easy: List storage accounts, databases, resource groups, tables, and more with natural language commands. Advanced Operations: Manage configurations, query analytics, and execute complex tasks like building Azure applications. Streamlined Integration: From JSON communication to intelligent auto-completion, the Azure MCP Server ensures smooth operations. Whether you're querying log analytics or setting up app configurations, this server simplifies everything. ✨ Installation Guide: One-Click and Manual Methods Prerequisites: Before you begin, ensure the following: Install either the Stable or Insiders release of VS Code. Add the GitHub Copilot and GitHub Copilot Chat extensions. Option 1: One-Click Install You can install the Azure MCP Server in VS Code or VS Code Insiders using NPX. Here's how: Simply run: npx -y /mcp@latest server start Option 2: Manual Install If you'd prefer manual setup, follow these steps: Create a .vscode/mcp.json file in your VS Code project directory. Add the following configuration: { "servers": { "Azure MCP Server": { "command": "npx", "args": ["-y", "@azure/mcp@latest", "server", "start"] } } } Here an example of the settings.json file Now, launch GitHub Copilot in Agent Mode to activate the Azure MCP Server. 🚀 Supercharging Azure Development Once installed, the Azure MCP Server unlocks an array of capabilities: Azure Cosmos DB: List, query, manage databases and containers. Azure Storage: Query blob containers, metadata, and tables. Azure Monitor: Use KQL to analyze logs and monitor your resources. App Configuration: Handle key-value pairs and labeled configurations. Test prompts like: "List my Azure Storage containers" "Query my Log Analytics workspace" "Show my key-value pairs in App Config" These commands let your agents harness the power of Azure services effortlessly. 🛡️ Security & Authentication The Azure MCP Server simplifies authentication using Azure Identity. Your login credentials are handled securely, with support for mechanisms like: Visual Studio credentials Azure CLI login Interactive Browser login For advanced scenarios, enable production credentials with: export AZURE_MCP_INCLUDE_PRODUCTION_CREDENTIALS=true Always perform a security review when integrating MCP servers to ensure compliance with regulations and standards. 🌟 Why Join the Azure MCP Community? As a developer, you're invited to contribute to the Azure MCP Server project. Whether it's fixing bugs, adding features, or enhancing documentation, your contributions are valued. Explore the Contributing Guide for details on getting involved. The Azure MCP Server is your gateway to leveraging Azure services with cutting-edge technology. Dive in, experiment, and bring your projects to life! What Azure project are you excited to build with the MCP Server? Let’s brainstorm ideas together!Week 3 . Microsoft Agents Hack Online Events and Readiness Resources
Readiness and skilling events for Week 3: Microsoft AI Agents Hack Register Now at https://aka.ms/agentshack https://aka.ms/agentshack 2025 is the year of AI agents! But what exactly is an agent, and how can you build one? Whether you're a seasoned developer or just starting out, this FREE three-week virtual hackathon is your chance to dive deep into AI agent development. Register Now: https://aka.ms/agentshack 🔥 Learn from expert-led sessions streamed live on YouTube, covering top frameworks like Semantic Kernel, Autogen, the new Azure AI Agents SDK and the Microsoft 365 Agents SDK. Week 3: April 21st-25th LIVE & ONDEMAND Day/Time Topic Track 4/21 12:00 PM PT Knowledge-augmented agents with LlamaIndex.TS JS 4/22 06:00 AM PT Building a AI Agent with Prompty and Azure AI Foundry Python 4/22 09:00 AM PT Real-time Multi-Agent LLM solutions with SignalR, gRPC, and HTTP based on Semantic Kernel C# 4/22 10:30 AM PT Learn Live: Fundamentals of AI agents on Azure - 4/22 12:00 PM PT Demystifying Agents: Building an AI Agent from Scratch on Your Own Data using Azure SQL C# 4/22 03:00 PM PT VoiceRAG: talk to your data Python 4/23 09:00 AM PT Building Multi-Agent Apps on top of Azure PostgreSQL Python 4/23 12:00 PM PT Agentic RAG with reflection Python 4/23 03:00 PM PT Multi-source data patterns for modern RAG apps C# 4/24 06:00 AM PT Engineering agents that Think, Act, and Govern themselves C# 4/24 09:00 AM PT Extending AI Agents with Azure Functions Python, C# 4/24 12:00 PM PT Build real time voice agents with Azure Communication Services Python 🌟 Join the Conversation on Azure AI Foundry Discussions! 🌟 Have ideas, questions, or insights about AI? Don't keep them to yourself! Share your thoughts, engage with experts, and connect with a community that’s shaping the future of artificial intelligence. 🧠✨ 👉 Click here to join the discussion!VS Code Live: Agent Mode Day Highlights
🎙️ Featuring: Olivia McVicker, Cassidy Williams, Burke Holland, Harald Kirschner, Toby Padilla, Rob Lourens, Tim Rogers, James Montemagno, Don Jayamanne, Brigit Murtaugh, Chris Harrison. What is Agent Mode? Agent Mode in VS Code represents a leap beyond traditional AI code completion. Instead of simply suggesting code snippets, Agent Mode empowers the AI to: Write, edit, and iterate on code Run terminal commands autonomously Fix its own mistakes during the workflow Interact with external tools, APIs, and services This creates a more dynamic, "agentic" coding partner that can automate complex tasks, reduce manual intervention, and keep developers in their flow. Agent Mode is accessible directly in VS Code and integrates seamlessly with GitHub Copilot, making advanced AI capabilities available to developers of all levels. 1. Model Context Protocol (MCP) MCP is an open protocol that standardizes how applications provide context to Large Language Models (LLMs). This protocol acts as a bridge, allowing AI agents in VS Code to securely connect with a vast ecosystem of tools, APIs, and internal resources—well beyond what’s available out-of-the-box. Key Points about MCP: Ecosystem Approach: MCP enables developers to connect Copilot and other agents to everything they need—internal documentation, databases, design tools like Figma, and more—by exposing these resources as MCP servers. Open and Extensible: Similar to the Language Server Protocol (LSP), MCP allows anyone to build and share new integrations. There are already thousands of MCP servers available, and building your own is straightforward with SDKs in major languages. Tool Chaining: MCP servers can be composed together, allowing the AI to automate workflows involving multiple tools—like fetching data, updating issues, or running tests—without manual intervention. Secure and Evolving: The protocol is evolving to support more secure authentication (moving from local API keys to OAuth-based flows) and easier discovery and installation, making it safer and more user-friendly. 2. Next Edit Suggestions (NES) Next Edit Suggestions (NES) is a feature designed to enhance editing experience by providing context-aware recommendations for code changes. NES helps developers by: Suggesting relevant edits based on the current code context Supporting tasks like refactoring, bug fixing, and feature additions Allowing developers to focus on logic and architecture rather than syntax NES works hand-in-hand with Agent Mode, letting developers quickly accept, undo, or iterate on AI-generated changes, all while maintaining control and oversight of their codebase. 3. Bring Your Own Key (BYOK): Custom AI Model Integration Bring Your Own Key (BYOK) allows users to connect their own API keys for custom AI models, including those from OpenAI, Anthropic, or even local models via platforms like Olama. With BYOK, developers can: Choose from a variety of AI models, including the latest GPT-4o Mini and Claude 3 Opus Integrate local or cloud-based models for privacy, cost, or performance reasons Tailor the AI experience to their specific needs and preferences This flexibility ensures that developers are not locked into a single provider and can experiment with the latest advancements in AI as soon as they become available. 4. The Agentic Future A preview of "Project Padawan" demonstrated how agentic workflows could soon run asynchronously in the cloud. Developers will be able to assign tasks to Copilot (such as resolving GitHub issues), which will autonomously create pull requests, run tests, and iterate on feedback—all while the developer focuses on other work. GitHub Copilot Skills Challenge Want to learn and experiment with GitHub Copilot's Agent Mode while earning a Digital Badge? Join the GitHub Copilot Skills Challenge—a hands-on learning experience on Microsoft Learn where you'll build a Python app using Agent Mode through a guided tutorial. Complete the challenge by April 30, 2025, to earn your badge! Check out the official rules: https://aka.ms/csc/terms Register to the Challenge: https://aka.ms/csc/githubcopilot Request your badge at https://aka.ms/getyourbadge Getting Started Enable Agent Mode—available in both stable and insiders builds—to start experimenting with advanced AI capabilities, and explore MCP Integrations by browsing the growing list of servers or building your own with the available SDKs. Want to see these features in action? Watch the full stream for live demos, expert tips, and save the date for the next episode of our VS Code Live series: https://aka.ms/VSCode/Live Happy Coding!Modo Agente: disponible para todos los usuarios y compatible con MCP
¡El modo Agente se está lanzando para todos los usuarios de VS Code! El agente actúa como un programador autónomo que realiza tareas de codificación en varias etapas bajo tu comando, como analizar tu base de código, proponer ediciones de archivos y ejecutar comandos en el terminal. Responde a errores de compilación y lint, monitorea la salida del terminal y corrige automáticamente en un bucle hasta que la tarea esté completada. El agente también puede usar herramientas contribuidas, lo que le permite interactuar con servidores MCP externos o extensiones de VS Code para realizar una amplia variedad de tareas.The Importance of Implementing SAST Scanning for Infrastructure as Code
As the adoption of Infrastructure as Code (IaC) continues to grow, ensuring the security of your infrastructure configurations becomes increasingly crucial. Static Application Security Testing (SAST) scanning for IaC can play a vital role in identifying vulnerabilities early in the development lifecycle. This blog explores why implementing SAST scanning for IaC is essential for maintaining secure and robust infrastructure.