Configure data loss prevention policies for agents

Organizational data is the most important asset administrators are responsible for safeguarding. The ability to build automation to use that data is a large part of their company's success.

You can rapidly build and roll out your high-value agents for your end users. You can connect your agents with many data sources and services. Some of these sources and services might be external, non-Microsoft services, and might even include social networks.

It's easy to overlook the potential for exposure. This sort of exposure can result from data leakage or connections to services and audiences that shouldn't have access to the data.

Administrators can govern agents in your organization using data loss prevention (DLP) policies with existing and Copilot Studio connectors. DLP policies are created in the Power Platform admin center. To create a DLP policy, you need to be a tenant admin or have the Environment Admin role.

Prerequisites

Copilot Studio connectors

Copilot Studio connectors can be classified within a DLP policy under the following data groups, which are presented in the Power Platform admin center when reviewing DLP policies:

  • Business
  • Non-business
  • Blocked

You can use the connectors in DLP policies to protect your organization's data from any malicious or unintentional data exfiltration by your agent makers.

Important

By default, DLP enforcement for agents is disabled in all tenants. Learn about enabling enforcement.

The connectors need to be in a single data group as data can't be shared among connectors that are in different groups.

Several Copilot Studio connectors are available in the Power Platform admin center. These connectors can be configured for DLP as follows:

Connector name Description
Application Insights in Copilot Studio Block agent makers from connecting agent with Application Insights.
Chat without Microsoft Entra ID authentication in Copilot Studio Block agent makers from publishing agents that aren't configured for authentication.
agent users must authenticate themselves to chat with the agent.
For more information, see Data loss prevention example - Require end-user authentication in agents.
Direct Line channels in Copilot Studio Block agent makers from enabling or using Direct Line channel.
For example, the Demo website, Custom website, Mobile app, and other Direct Line channels would be blocked.
Facebook channel in Copilot Studio Block agent makers from enabling or using the Facebook channel.
Knowledge source with SharePoint and OneDrive in Copilot Studio Block agent makers from publishing agents configured with SharePoint as a knowledge source. Supports DLP connector endpoint filtering to allow or deny endpoints.
Knowledge source with public websites and data in Copilot Studio Block agent makers from publishing agents configured with public websites as a knowledge source. Supports DLP connector endpoint filtering to allow or deny endpoints.
Knowledge source with documents in Copilot Studio Block agent makers from publishing agents configured with documents as a knowledge source.
Microsoft Teams channel in Copilot Studio Block agent makers from enabling or using the Teams channel.
Omnichannel in Copilot Studio Block agent makers from enabling or using the Omnichannel channel.
Skills with Copilot Studio Block agent makers from using skills in Copilot Studio agents.
For more information, see Data loss prevention example - Block skills in agents and Data loss prevention example - Block HTTP requests in agents.
Event triggers with Copilot Studio Block agent makers from using event triggers in Copilot Studio agents.
For more information, see Data loss prevention example - Block event triggers in agents.

Example DLP policy configurations

To help you get started with Copilot Studio agent governance, we created the following examples that detail different scenarios:

Use PowerShell to enable and administer DLP enforcement for agents in your organization

You can configure whether DLP policies should be applied to your agents with the PowerAppDlpErrorSettings and PowerVirtualAgentsDlpEnforcement PowerShell cmdlets.

You can:

  • Confirm if DLP is enabled for agents in your tenant.
  • Enable or disable DLP in an auditing mode (-Mode SoftEnabled) so agent makers can see errors, but aren't prevented from performing actions that would be blocked if DLP enforcement was fully enabled.
  • Enable or disable DLP enforcement, to show DLP enforcement errors, and prevent agent makers from publishing DLP-affected bots or configuring DLP-related settings.
  • Exempt specific agents from DLP enforcement.
  • Add and update the learn-more and contact email links that are shown to agent makers when they encounter DLP in the Copilot Studio web and Teams apps.

Important

Before using the PowerShell cmdlets, or the example scripts shown here, ensure you install the following modules using PowerShell.

  • Microsoft.PowerApps.Administration.PowerShell
  • Microsoft.PowerApps.PowerShell -AllowClobber

You need to be a tenant admin to use the cmdlets.

Typically, you would use these cmdlets in accordance with a DLP rollout process, which might consist of the following steps, in order:

  1. Add or update the learn-more and admin contact email links that are shown in DLP errors for agent makers.

  2. Determine which (if any) agents currently have DLP policy enforcement enabled.

  3. Use auditing or "soft" mode so makers can see DLP errors in the Copilot Studio web and Teams apps.

  4. Mitigate risk by contacting makers and informing them about the best course of action for their app or flow.

  5. Enable DLP enforcement for agents to prevent DLP-affected tasks and features.

You might also decide to exempt one or more agents from DLP policy enforcement, depending on the agent's use case and requirements.

You can configure an email and learn-more link using the Set-PowerAppDlpErrorSettings PowerShell cmdlet. Your agent makers will see this information when they experience DLP errors.

Screenshot of the Copilot Studio web app showing a DLP related error with error text highlighted.

To add the email and learn-more link for the first time, run the following PowerShell script, replacing the values for the <email>, <URL>, and <tenant ID> parameters with your own.

$ContactDetails = [pscustomobject] @{
    Enabled=$true
    Email="<email>"
}
$ErrorMessageDetails = [pscustomobject] @{
    Enabled=$true
    Url="<URL>"
}
$ErrorSettingsObj = [pscustomobject] @{
    ErrorMessageDetails=$ErrorMessageDetails
    ContactDetails=$ContactDetails
}
New-PowerAppDlpErrorSettings -TenantId "<tenant ID>" -ErrorSettings $ErrorSettingsObj

To update an existing configuration, use the same PowerShell script, and replace New-PowerAppDlpErrorSettings with Set-PowerAppDlpErrorSettings.

Caution

These settings apply to all Power Platform apps within the specified tenant.

Enable and configure DLP enforcement for agents

You can enable, disable, configure, and audit DLP enforcement within Copilot Studio with the PowerVirtualAgentsDlpEnforcement cmdlet.

In any of the following examples, replace (or declare) <tenant ID> with your tenant's ID.

You can scope to agents created after a certain date by replacing <date> with a date in the format MM-DD-YYYY. To remove the scope, delete the -OnlyForBotsCreatedAfter parameter and its value.

Confirm DLP enforcement for agents

By default, DLP enforcement for agents is disabled in all tenants.

You can run the following PowerShell cmdlet to check if DLP for Copilot Studio is enabled for a tenant.

Get-PowerVirtualAgentsDlpEnforcement -TenantId <tenant ID>

Note

If you haven't configured Copilot Studio DLP, the results from the cmdlet will be empty.

Use auditing or "soft" mode to see DLP errors in the Copilot Studio web or Teams apps

Run the following PowerShell script to enable DLP policies in auditing mode. Agent makers will see DLP-related errors when configuring agents in the Copilot Studio web and Teams apps, but they won't be blocked from performing DLP-related actions. Additionally, makers are unable to publish agents while the soft mode is enabled.

Set-PowerVirtualAgentsDlpEnforcement -TenantId <tenant ID> -Mode SoftEnabled

To find agents that could be impacted by your organization's existing DLP policies, you can:

  1. Use the Center of Excellence (CoE) Starter Kit to get a list of agents in your organization. Go to the Copilot Studio overview page on the CoE Dashboard to see the agents and environment names in your organization.

    Screenshot of the CoE Starter Kit dashboard opened to the Copilot Studio overview.

  2. Run a campaign with the agent makers in your organization to address DLP errors or updated DLP policies. You can download all agent DLP errors by selecting Details in the error notification banner and selecting Download from the error message details.

Enable DLP enforcement for agents

Important

Before enabling DLP enforcement, ensure you know which agents will show errors to your agent users due to DLP policy violations.

If you run into issues, you can exempt an agent from DLP policies or disable DLP enforcement while your makers fix the agent to comply with DLP policies.

You can run the following PowerShell command to enforce DLP policies in Copilot Studio. Agent makers will be prevented from performing DLP-impacted actions, and end users will see errors if they trigger.

Set-PowerVirtualAgentsDlpEnforcement -TenantId <tenant ID> -Mode Enabled -OnlyForBotsCreatedAfter <date>

Exempt a bot from DLP policies

If you've enabled DLP enforcement for your tenant but you need to exempt an agent from showing DLP errors to makers and users, you can run the following PowerShell script.

Make sure to replace <environment ID>, <bot ID>, <tenant ID>, and <policy ID> with the appropriate IDs for the agent you want to exempt.

Tip

You can find the <environment ID> and <bot ID> from the agent's URL.

The <policy ID> is listed alongside the error details in the Download details file. You can download that file by selecting Download details on the error notification banner in Copilot Studio.

$environmentId = "<environment ID>" 
$botId = "<bot ID>"; 
$tenantId = "<tenant ID>" 
$policyName = "<policy ID>"

# Ensure the DLP commands are installed
if (-not (Get-Command "Get-PowerAppDlpPolicyExemptResources" -ErrorAction SilentlyContinue))
{
    Write-Host "Please ensure the Power Apps DLP commands are available: https://docs.microsoft.com/power-platform/admin/powerapps-powershell#environments-commands" -ForegroundColor Red
    return;
}
# Set up the PVA resource information
$pvaResourceId = "$environmentId+$botId"
$pvaResourceType = "Bot"
$exemptBot = [pscustomobject]@{
                id = $pvaResourceId
                type = $pvaResourceType
              }
Write-Host "Getting exempt resources"
$resources = Get-PowerAppDlpPolicyExemptResources -TenantId $tenantId -PolicyName $policyName
if (-not $resources)
{
    $resources = [pscustomobject]@{  exemptResources = @($exemptBot) }
    Write-Host "No exempt resources configured yet"
}
$resources = New-PowerAppDlpPolicyExemptResources -TenantId $tenantId -PolicyName $policyName -NewDlpPolicyExemptResources $resources
Write-Host "Added bot to exempt resources"

Disable DLP enforcement for agents

The following command will disable DLP enforcement in agents.

Set-PowerVirtualAgentsDlpEnforcement -TenantId <tenant ID> -Mode Disabled