Skip to content

Commit ee21620

Browse files
authored
Proxy Agent Minor fixes (#1528)
* Add proxyAgent * Fix documentation & Product names Applied fix for PR Product rename Allign names in all documentation * Naming Update * Updates V1 final updates. hardcoded SDK versions until GA Updated Readme with demo video Updated Agent Flow in Readme to better align with the real flow. * Minor fix Update to support latest SDK with fixed version * last fixes last sync to get Readme and Manifest updates * Update Readme
1 parent 6c28f87 commit ee21620

File tree

5 files changed

+110
-19
lines changed

5 files changed

+110
-19
lines changed

ProxyAgent-CSharp/AzureAgentToM365ATK/Agents/AzureAgent.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using Microsoft.Agents.Core.Models;
1818
using System.Collections.Concurrent;
1919
using Microsoft.Agents.AI;
20+
using Microsoft.Agents.AI.AzureAI;
2021
using System.Text.Json;
2122
using Microsoft.Agents.Core.Serialization;
2223
using Microsoft.Extensions.AI;
@@ -132,8 +133,9 @@ protected async Task SendMessageToAzureAgent(ITurnContext turnContext, ITurnStat
132133
_agentModelCache.TryAdd(this._agentId, agentModel);
133134
}
134135

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

138140
// Get or create thread:
139141
AgentThread _agentThread = GetConversationThread(_existingAgent, turnState);

ProxyAgent-CSharp/AzureAgentToM365ATK/AzureAgentToM365ATK.csproj

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,17 @@
1818
</None>
1919
</ItemGroup>
2020

21-
<ItemGroup>
22-
<PackageReference Include="Azure.Identity" Version="1.17.0" />
23-
<PackageReference Include="AdaptiveCards" Version="3.1.0" />
24-
<PackageReference Include="Microsoft.Agents.Authentication.Msal" Version="1.*-*" />
25-
<PackageReference Include="Microsoft.Agents.Hosting.AspNetCore" Version="1.*-*" />
26-
<PackageReference Include="Microsoft.Agents.AI" Version="1.*-*" />
27-
<PackageReference Include="Microsoft.Agents.AI.AzureAI" Version="1.*-*" />
28-
<PackageReference Include="Azure.AI.Agents.Persistent" Version="1.*-*" />
29-
<PackageReference Include="Microsoft.Extensions.AI" Version="9.10.2" />
30-
</ItemGroup>
21+
<ItemGroup>
22+
<PackageReference Include="Azure.Identity" Version="1.17.1" />
23+
<PackageReference Include="AdaptiveCards" Version="3.1.0" />
24+
<PackageReference Include="Microsoft.Agents.Authentication.Msal" Version="1.3.173-beta" />
25+
<PackageReference Include="Microsoft.Agents.Hosting.AspNetCore" Version="1.3.173-beta" />
26+
<PackageReference Include="Microsoft.Agents.AI" Version="1.0.0-preview.251114.1" />
27+
<PackageReference Include="Microsoft.Agents.AI.AzureAI" Version="1.0.0-preview.251114.1" />
28+
<PackageReference Include="Microsoft.Agents.AI.AzureAI.Persistent" Version="1.0.0-preview.251114.1" />
29+
<PackageReference Include="Azure.AI.Agents.Persistent" Version="1.2.0-beta.7" />
30+
<PackageReference Include="Microsoft.Extensions.AI" Version="10.0.0" />
31+
</ItemGroup>
32+
3133

3234
</Project>

ProxyAgent-CSharp/M365Agent/appPackage/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/vdevPreview/MicrosoftTeams.schema.json",
3-
"manifestVersion": "devPreview",
2+
"$schema": "https://developer.microsoft.com/json-schemas/teams/v1.24/MicrosoftTeams.schema.json",
3+
"manifestVersion": "1.24",
44
"version": "1.0.0",
55
"id": "${{TEAMS_APP_ID}}",
66
"developer": {
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Script to download Microsoft 365 endpoints and extract Teams IP ranges
2+
# Filters by ServiceArea = "Skype" and tcpPorts = "80,443"
3+
4+
param(
5+
[string]$OutputFormat = "CommaList" # Options: CommaList, Array, Json
6+
)
7+
8+
# Data source URL
9+
$endpointsUrl = "https://endpoints.office.com/endpoints/worldwide?clientrequestid=b10c5ed1-bad1-445f-b386-b919946339a7"
10+
11+
Write-Host "Downloading Microsoft 365 endpoints..." -ForegroundColor Cyan
12+
13+
try {
14+
# Download JSON data
15+
$endpoints = Invoke-RestMethod -Uri $endpointsUrl -Method Get -ErrorAction Stop
16+
17+
Write-Host "Successfully downloaded $($endpoints.Count) endpoint definitions" -ForegroundColor Green
18+
19+
# Filter for Microsoft Teams (Skype serviceArea with TCP ports 80,443 and has IPs property)
20+
$teamsEndpoint = $endpoints | Where-Object {
21+
$_.serviceArea -eq "Skype" -and $_.tcpPorts -eq "80,443" -and $_.ips
22+
}
23+
24+
if (-not $teamsEndpoint) {
25+
Write-Host "ERROR: Could not find Microsoft Teams endpoint with serviceArea='Skype', tcpPorts='80,443', and IPs defined" -ForegroundColor Red
26+
exit 1
27+
}
28+
29+
Write-Host "`nFound Microsoft Teams endpoint (ID: $($teamsEndpoint.id))" -ForegroundColor Green
30+
Write-Host "Service Area Display Name: $($teamsEndpoint.serviceAreaDisplayName)" -ForegroundColor Gray
31+
32+
# Separate IPv4 and IPv6 addresses
33+
$ipv4List = @()
34+
$ipv6List = @()
35+
36+
foreach ($ip in $teamsEndpoint.ips) {
37+
if ($ip -match ":") {
38+
# IPv6 (contains colons)
39+
$ipv6List += $ip
40+
} else {
41+
# IPv4
42+
$ipv4List += $ip
43+
}
44+
}
45+
46+
# Output results
47+
Write-Host "`n================================" -ForegroundColor Cyan
48+
Write-Host "RESULTS" -ForegroundColor Cyan
49+
Write-Host "================================" -ForegroundColor Cyan
50+
51+
Write-Host "`nIPv4 Ranges ($($ipv4List.Count) total):" -ForegroundColor Yellow
52+
$ipv4String = $ipv4List -join ","
53+
Write-Host $ipv4String -ForegroundColor White
54+
55+
Write-Host "`nIPv6 Ranges ($($ipv6List.Count) total):" -ForegroundColor Yellow
56+
$ipv6String = $ipv6List -join ","
57+
Write-Host $ipv6String -ForegroundColor White
58+
59+
# Export to variables for easy use
60+
Write-Host "`n================================" -ForegroundColor Cyan
61+
Write-Host "EXPORT VARIABLES" -ForegroundColor Cyan
62+
Write-Host "================================" -ForegroundColor Cyan
63+
64+
# Create output object
65+
$result = [PSCustomObject]@{
66+
IPv4CommaList = $ipv4String
67+
IPv6CommaList = $ipv6String
68+
IPv4Array = $ipv4List
69+
IPv6Array = $ipv6List
70+
TotalIPv4 = $ipv4List.Count
71+
TotalIPv6 = $ipv6List.Count
72+
ServiceAreaDisplayName = $teamsEndpoint.serviceAreaDisplayName
73+
EndpointId = $teamsEndpoint.id
74+
LastUpdated = Get-Date
75+
}
76+
77+
78+
# Return the result object
79+
return $result
80+
81+
} catch {
82+
Write-Host "ERROR: Failed to download or parse endpoints" -ForegroundColor Red
83+
Write-Host $_.Exception.Message -ForegroundColor Red
84+
exit 1
85+
}

ProxyAgent-CSharp/README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
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.
66

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

99
## This sample illustrates
1010
- How to connect an AI Foundry Agent to M365 Copilot
@@ -39,11 +39,12 @@ sequenceDiagram
3939
%% Flow
4040
U->>M: User prompt (e.g., "Create a report")
4141
M->>B: Activity (Message)
42-
B->>P: POST /api/messages (JWT)
42+
B->>P: POST /api/messages (Message)
43+
P->>B: 202 Accepted
44+
P-->>M: Start Streaming Session with information
4345
P->>A: POST /process { prompt }
4446
A-->>P: { content }
45-
P-->>B: sendActivity(content)
46-
B-->>M: Response
47+
P-->>M: Stream(content)
4748
M-->>U: Display result
4849
```
4950

@@ -725,9 +726,10 @@ Now that you have a working Stock Agent, you can:
725726
This project was built with contributions from:
726727
727728
- **[@ericsche](https://github.com/ericsche)** - Project Lead & Development
728-
- **[@DavidRoussel](https://github.com/DavidRoussel)** - Co-Author & Technical Contributions
729+
- **[@davrous](https://github.com/davrous)** - Co-Author & Technical Contributions
729730
- **[@MattB-msft](https://github.com/MattB-msft)** - Co-Author & Guidance
730731
- **[@garrytrinder](https://github.com/garrytrinder)** - ATK Guidance & Review
732+
- **[@andikrueger](https://github.com/andikrueger)** - Code Review & Testing
731733
732734
Special thanks to everyone who contributed to making this solution possible!
733735

0 commit comments

Comments
 (0)