Files
microsoft--agent-framework/dotnet/tests/CopilotStudio.IntegrationTests/Support/CopilotStudioConnectionSettings.cs
T
wehub-resource-sync db620d33df
CodeQL / Analyze (csharp) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
dotnet-build-and-test / dotnet-test-functions (push) Has been cancelled
dotnet-build-and-test / paths-filter (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Debug, windows-latest, net9.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net8.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-foundry-hosted-it (push) Has been cancelled
dotnet-build-and-test / dotnet-build-and-test-check (push) Has been cancelled
dotnet-build-and-test / Integration Test Report (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:39:25 +08:00

62 lines
2.4 KiB
C#

// 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;
/// <summary>
/// <see cref="ConnectionSettings"/> with additional properties to specify Application (Client) Id,
/// Tenant Id, and optionally the Application Client secret.
/// </summary>
internal sealed class CopilotStudioConnectionSettings : ConnectionSettings
{
/// <summary>
/// Application ID for creating the authentication for the connection
/// </summary>
public string AppClientId { get; }
/// <summary>
/// Application secret for creating the authentication for the connection
/// </summary>
public string? AppClientSecret { get; }
/// <summary>
/// Tenant ID for creating the authentication for the connection
/// </summary>
public string TenantId { get; }
/// <summary>
/// Use interactive or service connection for authentication.
/// Defaults to true, meaning interactive authentication will be used.
/// </summary>
public bool UseInteractiveAuthentication { get; set; } = true;
/// <summary>
/// Instantiate a new instance of the <see cref="CopilotStudioConnectionSettings"/> from provided settings.
/// </summary>
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;
}
/// <summary>
/// Instantiate a new instance of the <see cref="CopilotStudioConnectionSettings"/> from a configuration section.
/// </summary>
/// <param name="config"></param>
/// <exception cref="ArgumentException"></exception>
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)];
}
}