Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,9 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/
ProxyAgent-NodeJS/.localConfigs
ProxyAgent-NodeJS/appPackage/build/appPackage.dev.zip
ProxyAgent-NodeJS/appPackage/build/appPackage.local.zip
ProxyAgent-NodeJS/appPackage/build/manifest.dev.json
ProxyAgent-NodeJS/appPackage/build/manifest.local.json
ProxyAgent-NodeJS/env/.env.local
6 changes: 4 additions & 2 deletions ProxyAgent-CSharp/AzureAgentToM365ATK/Agents/AzureAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using Microsoft.Agents.Core.Models;
using System.Collections.Concurrent;
using Microsoft.Agents.AI;
using Microsoft.Agents.AI.AzureAI;
using System.Text.Json;
using Microsoft.Agents.Core.Serialization;
using Microsoft.Extensions.AI;
Expand Down Expand Up @@ -132,8 +133,9 @@ protected async Task SendMessageToAzureAgent(ITurnContext turnContext, ITurnStat
_agentModelCache.TryAdd(this._agentId, agentModel);
}

// Create an instance of the AzureAIAgent with the agent model and client.
AIAgent _existingAgent = _aiProjectClient.GetAIAgent(agentModel);
// Create an instance of the AIAgent using the new GetAIAgentAsync extension method
// The new API accepts agentId (string) instead of the Response<PersistentAgent> object
AIAgent _existingAgent = await _aiProjectClient.GetAIAgentAsync(this._agentId, cancellationToken: cancellationToken).ConfigureAwait(false);

// Get or create thread:
AgentThread _agentThread = GetConversationThread(_existingAgent, turnState);
Expand Down
22 changes: 12 additions & 10 deletions ProxyAgent-CSharp/AzureAgentToM365ATK/AzureAgentToM365ATK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.17.0" />
<PackageReference Include="AdaptiveCards" Version="3.1.0" />
<PackageReference Include="Microsoft.Agents.Authentication.Msal" Version="1.*-*" />
<PackageReference Include="Microsoft.Agents.Hosting.AspNetCore" Version="1.*-*" />
<PackageReference Include="Microsoft.Agents.AI" Version="1.*-*" />
<PackageReference Include="Microsoft.Agents.AI.AzureAI" Version="1.*-*" />
<PackageReference Include="Azure.AI.Agents.Persistent" Version="1.*-*" />
<PackageReference Include="Microsoft.Extensions.AI" Version="9.10.2" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.17.1" />
<PackageReference Include="AdaptiveCards" Version="3.1.0" />
<PackageReference Include="Microsoft.Agents.Authentication.Msal" Version="1.3.173-beta" />
<PackageReference Include="Microsoft.Agents.Hosting.AspNetCore" Version="1.3.173-beta" />
<PackageReference Include="Microsoft.Agents.AI" Version="1.0.0-preview.251114.1" />
<PackageReference Include="Microsoft.Agents.AI.AzureAI" Version="1.0.0-preview.251114.1" />
<PackageReference Include="Microsoft.Agents.AI.AzureAI.Persistent" Version="1.0.0-preview.251114.1" />
<PackageReference Include="Azure.AI.Agents.Persistent" Version="1.2.0-beta.7" />
<PackageReference Include="Microsoft.Extensions.AI" Version="10.0.0" />
</ItemGroup>


</Project>
2 changes: 1 addition & 1 deletion ProxyAgent-CSharp/M365Agent/AZURE_DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ You've successfully deployed your M365 Agent to Azure! 🎉
5. ✅ Implement CI/CD for automated deployments

**Resources:**
- [Microsoft 365 Agents Toolkit Documentation](https://aka.ms/teams-toolkit-docs)
- [Microsoft 365 Agents Toolkit Documentation](https://learn.microsoft.com/en-us/microsoft-365/developer/overview-m365-agents-toolkit)
- [Azure Bot Service Documentation](https://learn.microsoft.com/azure/bot-service/)
- [Bicep Documentation](https://learn.microsoft.com/azure/azure-resource-manager/bicep/)
- [Microsoft 365 Agents SDK](https://github.com/microsoft/agents)
Expand Down
2 changes: 1 addition & 1 deletion ProxyAgent-CSharp/M365Agent/LOCAL_DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ Production uses:
### Resources

**Documentation:**
- [Microsoft 365 Agents Toolkit](https://aka.ms/teams-toolkit-docs)
- [Microsoft 365 Agents Toolkit](https://learn.microsoft.com/en-us/microsoft-365/developer/overview-m365-agents-toolkit)
- [Microsoft 365 Agents SDK for .NET](https://github.com/microsoft/agents)
- [Dev Tunnels Documentation](https://learn.microsoft.com/azure/developer/dev-tunnels/)
- [Teams Platform](https://learn.microsoft.com/microsoftteams/platform/)
Expand Down
2 changes: 1 addition & 1 deletion ProxyAgent-CSharp/M365Agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ New to Teams app development or Microsoft 365 Agents Toolkit? Explore Teams app

**Questions:**
- Microsoft Q&A: [Teams Development](https://learn.microsoft.com/answers/topics/microsoft-teams.html)
- Documentation: [Microsoft 365 Agents Toolkit](https://aka.ms/teams-toolkit-docs)
- Documentation: [Microsoft 365 Agents Toolkit](https://learn.microsoft.com/en-us/microsoft-365/developer/overview-m365-agents-toolkit)
4 changes: 2 additions & 2 deletions ProxyAgent-CSharp/M365Agent/appPackage/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/vdevPreview/MicrosoftTeams.schema.json",
"manifestVersion": "devPreview",
"$schema": "https://developer.microsoft.com/json-schemas/teams/v1.24/MicrosoftTeams.schema.json",
"manifestVersion": "1.24",
"version": "1.0.0",
"id": "${{TEAMS_APP_ID}}",
"developer": {
Expand Down
85 changes: 85 additions & 0 deletions ProxyAgent-CSharp/M365Agent/scripts/get-teams-ips.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Script to download Microsoft 365 endpoints and extract Teams IP ranges
# Filters by ServiceArea = "Skype" and tcpPorts = "80,443"

param(
[string]$OutputFormat = "CommaList" # Options: CommaList, Array, Json
)

# Data source URL
$endpointsUrl = "https://endpoints.office.com/endpoints/worldwide?clientrequestid=b10c5ed1-bad1-445f-b386-b919946339a7"

Write-Host "Downloading Microsoft 365 endpoints..." -ForegroundColor Cyan

try {
# Download JSON data
$endpoints = Invoke-RestMethod -Uri $endpointsUrl -Method Get -ErrorAction Stop

Write-Host "Successfully downloaded $($endpoints.Count) endpoint definitions" -ForegroundColor Green

# Filter for Microsoft Teams (Skype serviceArea with TCP ports 80,443 and has IPs property)
$teamsEndpoint = $endpoints | Where-Object {
$_.serviceArea -eq "Skype" -and $_.tcpPorts -eq "80,443" -and $_.ips
}

if (-not $teamsEndpoint) {
Write-Host "ERROR: Could not find Microsoft Teams endpoint with serviceArea='Skype', tcpPorts='80,443', and IPs defined" -ForegroundColor Red
exit 1
}

Write-Host "`nFound Microsoft Teams endpoint (ID: $($teamsEndpoint.id))" -ForegroundColor Green
Write-Host "Service Area Display Name: $($teamsEndpoint.serviceAreaDisplayName)" -ForegroundColor Gray

# Separate IPv4 and IPv6 addresses
$ipv4List = @()
$ipv6List = @()

foreach ($ip in $teamsEndpoint.ips) {
if ($ip -match ":") {
# IPv6 (contains colons)
$ipv6List += $ip
} else {
# IPv4
$ipv4List += $ip
}
}

# Output results
Write-Host "`n================================" -ForegroundColor Cyan
Write-Host "RESULTS" -ForegroundColor Cyan
Write-Host "================================" -ForegroundColor Cyan

Write-Host "`nIPv4 Ranges ($($ipv4List.Count) total):" -ForegroundColor Yellow
$ipv4String = $ipv4List -join ","
Write-Host $ipv4String -ForegroundColor White

Write-Host "`nIPv6 Ranges ($($ipv6List.Count) total):" -ForegroundColor Yellow
$ipv6String = $ipv6List -join ","
Write-Host $ipv6String -ForegroundColor White

# Export to variables for easy use
Write-Host "`n================================" -ForegroundColor Cyan
Write-Host "EXPORT VARIABLES" -ForegroundColor Cyan
Write-Host "================================" -ForegroundColor Cyan

# Create output object
$result = [PSCustomObject]@{
IPv4CommaList = $ipv4String
IPv6CommaList = $ipv6String
IPv4Array = $ipv4List
IPv6Array = $ipv6List
TotalIPv4 = $ipv4List.Count
TotalIPv6 = $ipv6List.Count
ServiceAreaDisplayName = $teamsEndpoint.serviceAreaDisplayName
EndpointId = $teamsEndpoint.id
LastUpdated = Get-Date
}


# Return the result object
return $result

} catch {
Write-Host "ERROR: Failed to download or parse endpoints" -ForegroundColor Red
Write-Host $_.Exception.Message -ForegroundColor Red
exit 1
}
16 changes: 9 additions & 7 deletions ProxyAgent-CSharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This solution demonstrates how to integrate a Microsoft Foundry agent with Microsoft Teams and Microsoft 365 Copilot, providing a seamless experience for users to interact with powerful AI capabilities directly within their productivity tools.

[![Video Tutorial](https://img.youtube.com/vi/U9Yv2vjKYbI/0.jpg)](https://www.youtube.com/watch?v=U9Yv2vjKYbI)
[![Video Tutorial](https://img.youtube.com/vi/nRuY_YI-Efk/0.jpg)](https://www.youtube.com/watch?v=nRuY_YI-Efk)

## This sample illustrates
- How to connect an AI Foundry Agent to M365 Copilot
Expand Down Expand Up @@ -39,11 +39,12 @@ sequenceDiagram
%% Flow
U->>M: User prompt (e.g., "Create a report")
M->>B: Activity (Message)
B->>P: POST /api/messages (JWT)
B->>P: POST /api/messages (Message)
P->>B: 202 Accepted
P-->>M: Start Streaming Session with information
P->>A: POST /process { prompt }
A-->>P: { content }
P-->>B: sendActivity(content)
B-->>M: Response
P-->>M: Stream(content)
M-->>U: Display result
```

Expand Down Expand Up @@ -96,7 +97,7 @@ atk deploy --env dev
### Required Tools
- **.NET SDK 9.0** - [Download](https://dotnet.microsoft.com/download/dotnet/9.0)
- **Azure CLI** - [Install Guide](https://learn.microsoft.com/cli/azure/install-azure-cli)
- **Microsoft 365 Agents Toolkit CLI** - [Install Guide](https://aka.ms/m365agentstoolkit-cli)
- **Microsoft 365 Agents Toolkit CLI** - [Install Guide](https://learn.microsoft.com/en-us/microsoftteams/platform/toolkit/microsoft-365-agents-toolkit-cli)
- **Visual Studio Code** with C# Dev Kit extension

> **Important:** This solution currently supports **VS Code only**. Visual Studio support is planned for future releases.
Expand Down Expand Up @@ -380,7 +381,7 @@ The bot uses **Azure Managed Identity** (production) or **Single Tenant + Client
## 📖 Additional Resources

### Microsoft 365 Agents Toolkit
- [Microsoft 365 Agents Toolkit Documentation](https://aka.ms/teams-toolkit-docs)
- [Microsoft 365 Agents Toolkit Documentation](https://learn.microsoft.com/en-us/microsoft-365/developer/overview-m365-agents-toolkit)
- [Microsoft 365 Agents Toolkit GitHub](https://github.com/OfficeDev/TeamsFx)
- [Teams App Development Guide](https://learn.microsoft.com/microsoftteams/platform/)

Expand Down Expand Up @@ -725,9 +726,10 @@ Now that you have a working Stock Agent, you can:
This project was built with contributions from:

- **[@ericsche](https://github.com/ericsche)** - Project Lead & Development
- **[@DavidRoussel](https://github.com/DavidRoussel)** - Co-Author & Technical Contributions
- **[@davrous](https://github.com/davrous)** - Co-Author & Technical Contributions
- **[@MattB-msft](https://github.com/MattB-msft)** - Co-Author & Guidance
- **[@garrytrinder](https://github.com/garrytrinder)** - ATK Guidance & Review
- **[@andikrueger](https://github.com/andikrueger)** - Code Review & Testing

Special thanks to everyone who contributed to making this solution possible!

Expand Down