### Start Agents Playground Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/EmptyAgent/README.md Starts the Agents Playground application from the command line, which opens a web interface for testing agents. ```bash agentsplayground ``` -------------------------------- ### Install Agents Playground Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/DialogAgent/README.md Installs the Agents Playground tool using the Windows Package Manager (winget). This tool is used for interacting with and testing agents. ```bash winget install agentsplayground ``` -------------------------------- ### Register Agent with Azure Bot Service Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/CopilotStudioEchoSkill/wwwroot/default.htm Guides users on registering their agent with Azure Bot Service to deploy it to various channels. It also shows the typical endpoint URL format. ```html Visit [Azure Bot Service](https://aka.ms/bot-framework-F5-abs-home) to register your agent and add it to various channels. The agent's endpoint URL typically looks like this: https://_your_agents_hostname_/api/messages ``` -------------------------------- ### Start Copilot Conversation with CopilotClient Source: https://github.com/microsoft/agents-for-net/blob/main/src/libraries/Client/Microsoft.Agents.CopilotStudio.Client/README.md This snippet shows how to create an instance of the CopilotClient and initiate a conversation asynchronously. It utilizes an IHttpClientFactory for HTTP requests and logs activities. ```csharp var copilotClient = new CopilotClient(settings, s.GetRequiredService(), logger, "mcs"); await foreach (Activity act in copilotClient.StartConversationAsync(emitStartConversationEvent:true, cancellationToken:cancellationToken)) { } ``` -------------------------------- ### Configure Copilot Studio Client Settings (JSON) Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/CopilotStudioClient/CopilotStudioClient/README.md Configuration settings for the Copilot Studio Client Sample, including Environment ID, Schema Name, Tenant ID, and App Client ID. These values are obtained during the setup and application registration process. ```json { "CopilotStudioClientSettings": { "EnvironmentId": "", // Environment ID of environment with the CopilotStudio App. "SchemaName": "", // Schema Name of the Copilot to use "TenantId": "", // Tenant ID of the App Registration used to login, this should be in the same tenant as the Copilot. "AppClientId": "" // App ID of the App Registration used to login, this should be in the same tenant as the Copilot. } } ``` -------------------------------- ### Provide Token Service to CopilotClient Source: https://github.com/microsoft/agents-for-net/blob/main/src/libraries/Client/Microsoft.Agents.CopilotStudio.Client/README.md This example demonstrates how to pass a token provider function to the CopilotClient constructor. The `TokenService` class is responsible for acquiring and returning access tokens, which is crucial for authenticated communication. ```csharp var tokenService = new TokenService(settings); var copilotClient = new CopilotClient(settings, s.GetRequiredService(), tokenService.GetToken, logger, "mcs"); await foreach (Activity act in copilotClient.StartConversationAsync(emitStartConversationEvent:true, cancellationToken:cancellationToken)) { } ``` -------------------------------- ### Update Teams Manifest Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/Authorization/README.md This example shows how to manually update the `manifest.json` file for a Teams application. It requires replacing placeholder strings for the App ID and Agent domain with actual values before zipping and uploading the manifest. ```json { // ... other manifest properties "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.16/MicrosoftTeams.schema.json", "manifestVersion": "1.16", "packageName": "YourPackageName", "id": "<>", "version": "1.0.0", "name": { "short": "YourAgentName", "full": "YourAgentFullName" }, "description": { "short": "Short description of your agent.", "full": "Full description of your agent." }, "icons": { "color": "path/to/color_icon.png", "outline": "path/to/outline_icon.png" }, "accentColor": "#FFFFFF", "developer": { "name": "YourCompany", "websiteUrl": "YourWebsiteUrl", "privacyUrl": "YourPrivacyUrl", "termsOfUseUrl": "YourTermsOfUseUrl" }, "configurableTabs": [], "bots": [ { "botId": "<>", "scopes": [ "personal", "team", "groupchat" ], "supportsPersonalChat": true, "supportsTeam": true, "supportsGroupChat": true, "isGroupChatEnabled": true } ], "permissions": { "resourceSpecificTypes": [ { "name": "ChannelTab", "teamsSubchanneldeepLink": true } ] }, "webApplicationInfo": { "id": "<>", "resource": "<>" } // ... other manifest properties } ``` -------------------------------- ### MSAL Authentication Configuration Example Source: https://github.com/microsoft/agents-for-net/blob/main/src/libraries/Authentication/Authentication.Msal/README.md Demonstrates the JSON configuration for authenticating with MSAL using a client secret. It specifies the authority endpoint, client ID, client secret, and required scopes for token acquisition. ```json { "Connections": { "ServiceConnection": { "Settings": { "AuthType": "ClientSecret", "AuthorityEndpoint": "https://login.microsoftonline.com/{{TenantId}}", "ClientId": "00000000-0000-0000-0000-000000000000", "ClientSecret": "00000000-0000-0000-0000-000000000000", "Scopes": [ "https://api.botframework.com/.default" ] } } } } ``` -------------------------------- ### IRC DCC SEND Command for Keylogger Source: https://github.com/microsoft/agents-for-net/blob/main/src/tests/Microsoft.Agents.Builder.Dialogs.Tests/Resources/naughtyStrings.txt This string is an example of an IRC DCC SEND command that could be used to transfer a keylogger. Security products might flag this pattern. ```irc DCC SEND STARTKEYLOGGER 0 0 0 ``` -------------------------------- ### Command Injection (Ruby): System Command Execution Source: https://github.com/microsoft/agents-for-net/blob/main/src/tests/Microsoft.Agents.Builder.Dialogs.Tests/Resources/naughtyStrings.txt Provides examples of Command Injection vulnerabilities specifically within Ruby/Rails applications. These payloads leverage Ruby's methods for executing system commands. ```ruby eval("puts 'hello world'") ``` ```ruby System("ls -al /") ``` ```ruby `ls -al /` ``` ```ruby Kernel.exec("ls -al /") ``` ```ruby Kernel.exit(1) ``` ```ruby %x('ls -al /') ``` -------------------------------- ### Server Code Injection: Shell Command Execution Source: https://github.com/microsoft/agents-for-net/blob/main/src/tests/Microsoft.Agents.Builder.Dialogs.Tests/Resources/naughtyStrings.txt Contains payloads for Server Code Injection, aiming to execute arbitrary commands on the server. These examples use shell metacharacters and environment variables to achieve command execution. ```bash - ``` ```bash --version ``` ```bash --help ``` ```bash $USER ``` ```bash /dev/null; touch /tmp/blns.fail ; echo ``` ```bash `touch /tmp/blns.fail` ``` ```bash $(touch /tmp/blns.fail) ``` ```bash @{[system "touch /tmp/blns.fail"]} ``` -------------------------------- ### XSS: Various HTML/Attribute-based Payloads Source: https://github.com/microsoft/agents-for-net/blob/main/src/tests/Microsoft.Agents.Builder.Dialogs.Tests/Resources/naughtyStrings.txt Demonstrates Cross-Site Scripting (XSS) vulnerabilities through various HTML tag manipulations and attribute injections. These examples often involve non-standard character encoding, whitespace, or syntax variations to bypass filters. ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html ``` ```html XXX ``` ```html ``` ```html ``` ```html ``` ```html <a href=http://foo.bar/#x=`y></a><img alt="`><img src=x:x onerror=javascript:alert(1)></a>"> ``` ```html <!--[if]><script>javascript:alert(1)</script --> ``` ```html <!--[if<img src=x onerror=javascript:alert(1)//]> --> ``` ```html <script src="/\%(jscript)s"></script> ``` ```html <script src="\\%(jscript)s"></script> ``` ```html <IMG """<SCRIPT>alert("XSS")</SCRIPT>"> ``` ```html <IMG SRC=javascript:alert(String.fromCharCode(88,83,83))> ``` ```html <IMG SRC=# onmouseover="alert('xxs')"> ``` ```html <IMG SRC= onmouseover="alert('xxs')"> ``` ```html <IMG onmouseover="alert('xxs')"> ``` ```html <IMG SRC=javascript:alert('XSS')> ``` ```html <IMG SRC=javascript:alert('XSS')> ``` ```html <IMG SRC=javascript:alert('XSS')> ``` ```html <IMG SRC="jav ascript:alert('XSS');"> ``` ```html <IMG SRC="jav ascript:alert('XSS');"> ``` ```html <IMG SRC="jav ascript:alert('XSS');"> ``` ```html <IMG SRC="jav ascript:alert('XSS');"> ``` ```html <IMG SRC="  javascript:alert('XSS');"> ``` ```html <SCRIPT/XSS SRC="http://ha.ckers.org/xss.js"></SCRIPT> ``` ```html <BODY onload!#$%&()*~+-_.,:;?@[/|\^`=alert("XSS")> ``` ```html <SCRIPT/SRC="http://ha.ckers.org/xss.js"></SCRIPT> ``` ```html <<SCRIPT>alert("XSS");//<</SCRIPT> ``` ```html <SCRIPT SRC=http://ha.ckers.org/xss.js?< B > ``` ```html <SCRIPT SRC=//ha.ckers.org/.j> ``` ```html <IMG SRC="javascript:alert('XSS')" ``` ```html <iframe src=http://ha.ckers.org/scriptlet.html < ``` ```html \";alert('XSS');// ``` ```html <u oncopy=alert()> Copy me</u> ``` ```html <i onwheel=alert(1)> Scroll over me </i> ``` ```html <plaintext> ``` ```html </textarea><script>alert(123)</script> ``` -------------------------------- ### Download Bot Framework Emulator Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/CopilotStudioEchoSkill/wwwroot/default.htm Provides a direct link to download the Bot Framework Emulator, a graphical client that you can use to test your bots. ```html [Download the Emulator](https://aka.ms/bot-framework-F5-download-emulator) ``` -------------------------------- ### Startup Configuration for Agents SDK Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/Compat/SkillsDialog/README.md This code demonstrates the change in startup configuration for handling skills in the Agents SDK. It replaces the Bot Framework SDK's `SkillConversationIdFactoryBase` and `CloudSkillHandler` registration with the `AddAgentHost<SkillChannelApiHandler>()` method. ```csharp // Register the skills conversation ID factory, the client and the request handler. services.AddSingleton<SkillConversationIdFactoryBase, SkillConversationIdFactory>(); services.AddSingleton<ChannelServiceHandlerBase, CloudSkillHandler>(); ``` ```csharp // Add ChannelHost to enable calling other Agents. This is also required for // AgentApplication.ChannelResponses use. builder.AddAgentHost<SkillChannelApiHandler>(); ``` -------------------------------- ### Connect to Agent using Bot Framework Emulator Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/CopilotStudioEchoSkill/wwwroot/default.htm Instructions on how to connect your agent to the Bot Framework Emulator. This involves specifying the local host and API messages endpoint. ```text You can test your agent in the Bot Framework Emulator by connecting to http://localhost:3978/api/messages. ``` -------------------------------- ### Configure Copilot Studio Agent Settings (C#) Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/Authorization/OBOAuthorization/README.md This JSON snippet illustrates how to configure the 'CopilotStudioAgent' settings in `appsettings.json`. It requires the EnvironmentId and SchemaName of the Copilot Studio App to be provided, which are essential for the agent to connect to and interact with the specified Copilot. ```json "CopilotStudioAgent": { "EnvironmentId": "", // Environment ID of environment with the CopilotStudio App. "SchemaName": "", // Schema Name of the Copilot to use } ``` -------------------------------- ### Tag and Push Docker Image to Azure Container Registry Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/deploy-samples.md This set of commands demonstrates how to tag a local Docker image with the Azure Container Registry (ACR) instance name and tag, authenticate to the ACR, and then push the tagged image. This prepares the image for deployment to container hosting services. ```bash docker tag echobot:latest my-bot-images.azurecr.io/echobot:latest az acr login -n my-bot-images docker push my-bot-images.azurecr.io/echobot:latest ``` -------------------------------- ### Configure Copilot Studio Client Sample Application Settings Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/CopilotStudioClient/EvalClient/README.md This JSON snippet shows the configuration settings required for the CopilotStudioClientSample application. It includes parameters for connecting to Copilot Studio and Azure OpenAI, such as Environment ID, Schema Name, Tenant ID, App Client ID, Azure OpenAI Endpoint, Key, and Deployment. ```json { "DirectToEngineSettings": { "EnvironmentId": "", // Environment ID of environment with the CopilotStudio App. "SchemaName": "", // Schema Name of the Copilot to use "TenantId": "", // Tenant ID of the App Registration used to login, this should be in the same tenant as the Copilot. "AppClientId": "", // App ID of the App Registration used to login, this should be in the same tenant as the Copilot. "AzureOpenAiEndpoint": "", // Azure OpenAI Endpoint "AzureOpenAiKey": "", // Azure OpenAI Key "AzureOpenAiDeployment": "" // Azure OpenAI Deployment } } ``` -------------------------------- ### Publish .NET Application as a Docker Image Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/deploy-samples.md This command utilizes the .NET CLI to publish an application, specifically targeting the creation of a Docker image. This is a prerequisite for deploying the application to containerized environments. ```bash dotnet publish /t:PublishContainer ``` -------------------------------- ### Configure CopilotStudioClient Application Settings Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/CopilotStudioClient/CopilotStudioClient/README.md This JSON snippet shows the configuration for the CopilotStudioClient, including environment ID, schema name, tenant ID, client ID, and client secret. These values are necessary for the client to authenticate and connect to the Copilot Studio Agent. ```json "CopilotStudioClientSettings": { "EnvironmentId": "", // Environment ID of environment with the CopilotStudio App. "SchemaName": "", // Schema Name of the Copilot to use "TenantId": "", // Tenant ID of the App Registration used to login, this should be in the same tenant as the Copilot. "UseS2SConnection": true, "AppClientId": "" // App ID of the App Registration used to login, this should be in the same tenant as the Copilot. "AppClientSecret": "" // App Secret of the App Registration used to login, this should be in the same tenant as the Copilot. } ``` -------------------------------- ### Execute Deployment Script Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/deploy-samples.md This command shows how to execute the `deploy-bot-app.ps1` PowerShell script. The script automates the deployment of bot applications to Azure and can accept parameters for resource group, ACR name, ACR image, and bot name, or prompt the user if these are not provided as environment variables. ```powershell deploy-bot-app.ps1 ``` -------------------------------- ### Configure Token Connection in appsettings.json Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/Authorization/README.md This JSON snippet shows the configuration for a token connection in the `appsettings.json` file. It includes settings for authentication type, authority endpoint, client ID, client secret, and scopes, primarily for a SingleTenant Azure Bot using ClientSecrets. ```json "ConnectionName": "{{ConnectionName}}", "TokenValidation": { "Audiences": [ "{{ClientId}}" // this is the Client ID used for the Azure Bot ], "TenantId": "{{TenantId}}" }, "Connections": { "ServiceConnection": { "Assembly": "Microsoft.Agents.Authentication.Msal", "Type": "MsalAuth", "Settings": { "AuthType": "ClientSecret", // this is the AuthType for the connection, valid values can be found in Microsoft.Agents.Authentication.Msal.Model.AuthTypes. The default is ClientSecret. "AuthorityEndpoint": "https://login.microsoftonline.com/{{TenantId}}", "ClientId": "{{ClientId}}", // this is the Client ID used for the connection. "ClientSecret": "00000000-0000-0000-0000-000000000000", // this is the Client Secret used for the connection. "Scopes": [ "https://api.botframework.com/.default" ] } } } ``` -------------------------------- ### Configure ConnectionSettings using DirectConnectUrl (C#) Source: https://github.com/microsoft/agents-for-net/blob/main/src/libraries/Client/Microsoft.Agents.CopilotStudio.Client/README.md Instantiates the ConnectionSettings class with a DirectConnectUrl property. This method is used for direct connections to Copilot Studio. ```csharp var connectionSettings = new ConnectionSettings { DirectConnectUrl = "https://direct.connect.url", }; ``` -------------------------------- ### Create Azure Bot Service Instance via Azure CLI Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/deploy-samples.md This script retrieves the Fully Qualified Domain Name (FQDN) of a deployed Container App and constructs the messaging endpoint. It then uses the Azure CLI to create an Azure Bot service instance, configuring it as a SingleTenant bot with the provided Application ID, Tenant ID, resource group, and messaging endpoint. Finally, it creates a Microsoft Teams bot. ```powershell $fqdn = az containerapp show --resource-g $resourceGroup --name $containerName --query properties.configuration.ingress.fqdn -o tsv $endpoint = "https://$fqdn/api/messages" $botJson = az bot create \ --app-type SingleTenant \ --appid $appId \ --tenant-id $($secretJson.tenant) \ --name $botName \ --resource-group $resourceGroup \ --endpoint $endpoint $teamsBotJson = az bot msteams create -n $botName -g $resourceGroup ``` -------------------------------- ### Configure Agent Host Settings (JSON) Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/AgentToAgent/Agent1/README.md Configuration for the Agent's host settings, including the Client ID for Agent1, default endpoint for the Agent response controller, and connection settings for Agent2. ```json "Agent": { "ClientId": "{{ClientId}}", // this is the Client ID for Agent1 "Host": { "DefaultEndpoint": "http://localhost:3978/api/agentresponse/", // Default host serviceUrl. This is the Url to this Agent and AgentResponseController path. "Agents": { "Echo": { "ConnectionSettings": { "ClientId": "{{Agent2ClientId}}", // This is the Client ID of Agent2 "Endpoint": "http://localhost:39783/api/messages", // The endpoint of Agent2 "TokenProvider": "ServiceConnection" } } } } }, ``` -------------------------------- ### Update appsettings for Skill Host Endpoint Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/Compat/SkillsDialog/README.md This snippet shows the original appsettings structure for defining a skill endpoint in Bot Framework and the new structure used in the Agents SDK for configuring agent connections and endpoints. ```json { "SkillHostEndpoint": "http://localhost:3978/api/skills/", "BotFrameworkSkills": [{ "Id": "DialogSkillBot", "AppId": "", "SkillEndpoint": "http://localhost:39783/api/messages" }] } ``` ```json { "Agent": { "ClientId": "{{DialogRootBotClientId}}", "Host": { "DefaultResponseEndpoint": "http://localhost:3978/api/agentresponse/", "Agents": { "DialogSkillBot": { "ConnectionSettings": { "ClientId": "{{DialogSkillBotClientId}}", "Endpoint": "http://localhost:39783/api/messages", "TokenProvider": "BotServiceConnection" } } } } } } ``` -------------------------------- ### Configure Service Connection in appsettings.json Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/Compat/SkillsDialog/DialogRootBot/README.md This JSON snippet configures the service connection settings in `appsettings.json` for a SingleTenant Azure Bot using ClientSecrets. It includes placeholders for TenantId, ClientId, and ClientSecret, along with the required scopes for authentication. ```json { "Connections": { "ServiceConnection": { "Settings": { "AuthType": "ClientSecret", "AuthorityEndpoint": "https://login.microsoftonline.com/{{TenantId}}", "ClientId": "{{ClientId}}", "ClientSecret": "00000000-0000-0000-0000-000000000000", "Scopes": [ "https://api.botframework.com/.default" ] } } } } ``` -------------------------------- ### Configure ConnectionSettings using DirectConnectUrl (JSON) Source: https://github.com/microsoft/agents-for-net/blob/main/src/libraries/Client/Microsoft.Agents.CopilotStudio.Client/README.md Defines ConnectionSettings in a JSON configuration file using DirectConnectUrl. This is suitable for applications that use direct connection URLs for configuration. ```json { "ConnectionSettings": { "DirectConnectUrl": "https://direct.connect.url", } } ``` -------------------------------- ### Configure Agent Service Connection (C#) Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/Authorization/OBOAuthorization/README.md This JSON snippet demonstrates how to configure the 'ServiceConnection' in the `appsettings.json` file for the .NET Agent sample. It includes settings for authentication type, authority endpoint, client ID, client secret, and scopes, crucial for establishing a connection with Azure services. ```json { "Connections": { "ServiceConnection": { "Settings": { "AuthType": "ClientSecret", // this is the AuthType for the connection, valid values can be found in Microsoft.Agents.Authentication.Msal.Model.AuthTypes. The default is ClientSecret. "AuthorityEndpoint": "https://login.microsoftonline.com/{{TenantId}}", "ClientId": "{{ClientId}}", // this is the Client ID used for the connection. "ClientSecret": "{{ClientSecret}}", // this is the Client Secret used for the connection. "Scopes": [ "https://api.botframework.com/.default" ] } } } } ``` -------------------------------- ### Configure ConnectionSettings using EnvironmentId and SchemaName (C#) Source: https://github.com/microsoft/agents-for-net/blob/main/src/libraries/Client/Microsoft.Agents.CopilotStudio.Client/README.md Instantiates the ConnectionSettings class with EnvironmentId and SchemaName properties. This is a common way to configure the CopilotClient for connecting to Copilot Studio. ```csharp var connectionSettings = new ConnectionSettings { EnvironmentId = "your-environment-id", SchemaName = "your-agent-schema-name", }; ``` -------------------------------- ### Configure Agent MCS Connection (C#) Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/Authorization/OBOAuthorization/README.md This JSON snippet shows the configuration for the 'MCSConnection' in `appsettings.json` for the .NET Agent sample. It specifies authentication details like AuthType, AuthorityEndpoint, ClientId, and ClientSecret, which are necessary for connecting to specific Microsoft services. ```json "MCSConnection": { "Settings": { "AuthType": "ClientSecret", "AuthorityEndpoint": "https://login.microsoftonline.com/{{OAuthTenantId}}", "ClientId": "{{OAuthClientId}}", // this is the Client ID created in Step #3 "ClientSecret": "{{OAuthClientSecret}}" // this is the Client Secret created in Step #3 } ``` -------------------------------- ### Evaluation Dataset Entry Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/CopilotStudioClient/EvalClient/README.md Represents a single test case in the evaluation dataset, including the test utterance, expected response, and relevant sources. ```plain text Name: Asus Zenbook Duo 2024 Test Utterance: How can I charge the removable keyboard of the Asus Zenbook Duo 2024? Expected Response: To charge the removable keyboard of the Asus Zenbook Duo 2024 insert the bundled power adapter into the USB-C port on the keyboard or dock it with the laptop to charge via the built-in connector. Sources: https://tenant.sharepoint.com/sample/Document%20Library%201/2.pdf;https://tenant.sharepoint.com/sample/Document%20Library%201/3.pdf ``` -------------------------------- ### Deploy to Azure Container Apps using Azure CLI Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/deploy-samples.md This PowerShell script deploys a containerized application to Azure Container Apps. It retrieves application credentials (tenant, appId, password) using 'az ad app credential reset', and then uses 'az containerapp up' to create or update the Container App. It configures environment variables for the bot's settings, including TenantId, ClientId, AuthorityEndpoint, and ClientSecret, along with logging level. ```powershell $secretJson = az ad app credential reset --id $appId | ConvertFrom-Json az containerapp up \ --resource-group $resourceGroup \ --name $containerName \ --image $botImage \ --environment bot-apps-$resourceGroup \ --ingress external \ --env-vars \ Connections__BotServiceConnection__Settings__TenantId=$($secretJson.tenant) \ Connections__BotServiceConnection__Settings__ClientId=$($secretJson.appId) \ Connections__BotServiceConnection__Settings__AuthorityEndpoint="https://login.microsoftonline.com/$($secretJson.tenant)" \ Connections__BotServiceConnection__Settings__ClientSecret=$($secretJson.password) \ Logging__LogLevel__Microsoft_AspNetCore="Information" ``` -------------------------------- ### Registering MemoryStorage with IStorage Source: https://github.com/microsoft/agents-for-net/blob/main/src/libraries/Storage/Microsoft.Agents.Storage/README.md This snippet demonstrates how to register MemoryStorage as a singleton service for IStorage in a .NET application's service collection. MemoryStorage is suitable for testing agents. ```csharp builder.Services.AddSingleton<IStorage, MemoryStorage>(); ``` -------------------------------- ### Configure ServiceConnection in appsettings.json Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/Compat/SkillsDialog/DialogSkillBot/README.md Configuration snippet for setting up the 'ServiceConnection' in `appsettings.json` for an Azure Bot using ClientSecrets. It specifies authentication type, authority endpoint, client ID, client secret, and scopes. ```json "Connections": { "ServiceConnection": { "Settings": { "AuthType": "ClientSecret", // this is the AuthType for the connection, valid values can be found in Microsoft.Agents.Authentication.Msal.Model.AuthTypes. The default is ClientSecret. "AuthorityEndpoint": "https://login.microsoftonline.com/{{TenantId}}", "ClientId": "{{ClientId}}", // this is the Client ID used for the connection. "ClientSecret": "00000000-0000-0000-0000-000000000000", // this is the Client Secret used for the connection. "Scopes": [ "https://api.botframework.com/.default" ] } } }, ``` -------------------------------- ### Configure AI Services in appsettings.json Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/SemanticKernel/WeatherAgent/README.md Configures AI service credentials for either Azure OpenAI or OpenAI within the appsettings.json file. This includes specifying deployment names, endpoints, API keys, and model IDs. It also includes a flag to switch between Azure OpenAI and OpenAI. ```json { "AIServices": { "AzureOpenAI": { "DeploymentName": "", "Endpoint": "", "ApiKey": "" }, "OpenAI": { "ModelId": "", "ApiKey": "" }, "UseAzureOpenAI": true } } ``` -------------------------------- ### Configure ConnectionSettings using EnvironmentId and SchemaName (JSON) Source: https://github.com/microsoft/agents-for-net/blob/main/src/libraries/Client/Microsoft.Agents.CopilotStudio.Client/README.md Defines ConnectionSettings in a JSON configuration file using EnvironmentId and SchemaName. This is a common method for configuring applications via external configuration. ```json { "ConnectionSettings": { "EnvironmentId": "your-environment-id", "SchemaName": "your-agent-schema-name", } } ``` -------------------------------- ### Update ChannelHost configuration in appsettings.json Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/Compat/SkillsDialog/DialogSkillBot/README.md Configuration snippet for updating the 'Agent' and 'ChannelHost' settings in `appsettings.json`. This includes setting the agent's client ID, default endpoint, and details for connecting to other agents, including their client IDs and endpoints. ```json "Agent": { "ClientId": "{{ClientId}}", // this is the Client ID for Agent1 "Host": { "DefaultEndpoint": "http://localhost:3978/api/agentresponse/", // Default host serviceUrl. This is the Url to this Agent and AgentResponseController path. "Agents": { "Echo": { "ConnectionSettings": { "ClientId": "{{Agent2ClientId}}", // This is the Client ID of Agent2 "Endpoint": "http://localhost:39783/api/messages", // The endpoint of Agent2 "TokenProvider": "ServiceConnection" } } } } }, ``` -------------------------------- ### Map HTTP Endpoint for Agent2 Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/MultiAgent/README.md Maps the HTTP POST endpoint '/api/2/messages' to process incoming requests for Agent2. Similar to Agent1, it uses IAgentHttpAdapter for request handling. ```csharp app.MapPost("/api/2/messages", async (HttpRequest request, HttpResponse response, IAgentHttpAdapter adapter, Agent2 agent, CancellationToken cancellationToken) => { await adapter.ProcessAsync(request, response, agent, cancellationToken); }); ``` -------------------------------- ### Register CosmosDbPartitionedStorage in Program.cs Source: https://github.com/microsoft/agents-for-net/blob/main/src/libraries/Storage/Microsoft.Agents.Storage.CosmosDb/README.md This C# snippet demonstrates how to register the CosmosDbPartitionedStorage as a singleton service in the .NET application's Program.cs file. It retrieves the configuration from the application settings. ```csharp builder.Services.AddSingleton<IStorage>((sp) => new CosmosDbPartitionedStorage( builder.Configuration.GetSection(nameof(CosmosDbPartitionedStorageOptions)) .Get<CosmosDbPartitionedStorageOptions>())); ``` -------------------------------- ### Configure Integration Tests with testsettings.json Source: https://github.com/microsoft/agents-for-net/blob/main/src/tests/Microsoft.Agents.Extensions.Teams.AI.Tests/IntegrationTests/README.md This JSON configuration file is required to run manual integration tests that interact with OpenAI, AzureOpenAI, and AzureContentSafety APIs. It specifies model IDs, API keys, and endpoints for each service. ```json { "OpenAI": { "modelId": "<Model Id>", "chatModelId": "<Chat Model Id>", "apiKey": "<OpenAI API key>" }, "AzureOpenAI": { "modelId": "<Model Id>", "chatModelId": "<Chat Model Id>", "apiKey": "<Azure OpenAI API key>", "endpoint": "<Azure OpenAI API Endpoint>" }, "AzureContentSafety": { "apiKey": "<Azure Content Safety API key>", "endpoint": "<Azure Content Safety endpoint>" } } ``` -------------------------------- ### Configure Agent Connections in appsettings.json Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/CopilotStudioEchoSkill/README.md This JSON snippet shows how to configure the 'Connections' section in the 'appsettings.json' file for client secret authentication. It includes settings for the authority endpoint, client ID, client secret, and scopes required for connecting to the Azure Bot service. ```json { "Connections": { "ServiceConnection": { "Settings": { "AuthType": "ClientSecret", "AuthorityEndpoint": "https://login.microsoftonline.com/{{TenantId}}", "ClientId": "{{ClientId}}", "ClientSecret": "{{ClientSecret}}", "Scopes": [ "https://api.botframework.com/.default" ] } } } } ``` -------------------------------- ### Map HTTP Endpoint for Agent1 Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/MultiAgent/README.md Maps the HTTP POST endpoint '/api/1/messages' to process incoming requests for Agent1. It utilizes an IAgentHttpAdapter to handle the request processing. ```csharp app.MapPost("/api/1/messages", async (HttpRequest request, HttpResponse response, IAgentHttpAdapter adapter, Agent1 agent, CancellationToken cancellationToken) => { await adapter.ProcessAsync(request, response, agent, cancellationToken); }); ``` -------------------------------- ### Update Agent Host Configuration in appsettings.json Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/Compat/SkillsDialog/DialogRootBot/README.md This JSON snippet updates the `Agent` and `Host` configurations in `appsettings.json`. It specifies the default endpoint for the agent and defines connection settings for other agents, including their ClientId, Endpoint, and TokenProvider. Placeholders for Agent1 and Agent2 ClientIds are included. ```json { "Agent": { "ClientId": "{{ClientId}}", "Host": { "DefaultEndpoint": "http://localhost:3978/api/agentresponse/", "Agents": { "Echo": { "ConnectionSettings": { "ClientId": "{{Agent2ClientId}}", "Endpoint": "http://localhost:39783/api/messages", "TokenProvider": "ServiceConnection" } } } } } } ``` -------------------------------- ### Host Dev Tunnel (Bash Command) Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/Compat/TeamsConversationSsoQuickstart/README.md This bash command is used to host a dev tunnel with anonymous user access, which is necessary for connecting the Azure Bot to the locally running agent. ```bash devtunnel host -p 3978 --allow-anonymous ``` -------------------------------- ### Configure Azure Bot Token Connection (appsettings.json) Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/Compat/TeamsConversationSsoQuickstart/README.md This JSON snippet shows the configuration for a token connection in the appsettings.json file for a SingleTenant Azure Bot using ClientSecrets. It includes settings for authentication type, authority endpoint, client ID, client secret, and scopes. ```json "Connections": { "ServiceConnection": { "Assembly": "Microsoft.Agents.Authentication.Msal", "Type": "MsalAuth", "Settings": { "AuthType": "ClientSecret", "AuthorityEndpoint": "https://login.microsoftonline.com/{{TenantId}}", "ClientId": "{{ClientId}}", "ClientSecret": "00000000-0000-0000-0000-000000000000", "Scopes": [ "https://api.botframework.com/.default" ] } } } ``` -------------------------------- ### Add Agents to Builder Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/MultiAgent/README.md Adds Agent1 and Agent2 as agents to the application's builder. This is a fundamental step for integrating custom agent logic into the .NET application. ```csharp builder.AddAgent<Agent1>(); builder.AddAgent<Agent2>(); ``` -------------------------------- ### Configure Azure Bot Connections in appsettings.json Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/MultiAgent/README.md This JSON configuration defines the settings for connecting to Azure Bots, including authentication type, authority endpoint, client ID, client secret, and scopes. It also maps client IDs to specific service connections. This is crucial for establishing communication between the agent and the bots. ```json "Connections": { "ServiceConnection1": { "Settings": { "AuthType": "ClientSecret", // this is the AuthType for the connection, valid values can be found in Microsoft.Agents.Authentication.Msal.Model.AuthTypes. The default is ClientSecret. "AuthorityEndpoint": "https://login.microsoftonline.com/{{TenantId}}", "ClientId": "{{ClientId1}}", // this is the Client ID used for the connection. "ClientSecret": "", // this is the Client Secret used for the connection. "Scopes": [ "https://api.botframework.com/.default" ] } }, "ServiceConnection2": { "Settings": { "AuthType": "ClientSecret", // this is the AuthType for the connection, valid values can be found in Microsoft.Agents.Authentication.Msal.Model.AuthTypes. The default is ClientSecret. "AuthorityEndpoint": "https://login.microsoftonline.com/{{TenantId}}", "ClientId": "{{ClientId2}}", // this is the Client ID used for the connection. "ClientSecret": "", // this is the Client Secret used for the connection. "Scopes": [ "https://api.botframework.com/.default" ] } } }, "ConnectionsMap": [ { "Audience": "{{ClientId1}}", "Connection": "ServiceConnection1" }, { "Audience": "{{ClientId2}}", "Connection": "ServiceConnection2" } ] ``` -------------------------------- ### Configure Cosmos DB Storage in appsettings.json Source: https://github.com/microsoft/agents-for-net/blob/main/src/libraries/Storage/Microsoft.Agents.Storage.CosmosDb/README.md This JSON snippet shows how to configure the CosmosDbPartitionedStorageOptions in the appsettings.json file, specifying the database endpoint, database ID, and container ID. ```json { "CosmosDbPartitionedStorageOptions": { "CosmosDbEndpoint": "{db_endpoint}", "DatabaseId": "{db_id}", "ContainerId": "{container_id}" } } ``` -------------------------------- ### Configure User Authorization Handlers in appsettings.json Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/Authorization/AutoSignIn/README.md This JSON snippet illustrates the 'UserAuthorization' configuration within appsettings.json. It defines default handlers and specific settings for 'auto' and 'me' handlers, including Azure Bot OAuth Connection Name, Title, and Text. Ensure to replace the connection name placeholders. ```json "AgentApplication": { "UserAuthorization": { "DefaultHandlerName": "auto", "AutoSignin": true, "Handlers": { "auto": { "Settings": { "AzureBotOAuthConnectionName": "{{auto_connection_name}}", "Title": "SigIn for Sample", "Text": "Please sign in and send the 6-digit code" } }, "me": { "Settings": { "AzureBotOAuthConnectionName": "{{me_connection_name}}", "Title": "SigIn for Me", "Text": "Please sign in and send the 6-digit code" } } } } } ``` -------------------------------- ### Configure Token Validation in appsettings.json Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/MultiAgent/README.md This JSON snippet configures token validation settings, specifying the allowed audiences (Client IDs) and the Tenant ID. This is used when integrating with AspNetExtensions for secure communication and authentication with Azure Bots. ```json "TokenValidation": { "Audiences": [ "{{ClientId1}}", "{{ClientId2}}" ], "TenantId": "{{TenantId}}" } ``` -------------------------------- ### Create Entra ID App Registration via Azure CLI Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/deploy-samples.md This code snippet uses the Azure CLI to create a new App Registration in Entra ID. It sets a display name for the application and specifies the sign-in audience. The command outputs the Application ID (appId) of the newly created registration. ```powershell $appId = az ad app create --display-name $botName --sign-in-audience "AzureADMyOrg" --query appId | ConvertFrom-Json ``` -------------------------------- ### Configure Agent Token Connection (JSON) Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/AgentToAgent/Agent1/README.md Configuration for establishing a token connection to an Azure Bot Service using Client Secrets. This includes settings for authentication type, authority endpoint, client ID, client secret, and scopes. ```json "Connections": { "ServiceConnection": { "Settings": { "AuthType": "ClientSecret", // this is the AuthType for the connection, valid values can be found in Microsoft.Agents.Authentication.Msal.Model.AuthTypes. The default is ClientSecret. "AuthorityEndpoint": "https://login.microsoftonline.com/{{TenantId}}", "ClientId": "{{ClientId}}", // this is the Client ID used for the connection. "ClientSecret": "00000000-0000-0000-0000-000000000000", // this is the Client Secret used for the connection. "Scopes": [ "https://api.botframework.com/.default" ] } } }, ``` -------------------------------- ### Evaluation Dataset Results Entry Source: https://github.com/microsoft/agents-for-net/blob/main/src/samples/CopilotStudioClient/EvalClient/README.md Details the results of an agent's response to a test utterance, including the agent's answer, score, and source validation. ```plain text Name: Asus Zenbook Duo 2024 est Utterance: How can I charge the removable keyboard of the Asus Zenbook Duo 2024? Expected Response: To charge the removable keyboard of the Asus Zenbook Duo 2024 insert the bundled power adapter into the USB-C port on the keyboard or dock it with the laptop to charge via the built-in connector. Sources: https://tenant.sharepoint.com/sample/Document%20Library%201/2.pdf;https://tenant.sharepoint.com/sample/Document%20Library%201/3.pdf Agent Response: To charge the removable keyboard of the Asus Zenbook Duo 2024 you can follow these steps: 1. Connect the AC power cord to the AC/DC adapter. 2. Connect the DC power connector into your keyboard’s power (DC) input port. 3. Plug the AC power adapter into a 100V~240V power source [1]. [1]: https://tenant.sharepoint.com/sample/Document%20Library%201/2.pdf Answer Score: 65 Sources Score: 1/2 ``` -------------------------------- ### Register BlobsStorage in Program.cs Source: https://github.com/microsoft/agents-for-net/blob/main/src/libraries/Storage/Microsoft.Agents.Storage.Blobs/README.md This C# snippet demonstrates how to register the BlobsStorage as a singleton service in the .NET application's service collection, using configuration values from appsettings.json. ```csharp builder.Services.AddSingleton<IStorage>((sp) => new BlobsStorage( builder.Configuration["BlobsStorageOptions:ConnectionString"], builder.Configuration["BlobsStorageOptions:ContainerName"])); ```