Skip to content

Commit 41d9069

Browse files
authored
2025 10 06 updates to developer journey samples (#325)
* Removes unnecessary SP URL checking * Updates
1 parent 2ba832f commit 41d9069

File tree

17 files changed

+61
-96
lines changed

17 files changed

+61
-96
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,3 +456,5 @@ override.tf.json
456456
# Ignore CLI configuration files
457457
.terraformrc
458458
terraform.rc
459+
samples/microsoft/developer-journey-stage-1-idea-to-prototype.md
460+
samples/microsoft/microsoft.sln

samples/microsoft/csharp/developer-journey-stage-1-idea-to-prototype/.env.template

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ MCP_SERVER_URL=https://learn.microsoft.com/api/mcp
88

99
# SharePoint Integration (Optional - requires additional setup)
1010
SHAREPOINT_RESOURCE_NAME=your-sharepoint-connection
11-
SHAREPOINT_SITE_URL=https://your-company.sharepoint.com/teams/your-site

samples/microsoft/csharp/developer-journey-stage-1-idea-to-prototype/Evaluate.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* - Provides foundation for governance and monitoring
1515
*/
1616

17+
#region evaluation_imports
1718
using Azure.AI.Projects;
1819
using Azure.AI.Agents.Models;
1920
using Azure.Identity;
@@ -23,6 +24,7 @@
2324
using System.Linq;
2425
using System.Threading.Tasks;
2526
using System.Text.Json;
27+
#endregion evaluation_imports
2628

2729
namespace ModernWorkplaceAssistant.Evaluation
2830
{
@@ -81,6 +83,7 @@ private static void LoadEnvironmentVariables()
8183
}
8284
}
8385

86+
#region evaluation_functions
8487
public async Task<List<EvaluationResult>> RunEvaluationAsync()
8588
{
8689
Console.WriteLine("🧪 Starting Modern Workplace Assistant Evaluation");
@@ -330,8 +333,10 @@ private async Task CleanupAgentAsync(Agent agent)
330333
Console.WriteLine($"⚠️ Cleanup warning: {ex.Message}");
331334
}
332335
}
336+
#endregion evaluation_functions
333337
}
334338

339+
#region evaluation_main
335340
// Entry point for evaluation
336341
public class EvaluationProgram
337342
{
@@ -354,4 +359,5 @@ public static async Task Main(string[] args)
354359
}
355360
}
356361
}
362+
#endregion evaluation_main
357363
}

samples/microsoft/csharp/developer-journey-stage-1-idea-to-prototype/Program.cs

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* 3. Combined guidance showing how policy requirements map to technical implementation
2121
*/
2222

23+
#region imports_and_setup
2324
using Azure.AI.Projects;
2425
using Azure.AI.Agents.Models;
2526
using Azure.Identity;
@@ -29,6 +30,7 @@
2930
using System.Linq;
3031
using System.Threading.Tasks;
3132
using System.Text.Json;
33+
#endregion imports_and_setup
3234

3335
namespace ModernWorkplaceAssistant
3436
{
@@ -111,6 +113,7 @@ private static void LoadEnvironmentVariables()
111113
}
112114
}
113115

116+
#region create_workplace_assistant
114117
/// <summary>
115118
/// Create a Modern Workplace Assistant combining internal and external knowledge.
116119
///
@@ -140,46 +143,26 @@ public static async Task<AgentConfiguration> CreateWorkplaceAssistantAsync()
140143
// - Internal process documentation
141144

142145
var sharepointResourceName = Environment.GetEnvironmentVariable("SHAREPOINT_RESOURCE_NAME");
143-
var sharepointSiteUrl = Environment.GetEnvironmentVariable("SHAREPOINT_SITE_URL");
144146

145147
Console.WriteLine("📁 Configuring SharePoint integration...");
146148
Console.WriteLine($" Connection: {sharepointResourceName}");
147-
Console.WriteLine($" Site URL: {sharepointSiteUrl}");
148149

149150
SharepointTool sharepointTool = null;
150151
try
151152
{
152153
// Attempt to retrieve pre-configured SharePoint connection
153154
var sharepointConnection = await projectClient.GetConnectionAsync(sharepointResourceName);
154-
var currentTarget = sharepointConnection?.Target ?? "N/A";
155-
156-
// Validate connection configuration (common preview issue)
157-
if (currentTarget == "_" || string.IsNullOrEmpty(currentTarget) || currentTarget == "N/A")
158-
{
159-
Console.WriteLine($"⚠️ SharePoint connection has invalid target: '{currentTarget}'");
160-
Console.WriteLine($" Expected: {sharepointSiteUrl}");
161-
Console.WriteLine(" 🔧 SOLUTION: Update connection target in Azure AI Foundry portal");
162-
Console.WriteLine(" 1. Go to Management Center > Connected Resources");
163-
Console.WriteLine($" 2. Edit '{sharepointResourceName}' connection");
164-
Console.WriteLine($" 3. Set target URL to: {sharepointSiteUrl}");
165-
sharepointTool = null;
166-
}
167-
else
168-
{
169-
sharepointTool = new SharepointTool(sharepointConnection.Id);
170-
Console.WriteLine("✅ SharePoint successfully connected");
171-
Console.WriteLine($" Active target: {currentTarget}");
172-
}
155+
sharepointTool = new SharepointTool(sharepointConnection.Id);
156+
Console.WriteLine("✅ SharePoint successfully connected");
173157
}
174158
catch (Exception ex)
175159
{
176160
// Graceful degradation - system continues without SharePoint
177161
Console.WriteLine($"⚠️ SharePoint connection failed: {ex.Message}");
178162
Console.WriteLine(" Agent will operate in technical guidance mode only");
179163
Console.WriteLine(" 📝 To enable full functionality:");
180-
Console.WriteLine(" 1. Create SharePoint connection in Azure AI Foundry portal");
181-
Console.WriteLine($" 2. Connection name: {sharepointResourceName}");
182-
Console.WriteLine($" 3. Site URL: {sharepointSiteUrl}");
164+
Console.WriteLine(" Create SharePoint connection in Azure AI Foundry portal");
165+
Console.WriteLine($" Connection name: {sharepointResourceName}");
183166
sharepointTool = null;
184167
}
185168

@@ -278,7 +261,9 @@ public static async Task<AgentConfiguration> CreateWorkplaceAssistantAsync()
278261
SharepointTool = sharepointTool
279262
};
280263
}
264+
#endregion create_workplace_assistant
281265

266+
#region demonstrate_business_scenarios
282267
/// <summary>
283268
/// Demonstrate realistic business scenarios combining internal and external knowledge.
284269
///
@@ -485,7 +470,9 @@ public static async Task InteractiveModeAsync(AgentConfiguration config)
485470

486471
Console.WriteLine("\n👋 Thank you for testing the Modern Workplace Assistant!");
487472
}
473+
#endregion demonstrate_business_scenarios
488474

475+
#region main
489476
/// <summary>
490477
/// Main execution flow demonstrating the complete sample.
491478
///
@@ -527,5 +514,6 @@ public static async Task Main(string[] args)
527514
Environment.Exit(1);
528515
}
529516
}
517+
#endregion main
530518
}
531519
}

samples/microsoft/csharp/developer-journey-stage-1-idea-to-prototype/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ AI_FOUNDRY_TENANT_ID=your-tenant-id
6767

6868
# SharePoint Integration
6969
SHAREPOINT_RESOURCE_NAME=Benefits
70-
SHAREPOINT_SITE_URL=https://yourtenant.sharepoint.com/sites/benefits
7170

7271
# Microsoft Learn MCP Server
7372
MCP_SERVER_URL=https://learn.microsoft.com/api/mcp

samples/microsoft/java/developer-journey-stage-1-idea-to-prototype/.env.template

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ MCP_SERVER_URL=https://learn.microsoft.com/api/mcp
88

99
# SharePoint Integration (Optional - requires additional setup)
1010
SHAREPOINT_RESOURCE_NAME=your-sharepoint-connection
11-
SHAREPOINT_SITE_URL=https://your-company.sharepoint.com/teams/your-site

samples/microsoft/java/developer-journey-stage-1-idea-to-prototype/Evaluate.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ private static List<TestQuestion> getDefaultTestQuestions() {
178178
* - Demonstrates business-relevant quality metrics
179179
* - Provides foundation for governance and monitoring
180180
*/
181+
//#region evaluation_functions
181182
public static EvaluationResult evaluateResponse(TestQuestion question, String response, long responseTimeMs) {
182183
EvaluationResult result = new EvaluationResult();
183184
result.question = question.question;
@@ -507,6 +508,7 @@ private static void generateEvaluationReport(List<EvaluationResult> results) {
507508

508509
System.out.println("\n" + "=".repeat(60));
509510
}
511+
//#endregion evaluation_functions
510512

511513
public static void main(String[] args) {
512514
runEvaluation();

samples/microsoft/java/developer-journey-stage-1-idea-to-prototype/Main.java

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* 3. Combined guidance showing how policy requirements map to technical implementation
2121
*/
2222

23+
//#region imports_and_setup
2324
import com.azure.ai.projects.AIProjectClient;
2425
import com.azure.ai.projects.AIProjectClientBuilder;
2526
import com.azure.ai.agents.models.*;
@@ -30,6 +31,7 @@
3031
import java.nio.file.Paths;
3132
import java.util.*;
3233
import java.util.stream.Collectors;
34+
//#endregion imports_and_setup
3335

3436
public class Main {
3537

@@ -108,6 +110,7 @@ private static void setupAuthentication() {
108110
*
109111
* @return AgentConfiguration containing agent and tool information
110112
*/
113+
//#region create_workplace_assistant
111114
public static AgentConfiguration createWorkplaceAssistant() {
112115
System.out.println("🤖 Creating Modern Workplace Assistant...");
113116

@@ -121,41 +124,24 @@ public static AgentConfiguration createWorkplaceAssistant() {
121124
// - Internal process documentation
122125

123126
String sharepointResourceName = config.getProperty("SHAREPOINT_RESOURCE_NAME");
124-
String sharepointSiteUrl = config.getProperty("SHAREPOINT_SITE_URL");
125127

126128
System.out.println("📁 Configuring SharePoint integration...");
127129
System.out.println(" Connection: " + sharepointResourceName);
128-
System.out.println(" Site URL: " + sharepointSiteUrl);
129130

130131
SharepointTool sharepointTool = null;
131132
try {
132133
// Attempt to retrieve pre-configured SharePoint connection
133134
var sharepointConnection = projectClient.getConnections().get(sharepointResourceName);
134-
String currentTarget = sharepointConnection.getTarget();
135-
136-
// Validate connection configuration (common preview issue)
137-
if ("_".equals(currentTarget) || currentTarget == null || "N/A".equals(currentTarget)) {
138-
System.out.println("⚠️ SharePoint connection has invalid target: '" + currentTarget + "'");
139-
System.out.println(" Expected: " + sharepointSiteUrl);
140-
System.out.println(" 🔧 SOLUTION: Update connection target in Azure AI Foundry portal");
141-
System.out.println(" 1. Go to Management Center > Connected Resources");
142-
System.out.println(" 2. Edit '" + sharepointResourceName + "' connection");
143-
System.out.println(" 3. Set target URL to: " + sharepointSiteUrl);
144-
sharepointTool = null;
145-
} else {
146-
sharepointTool = new SharepointTool(sharepointConnection.getId());
147-
System.out.println("✅ SharePoint successfully connected");
148-
System.out.println(" Active target: " + currentTarget);
149-
}
135+
sharepointTool = new SharepointTool(sharepointConnection.getId());
136+
System.out.println("✅ SharePoint successfully connected");
150137

151138
} catch (Exception e) {
152139
// Graceful degradation - system continues without SharePoint
153140
System.out.println("⚠️ SharePoint connection failed: " + e.getMessage());
154141
System.out.println(" Agent will operate in technical guidance mode only");
155142
System.out.println(" 📝 To enable full functionality:");
156-
System.out.println(" 1. Create SharePoint connection in Azure AI Foundry portal");
157-
System.out.println(" 2. Connection name: " + sharepointResourceName);
158-
System.out.println(" 3. Site URL: " + sharepointSiteUrl);
143+
System.out.println(" Create SharePoint connection in Azure AI Foundry portal");
144+
System.out.println(" Connection name: " + sharepointResourceName);
159145
sharepointTool = null;
160146
}
161147

samples/microsoft/java/developer-journey-stage-1-idea-to-prototype/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ AI_FOUNDRY_TENANT_ID=your-tenant-id
6666

6767
# SharePoint Integration
6868
SHAREPOINT_RESOURCE_NAME=Benefits
69-
SHAREPOINT_SITE_URL=https://yourtenant.sharepoint.com/sites/benefits
7069

7170
# Microsoft Learn MCP Server
7271
MCP_SERVER_URL=https://learn.microsoft.com/api/mcp

samples/microsoft/python/developer-journey-stage-1-idea-to-prototype/.env.template

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ MCP_SERVER_URL=https://learn.microsoft.com/api/mcp
88

99
# SharePoint Integration (Optional - requires additional setup)
1010
SHAREPOINT_RESOURCE_NAME=your-sharepoint-connection
11-
SHAREPOINT_SITE_URL=https://your-company.sharepoint.com/teams/your-site

0 commit comments

Comments
 (0)