// Copyright (c) Microsoft. All rights reserved. using System; using Microsoft.Agents.CopilotStudio.Client; using Microsoft.Agents.CopilotStudio.Client.Discovery; using Microsoft.Extensions.Configuration; namespace CopilotStudio.IntegrationTests.Support; /// /// with additional properties to specify Application (Client) Id, /// Tenant Id, and optionally the Application Client secret. /// internal sealed class CopilotStudioConnectionSettings : ConnectionSettings { /// /// Application ID for creating the authentication for the connection /// public string AppClientId { get; } /// /// Application secret for creating the authentication for the connection /// public string? AppClientSecret { get; } /// /// Tenant ID for creating the authentication for the connection /// public string TenantId { get; } /// /// Use interactive or service connection for authentication. /// Defaults to true, meaning interactive authentication will be used. /// public bool UseInteractiveAuthentication { get; set; } = true; /// /// Instantiate a new instance of the from provided settings. /// public CopilotStudioConnectionSettings(string tenantId, string appClientId, string? appClientSecret = null) { this.TenantId = tenantId; this.AppClientId = appClientId; this.AppClientSecret = appClientSecret; this.Cloud = PowerPlatformCloud.Prod; this.CopilotAgentType = AgentType.Published; } /// /// Instantiate a new instance of the from a configuration section. /// /// /// public CopilotStudioConnectionSettings(IConfigurationSection config) : base(config) { this.AppClientId = config[nameof(this.AppClientId)] ?? throw new ArgumentException($"{nameof(this.AppClientId)} not found in config"); this.TenantId = config[nameof(this.TenantId)] ?? throw new ArgumentException($"{nameof(this.TenantId)} not found in config"); this.AppClientSecret = config[nameof(this.AppClientSecret)]; } }