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 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.

Copilot Studio supports DLP enforcement in real time. Agent makers and users see applicable DLP enforcement error messages as soon as a DLP policies becomes active.

In a DLP policy, the connectors must be in the same data group because data can't be shared among connectors that are in different groups.

You can configure DLP policies in the Power Platform admin center to block any of the following Copilot Studio connectors.

Connector name Use case
Application Insights in Copilot Studio Block agent makers from connecting agents 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 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 documents in Copilot Studio Block agent makers from publishing agents configured with documents as a knowledge source.
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.
Microsoft 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.
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.

Example DLP policy configurations

To get started with Copilot Studio agent governance, review the following example 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 use the Set-PowerAppDlpErrorSettings PowerShell cmdlet to add an email address and a "Learn more" link to the DLP error messages.

Screenshot of a DLP-related error message in Copilot Studio, with an email address and Learn more link highlighted.

To add the email address 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 DLP isn't configured for Copilot Studio, the response from the cmdlet is empty.

Use auditing mode to see DLP errors in Copilot Studio

Run the following PowerShell script to enable DLP policies in auditing or "soft" mode. When this mode is active, agent makers can see DLP-related error messages when configuring agents in Copilot Studio, but it doesn't block them from performing DLP-related actions. However, makers can't publish agents while this mode is active.

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

To find agents that your organization's DLP policies might affect, you can:

  • Use the Power BI dashboard of 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.

  • 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 are likely to report errors to 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 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

Use the following command to disable DLP enforcement in agents.

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