* Initial plan * Update code for Microsoft.Extensions.AI.Abstractions 10.4.0 breaking changes - Rename FunctionApprovalRequestContent → ToolApprovalRequestContent - Rename FunctionApprovalResponseContent → ToolApprovalResponseContent - Rename UserInputRequestContent → ToolApprovalRequestContent - Rename UserInputResponseContent → ToolApprovalResponseContent - Update .FunctionCall property → .ToolCall with FunctionCallContent casts where needed - Update .Id property → .RequestId on the renamed types - Rename FunctionApprovalRequestEventGenerator → ToolApprovalRequestEventGenerator - Rename FunctionApprovalResponseEventGenerator → ToolApprovalResponseEventGenerator Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Update OpenAI 2.9.1, ME.AI 10.4.0, fix breaking API changes Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> * Fix remaining ME.AI 10.4.0 breaking changes: MCP approval types, .Output→.Outputs Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> * Use pattern matching with `when` for ToolApprovalRequestContent/FunctionCallContent Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> * Update Azure.AI.OpenAI to 2.9.0-beta.1 Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> * Fix remaining GetResponsesClient(model) build failures for Azure.AI.OpenAI 2.9.0-beta.1 Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> * Address review feedback: remove redundant type checks in TestRequestAgent.cs and fix error message in AIAgentHostExecutor.cs Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> * Update Azure.AI.Projects to 2.0.0-beta.2 with namespace migration - Azure.AI.Projects 2.0.0-beta.1 → 2.0.0-beta.2 - Azure.AI.Projects.OpenAI → Azure.AI.Extensions.OpenAI (transitive) - Agent types moved to Azure.AI.Projects.Agents namespace - AgentRecord.Versions.Latest → AgentRecord.GetLatestVersion() - OpenAPIFunctionDefinition → OpenApiFunctionDefinition - BingCustomSearchToolParameters → BingCustomSearchToolOptions - MemorySearchPreviewTool.UpdateDelay → UpdateDelayInSecs - Azure.Identity 1.17.1 → 1.19.0 - Microsoft.Identity.Client.Extensions.Msal 4.78.0 → 4.83.1 Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com> * Fix remaining type renames for Azure.AI.Projects 2.0.0-beta.2 - BrowserAutomationToolParameters → BrowserAutomationToolOptions - MemoryUpdateOptions.UpdateDelay stays as UpdateDelay (not renamed) - WaitForMemoriesUpdateAsync parameter order: pollingInterval before options - AIProjectAgentsOperations → AgentsClient Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com> * Fix format errors and OpenTelemetry test for ME.AI 10.4.0 - Remove unused 'using Azure.AI.Extensions.OpenAI' and fix import ordering in Agent_With_AzureAIProject/Program.cs - Update OpenTelemetryAgentTests: gen_ai.tool.definitions is now always emitted regardless of EnableSensitiveData per ME.AI 10.4.0 change (dotnet/extensions#7346). Tool definitions are not considered sensitive. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix GetRepoFolder() to work in git worktrees Use 'workflow-samples' directory as repo root marker instead of '.git', which fails in worktrees (.git is a file) and also matches too early when a '.github' folder exists in subdirectories. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix formatting: remove unused usings and fix import ordering dotnet format applied across 59 impacted projects. Primarily removes unnecessary 'using Azure.AI.Projects' where Azure.AI.Projects.Agents provides all needed types, and fixes import ordering per editorconfig. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Disable AzureAIAgentsPersistent integration tests (#4769) Azure.AI.Agents.Persistent 1.2.0-beta.9 references McpServerToolApprovalResponseContent which was removed in ME.AI 10.4.0 (renamed to ToolApprovalResponseContent), causing TypeLoadException at runtime. Mark all 6 test classes with IntegrationDisabled trait until Persistent ships a version targeting ME.AI 10.4.0+. Upstream fix: https://github.com/Azure/azure-sdk-for-net/pull/56929 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add README with compatibility note for AzureAI.Persistent (#4769) Documents that Azure.AI.Agents.Persistent 1.2.0-beta.9 is only compatible with ME.AI ≤10.3.0 and OpenAI ≤2.8.0 due to type renames in ME.AI 10.4.0. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix file encoding: restore UTF-8 BOM on Persistent test files Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Mark AzureAI.Persistent as IsPackable=false (#4769) Prevent shipping until Azure.AI.Agents.Persistent targets ME.AI 10.4.0+. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Moving IsPackable after import --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
Microsoft Agent Framework agents with the M365 Agents SDK Weather Agent sample
This is a sample of a simple Weather Forecast Agent that is hosted on an Asp.Net core web service and is exposed via the M365 Agent SDK. This Agent is configured to accept a request asking for information about a weather forecast and respond to the caller with an Adaptive Card. This agent will handle multiple "turns" to get the required information from the user.
This Agent Sample is intended to introduce you the basics of integrating Agent Framework with the Microsoft 365 Agents SDK in order to use Agent Framework agents in various M365 services and applications. It can also be used as the base for a custom Agent that you choose to develop.
Note: This sample requires JSON structured output from the model which works best from newer versions of the model such as gpt-4o-mini.
Prerequisites
-
You will need an Azure OpenAI or OpenAI resource using
gpt-4o-mini -
Configure OpenAI in appsettings
"AIServices": { "AzureOpenAI": { "DeploymentName": "", // This is the Deployment (as opposed to model) Name of the Azure OpenAI model "Endpoint": "", // This is the Endpoint of the Azure OpenAI resource "ApiKey": "" // This is the API Key of the Azure OpenAI resource. Optional, uses DefaultAzureCredential if not provided }, "OpenAI": { "ModelId": "", // This is the Model ID of the OpenAI model "ApiKey": "" // This is your API Key for the OpenAI service }, "UseAzureOpenAI": false // This is a flag to determine whether to use the Azure OpenAI or the OpenAI service }
QuickStart using Agent Toolkit
-
If you haven't done so already, install the Agents Playground
winget install agentsplayground -
Start the sample application.
-
Start Agents Playground. At a command prompt:
agentsplayground- The tool will open a web browser showing the Microsoft 365 Agents Playground, ready to send messages to your agent.
-
Interact with the Agent via the browser
QuickStart using WebChat or Teams
- Overview of running and testing an Agent
- Provision an Azure Bot in your Azure Subscription
- Configure your Agent settings to use to desired authentication type
- Running an instance of the Agent app (either locally or deployed to Azure)
- Test in a client
-
Create an Azure Bot with one of these authentication types
Be sure to follow the Next Steps at the end of these docs to configure your agent settings.
IMPORTANT: If you want to run your agent locally via devtunnels, the only support auth type is ClientSecret and Certificates
-
Running the Agent
-
Running the Agent locally
- Requires a tunneling tool to allow for local development and debugging should you wish to do local development whilst connected to a external client such as Microsoft Teams.
- For ClientSecret or Certificate authentication types only. Federated Credentials and Managed Identity will not work via a tunnel to a local agent and must be deployed to an App Service or container.
-
Run
devtunnel. Please follow Create and host a dev tunnel and host the tunnel with anonymous user access command as shown below:devtunnel host -p 3978 --allow-anonymous -
On the Azure Bot, select Settings, then Configuration, and update the Messaging endpoint to
{tunnel-url}/api/messages -
Start the Agent in Visual Studio
-
Deploy Agent code to Azure
- VS Publish works well for this. But any tools used to deploy a web application will also work.
- On the Azure Bot, select Settings, then Configuration, and update the Messaging endpoint to
https://{{appServiceDomain}}/api/messages
-
Testing this agent with WebChat
- Select Test in WebChat under Settings on the Azure Bot in the Azure Portal
Testing this Agent in Teams or M365
-
Update the manifest.json
- Edit the
manifest.jsoncontained in the/appManifestfolder- Replace with your AppId (that was created above) everywhere you see the place holder string
<<AAD_APP_CLIENT_ID>> - Replace
<<BOT_DOMAIN>>with your Agent url. For example, the tunnel host name.
- Replace with your AppId (that was created above) everywhere you see the place holder string
- Zip up the contents of the
/appManifestfolder to create amanifest.zipmanifest.jsonoutline.pngcolor.png
- Edit the
-
Your Azure Bot should have the Microsoft Teams channel added under Channels.
-
Navigate to the Microsoft Admin Portal (MAC). Under Settings and Integrated Apps, select Upload Custom App.
-
Select the
manifest.zipcreated in the previous step. -
After a short period of time, the agent shows up in Microsoft Teams and Microsoft 365 Copilot.
Enabling JWT token validation
- By default, the AspNet token validation is disabled in order to support local debugging.
- Enable by updating appsettings
"TokenValidation": { "Enabled": true, "Audiences": [ "{{ClientId}}" // this is the Client ID used for the Azure Bot ], "TenantId": "{{TenantId}}" },
Further reading
To learn more about using the M365 Agent SDK, see Microsoft 365 Agents SDK.