Skip to content

Commit f09ed4c

Browse files
committed
Respond to comments
1 parent f5e1cae commit f09ed4c

File tree

11 files changed

+207
-157
lines changed

11 files changed

+207
-157
lines changed

src/DEVELOPER.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,38 @@ For security and flexibility, the CLI supports environment variable overrides fo
466466
export POWERPLATFORM_API_URL=https://api.custom.powerplatform.example.com
467467
```
468468

469+
6. **Create endpoint URL**:
470+
```bash
471+
# Override create endpoint URL (for custom environments)
472+
# Internal use only - for non-production Microsoft environments
473+
export A365_CREATE_ENDPOINT_URL_STAGING=https://staging.agent365.example.com/agents/createAgentBlueprint
474+
export A365_CREATE_ENDPOINT_URL_CUSTOM=https://custom.agent365.example.com/agents/deleteAgentBlueprint
475+
```
476+
477+
7. **Delete endpoint URL**:
478+
```bash
479+
# Override delete endpoint URL (for custom environments)
480+
# Internal use only - for non-production Microsoft environments
481+
export A365_DELETE_ENDPOINT_URL_STAGING=https://staging.agent365.example.com/agents/deleteAgentBlueprint
482+
export A365_DELETE_ENDPOINT_URL_CUSTOM=https://custom.agent365.example.com/agents/deleteAgentBlueprint
483+
```
484+
485+
8. **Endpoint deployment Environment**:
486+
```bash
487+
# Override endpoint deployment environment (for custom environments)
488+
# Internal use only - for non-production Microsoft environments
489+
export A365_DEPLOYMENT_ENVIRONMENT_STAGING=staging
490+
export A365_DEPLOYMENT_ENVIRONMENT_CUSTOM=custom
491+
```
492+
493+
9. **Endpoint cluster category**:
494+
```bash
495+
# Override endpoint cluster category (for custom environments)
496+
# Internal use only - for non-production Microsoft environments
497+
export A365_CLUSTER_CATEGORY_STAGING=staging
498+
export A365_CLUSTER_CATEGORY_CUSTOM=custom
499+
```
500+
469501
**Implementation Pattern**:
470502

471503
**ConfigConstants.cs** (Per-environment with suffix):

src/Microsoft.Agents.A365.DevTools.Cli/Commands/CleanupCommand.cs

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.CommandLine;
55
using System.Text.Json;
66
using Microsoft.Extensions.Logging;
7+
using Microsoft.Agents.A365.DevTools.Cli.Services.Helpers;
78
using Microsoft.Agents.A365.DevTools.Cli.Services;
89
using Microsoft.Agents.A365.DevTools.Cli.Models;
910

@@ -145,11 +146,11 @@ private static Command CreateAzureCleanupCommand(
145146
logger.LogInformation("");
146147
logger.LogInformation("Azure Cleanup Preview:");
147148
logger.LogInformation("=========================");
148-
logger.LogInformation(" Web App: {WebAppName}", config.WebAppName);
149-
logger.LogInformation(" App Service Plan: {PlanName}", config.AppServicePlanName);
149+
logger.LogInformation(" Web App: {WebAppName}", config.WebAppName);
150+
logger.LogInformation(" App Service Plan: {PlanName}", config.AppServicePlanName);
150151
if (!string.IsNullOrEmpty(config.BotId))
151-
logger.LogInformation(" Azure Bot: {BotId}", config.BotId);
152-
logger.LogInformation(" Resource Group: {ResourceGroup}", config.ResourceGroup);
152+
logger.LogInformation(" Azure Bot: {BotId}", config.BotId);
153+
logger.LogInformation(" Resource Group: {ResourceGroup}", config.ResourceGroup);
153154
logger.LogInformation("");
154155

155156
Console.Write("Continue with Azure cleanup? (y/N): ");
@@ -173,22 +174,21 @@ private static Command CreateAzureCleanupCommand(
173174
logger.LogInformation("Deleting messaging endpoint registration...");
174175
if (string.IsNullOrEmpty(config.AgentBlueprintId))
175176
{
176-
logger.LogError("Agent Blueprint ID not found.");
177-
throw new InvalidOperationException("Agent Blueprint ID is required for deleting endpoint registration");
177+
logger.LogError("Agent Blueprint ID not found. Agent Blueprint ID is required for deleting endpoint registration.");
178178
}
179+
else
180+
{
181+
var endpointName = EndpointHelper.GetEndpointName(config.BotName);
179182

180-
var endpointName = config.BotName.Length > 42
181-
? config.BotName.Substring(0, 42)
182-
: config.BotName;
183+
var endpointRegistered = await botConfigurator.DeleteEndpointWithAgentBlueprintAsync(
184+
endpointName,
185+
config.Location,
186+
config.AgentBlueprintId);
183187

184-
var endpointRegistered = await botConfigurator.DeleteEndpointWithAgentBlueprintAsync(
185-
config.BotName,
186-
config.Location,
187-
config.AgentBlueprintId);
188-
189-
if (!endpointRegistered)
190-
{
191-
logger.LogWarning("Failed to delete blueprint messaging endpoint");
188+
if (!endpointRegistered)
189+
{
190+
logger.LogWarning("Failed to delete blueprint messaging endpoint");
191+
}
192192
}
193193
}
194194

@@ -252,10 +252,10 @@ private static Command CreateInstanceCleanupCommand(
252252
logger.LogInformation("Will delete the following resources:");
253253

254254
if (!string.IsNullOrEmpty(config.AgenticAppId))
255-
logger.LogInformation(" Agent Identity Application: {IdentityId}", config.AgenticAppId);
255+
logger.LogInformation(" Agent Identity Application: {IdentityId}", config.AgenticAppId);
256256
if (!string.IsNullOrEmpty(config.AgenticUserId))
257-
logger.LogInformation(" Agent User: {UserId}", config.AgenticUserId);
258-
logger.LogInformation(" Generated configuration file");
257+
logger.LogInformation(" Agent User: {UserId}", config.AgenticUserId);
258+
logger.LogInformation(" Generated configuration file");
259259
logger.LogInformation("");
260260

261261
Console.Write("Continue with instance cleanup? (y/N): ");
@@ -356,18 +356,18 @@ private static async Task ExecuteAllCleanupAsync(
356356
logger.LogInformation("============================");
357357
logger.LogInformation("WARNING: ALL RESOURCES WILL BE DELETED:");
358358
if (!string.IsNullOrEmpty(config.AgentBlueprintId))
359-
logger.LogInformation(" Blueprint Application: {BlueprintId}", config.AgentBlueprintId);
359+
logger.LogInformation(" Blueprint Application: {BlueprintId}", config.AgentBlueprintId);
360360
if (!string.IsNullOrEmpty(config.AgenticAppId))
361-
logger.LogInformation(" Agent Identity Application: {IdentityId}", config.AgenticAppId);
361+
logger.LogInformation(" Agent Identity Application: {IdentityId}", config.AgenticAppId);
362362
if (!string.IsNullOrEmpty(config.AgenticUserId))
363-
logger.LogInformation(" Agent User: {UserId}", config.AgenticUserId);
363+
logger.LogInformation(" Agent User: {UserId}", config.AgenticUserId);
364364
if (!string.IsNullOrEmpty(config.WebAppName))
365-
logger.LogInformation(" Web App: {WebAppName}", config.WebAppName);
365+
logger.LogInformation(" Web App: {WebAppName}", config.WebAppName);
366366
if (!string.IsNullOrEmpty(config.AppServicePlanName))
367-
logger.LogInformation(" App Service Plan: {PlanName}", config.AppServicePlanName);
367+
logger.LogInformation(" App Service Plan: {PlanName}", config.AppServicePlanName);
368368
if (!string.IsNullOrEmpty(config.BotName))
369-
logger.LogInformation(" Azure Messaging Endpoint: {BotName}", config.BotName);
370-
logger.LogInformation(" Generated configuration file");
369+
logger.LogInformation(" Azure Messaging Endpoint: {BotName}", config.BotName);
370+
logger.LogInformation(" Generated configuration file");
371371
logger.LogInformation("");
372372

373373
Console.Write("Are you sure you want to DELETE ALL resources? (y/N): ");
@@ -423,18 +423,21 @@ private static async Task ExecuteAllCleanupAsync(
423423
logger.LogInformation("Deleting messaging endpoint registration...");
424424
if (string.IsNullOrEmpty(config.AgentBlueprintId))
425425
{
426-
logger.LogError("Agent Blueprint ID not found.");
427-
throw new InvalidOperationException("Agent Blueprint ID is required for deleting endpoint registration");
426+
logger.LogError("Agent Blueprint ID not found. Agent Blueprint ID is required for deleting endpoint registration.");
428427
}
429-
430-
var endpointRegistered = await botConfigurator.DeleteEndpointWithAgentBlueprintAsync(
431-
config.BotName,
432-
config.Location,
433-
config.AgentBlueprintId);
434-
435-
if (!endpointRegistered)
428+
else
436429
{
437-
logger.LogWarning("Failed to delete blueprint messaging endpoint");
430+
var endpointName = EndpointHelper.GetEndpointName(config.BotName);
431+
432+
var endpointRegistered = await botConfigurator.DeleteEndpointWithAgentBlueprintAsync(
433+
endpointName,
434+
config.Location,
435+
config.AgentBlueprintId);
436+
437+
if (!endpointRegistered)
438+
{
439+
logger.LogWarning("Failed to delete blueprint messaging endpoint");
440+
}
438441
}
439442
}
440443

src/Microsoft.Agents.A365.DevTools.Cli/Commands/CreateInstanceCommand.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Microsoft.Agents.A365.DevTools.Cli.Helpers;
66
using Microsoft.Agents.A365.DevTools.Cli.Models;
77
using Microsoft.Agents.A365.DevTools.Cli.Services;
8+
using Microsoft.Agents.A365.DevTools.Cli.Services.Helpers;
89
using Microsoft.Extensions.Logging;
910
using System.CommandLine;
1011
using System.Text.Json;
@@ -176,9 +177,7 @@ public static Command CreateCommand(ILogger<CreateInstanceCommand> logger, IConf
176177
string? agenticAppId = instanceConfig.AgenticAppId;
177178
string? agenticUserId = instanceConfig.AgenticUserId;
178179
var baseEndpointName = $"{instanceConfig.WebAppName}-endpoint";
179-
var endpointName = baseEndpointName.Length > 42
180-
? baseEndpointName.Substring(0, 42)
181-
: baseEndpointName;
180+
var endpointName = EndpointHelper.GetEndpointName(baseEndpointName);
182181

183182
if (File.Exists(agentUserConfigPath))
184183
{

src/Microsoft.Agents.A365.DevTools.Cli/Commands/PublishCommand.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,16 @@ public static Command CreateCommand(
216216
logger.LogInformation("Your manifest has been updated at: {ManifestPath}", manifestPath);
217217
logger.LogInformation("");
218218
logger.LogInformation("Please customize these fields before publishing:");
219-
logger.LogInformation(" Version ('version'): Increment for republishing (e.g., 1.0.0 to 1.0.1)");
219+
logger.LogInformation(" Version ('version'): Increment for republishing (e.g., 1.0.0 to 1.0.1)");
220220
logger.LogInformation(" REQUIRED: Must be higher than previously published version");
221-
logger.LogInformation(" Agent Name ('name.short' and 'name.full'): Make it descriptive and user-friendly");
221+
logger.LogInformation(" Agent Name ('name.short' and 'name.full'): Make it descriptive and user-friendly");
222222
logger.LogInformation(" Currently: {Name}", agentBlueprintDisplayName);
223223
logger.LogInformation(" IMPORTANT: 'name.short' must be 30 characters or less");
224-
logger.LogInformation(" Descriptions ('description.short' and 'description.full'): Explain what your agent does");
224+
logger.LogInformation(" Descriptions ('description.short' and 'description.full'): Explain what your agent does");
225225
logger.LogInformation(" Short: 1-2 sentences, Full: Detailed capabilities");
226-
logger.LogInformation(" Developer Info ('developer.name', 'developer.websiteUrl', 'developer.privacyUrl')");
226+
logger.LogInformation(" Developer Info ('developer.name', 'developer.websiteUrl', 'developer.privacyUrl')");
227227
logger.LogInformation(" Should reflect your organization details");
228-
logger.LogInformation(" Icons: Replace 'color.png' and 'outline.png' with your custom branding");
228+
logger.LogInformation(" Icons: Replace 'color.png' and 'outline.png' with your custom branding");
229229
logger.LogInformation("");
230230
logger.LogInformation("When you're done customizing, type 'continue' (or 'c') and press Enter to proceed:");
231231

src/Microsoft.Agents.A365.DevTools.Cli/Commands/QueryEntraCommand.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,19 +141,19 @@ private static Command CreateBlueprintScopesSubcommand(
141141
var individualScopes = scopeValue.Split(' ', StringSplitOptions.RemoveEmptyEntries);
142142
foreach (var individualScope in individualScopes)
143143
{
144-
logger.LogInformation(" {Scope}", individualScope);
144+
logger.LogInformation(" {Scope}", individualScope);
145145
}
146146
}
147147
}
148148
}
149149
else
150150
{
151-
logger.LogInformation(" No inheritable scopes found");
151+
logger.LogInformation(" No inheritable scopes found");
152152
}
153153
}
154154
else
155155
{
156-
logger.LogInformation(" No inheritable scopes configuration found");
156+
logger.LogInformation(" No inheritable scopes configuration found");
157157
}
158158

159159
logger.LogInformation("");
@@ -342,7 +342,7 @@ private static Command CreateInstanceScopesSubcommand(
342342
}
343343
else
344344
{
345-
logger.LogInformation(" No specific scopes granted");
345+
logger.LogInformation(" No specific scopes granted");
346346
}
347347
logger.LogInformation("");
348348
}
@@ -356,8 +356,8 @@ private static Command CreateInstanceScopesSubcommand(
356356

357357
if (!hasGrants)
358358
{
359-
logger.LogInformation(" No OAuth2 permission grants found");
360-
logger.LogInformation(" This means admin consent has not been granted for any API permissions");
359+
logger.LogInformation(" No OAuth2 permission grants found");
360+
logger.LogInformation(" This means admin consent has not been granted for any API permissions");
361361
logger.LogInformation("");
362362
logger.LogInformation("To grant admin consent:");
363363
logger.LogInformation(" 1. Visit the Azure portal: https://portal.azure.com");

src/Microsoft.Agents.A365.DevTools.Cli/Commands/SetupCommand.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Microsoft.Agents.A365.DevTools.Cli.Helpers;
66
using Microsoft.Agents.A365.DevTools.Cli.Models;
77
using Microsoft.Agents.A365.DevTools.Cli.Services;
8+
using Microsoft.Agents.A365.DevTools.Cli.Services.Helpers;
89
using Microsoft.Extensions.Logging;
910
using System.CommandLine;
1011
using System.Text.Json;
@@ -410,9 +411,7 @@ private static async Task RegisterBlueprintMessagingEndpointAsync(
410411

411412
// Generate endpoint name with Azure Bot Service constraints (4-42 chars)
412413
var baseEndpointName = $"{setupConfig.WebAppName}-endpoint";
413-
var endpointName = baseEndpointName.Length > 42
414-
? baseEndpointName.Substring(0, 42)
415-
: baseEndpointName;
414+
var endpointName = EndpointHelper.GetEndpointName(baseEndpointName);
416415
if (endpointName.Length < 4)
417416
{
418417
logger.LogError("Bot endpoint name '{EndpointName}' is too short (must be at least 4 characters)", endpointName);

src/Microsoft.Agents.A365.DevTools.Cli/Constants/ConfigConstants.cs

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -117,76 +117,4 @@ public static string GetAgent365ToolsResourceAppId(string environment)
117117
_ => McpConstants.Agent365ToolsProdAppId
118118
};
119119
}
120-
121-
/// <summary>
122-
/// Get create endpoint URL based on environment
123-
/// </summary>
124-
public static string GetCreateEndpointUrl(string environment)
125-
{
126-
// Check for custom endpoint in environment variable first
127-
var customEndpoint = Environment.GetEnvironmentVariable($"A365_CREATE_ENDPOINT_{environment?.ToUpper()}");
128-
if (!string.IsNullOrEmpty(customEndpoint))
129-
return customEndpoint;
130-
131-
// Default to production endpoint
132-
return environment?.ToLower() switch
133-
{
134-
"prod" => ProductionCreateEndpointUrl,
135-
_ => ProductionCreateEndpointUrl
136-
};
137-
}
138-
139-
/// <summary>
140-
/// Get delete endpoint URL based on environment
141-
/// </summary>
142-
public static string GetDeleteEndpointUrl(string environment)
143-
{
144-
// Check for custom endpoint in environment variable first
145-
var customEndpoint = Environment.GetEnvironmentVariable($"A365_DELETE_ENDPOINT_{environment?.ToUpper()}");
146-
if (!string.IsNullOrEmpty(customEndpoint))
147-
return customEndpoint;
148-
149-
// Default to production endpoint
150-
return environment?.ToLower() switch
151-
{
152-
"prod" => ProductionDeleteEndpointUrl,
153-
_ => ProductionDeleteEndpointUrl
154-
};
155-
}
156-
157-
/// <summary>
158-
/// Get deployment environment based on environment
159-
/// </summary>
160-
public static string GetDeploymentEnvironment(string environment)
161-
{
162-
// Check for custom deployment environment in environment variable first
163-
var customDeploymentEnvironment = Environment.GetEnvironmentVariable($"A365_DEPLOYMENT_ENVIRONMENT_{environment?.ToUpper()}");
164-
if (!string.IsNullOrEmpty(customDeploymentEnvironment))
165-
return customDeploymentEnvironment;
166-
167-
// Default to production deployment environment
168-
return environment?.ToLower() switch
169-
{
170-
"prod" => ProductionDeploymentEnvironment,
171-
_ => ProductionDeploymentEnvironment
172-
};
173-
}
174-
175-
/// <summary>
176-
/// Get cluster category based on environment
177-
/// </summary>
178-
public static string GetClusterCategory(string environment)
179-
{
180-
// Check for custom cluster category in environment variable first
181-
var customClusterCategory = Environment.GetEnvironmentVariable($"A365_CLUSTER_CATEGORY_{environment?.ToUpper()}");
182-
if (!string.IsNullOrEmpty(customClusterCategory))
183-
return customClusterCategory;
184-
185-
// Default to production cluster category
186-
return environment?.ToLower() switch
187-
{
188-
"prod" => ProductionClusterCategory,
189-
_ => ProductionClusterCategory
190-
};
191-
}
192120
}

0 commit comments

Comments
 (0)