Govern Custom Connectors With URL Patterns in a Tenant-Level Data Policy
How to inventory every custom connector in a Power Platform tenant with PowerShell and move from an empty data policy to an allowlist that blocks the rest.
Key takeaways
- A new tenant-level data policy has one custom connector rule:
*set to Ignore. Until you change it, custom connectors can call any endpoint and mix with Business and Non-Business connectors alike. - You need the Power Platform Administrator role. With environment admin rights, PowerShell only shows your own environments, so the inventory looks complete but isn't.
- Inventory first. One PowerShell script lists every custom connector with its host, owner and connection count.
- Classify by host type. Allow your own APIs and Microsoft APIs with a clear purpose. Ask about management APIs, shared cloud services, plain HTTP and unused connectors. Block tunnels and demo APIs.
- Use the pattern form Microsoft documents,
https://host*, and put each pattern in the data group of the connectors it works with. Classify the HTTP connectors too, or they become the side door. - While
*is Ignore, a pattern that misses fails silently. Prove your patterns in a sandbox test policy with*Blocked, pilot on dev environments, then flip the main policy on an announced date.
A custom connector is a maker-built wrapper around any REST API. Any means any: an internal API behind Entra application proxy, a Microsoft management endpoint, a public demo API, or a home server reached through a tunnel. Data policies can govern them, but at Contoso, like at most organisations I've seen, nobody had ever looked.
If you already know how to build a data policy for prebuilt connectors, this is the next step. It's the path I took from "we have a data policy" to an allowlist of custom connector hosts with everything else blocked, with every script you need to repeat it.
The admin center screens in this post are illustrations I made with the Contoso data. Their labels follow Microsoft Learn, but the real admin center looks different.
Before you start
| What | Details |
|---|---|
| Role | Power Platform Administrator or Global Administrator. You need it to create a tenant-level policy and to see every environment in PowerShell. |
| Tools | Windows PowerShell 5.1 and the Microsoft.PowerApps.Administration.PowerShell module. I used version 2.0.218. |
| Where | Power Platform admin center, under Security > Data and privacy > Data policy. |
| Time | About ten minutes for the inventory once the module is installed. Plan the rollout in weeks, because connector owners need time to answer. |
| People | Someone who approves the classification, and a contact makers can reach after the switch. |
Environment admin rights are not enough. Get-AdminPowerAppConnector only returns custom connectors from environments where you're an environment admin, so the inventory looks complete when it isn't (cmdlet reference).
Why, when and what you get
The default governs nothing
Open the Custom connectors step of a new tenant-level data policy and you see exactly one rule: pattern *, data group Ignore.

Ignore means the policy does not classify custom connectors at all. It defers to other policies, and if no other rule covers them, custom connectors can be combined with both Business and Non-Business connectors (Microsoft Learn). In practice: a flow can read from SharePoint, classified as Business, and post the result to a custom connector pointing at any host on the internet, and the policy will not stop it.
When to do this
- You're setting up or reviewing data policies. Do custom connectors in the same pass as the prebuilt ones.
- Makers can create custom connectors in shared environments. In most tenants that includes the default environment.
- An audit asks which external endpoints Power Platform can reach. Without an inventory, nobody can answer.
- You find a custom connector pointing somewhere unexpected. There are usually more.
Don't wait for advanced connector policies to solve this. That newer allowlist model covers certified connectors only, and Microsoft says to keep using classic data policies for custom connectors (advanced connector policies).
What you get
- A known list of endpoints. Every host a custom connector can call is on a list someone approved.
- No quiet data leaks. Business data can't flow to a host nobody looked at.
- Early sight of new integrations. Every new host comes in through a request, before it reaches production.
- A clear answer for auditors. The pattern list and the request log are the evidence.
The process at a glance
- Start with a tenant-level policy, and check the policies you already have.
- Inventory every custom connector with PowerShell.
- Classify each host as allow, ask the owner, or don't allow.
- Turn approved hosts into patterns, and close the HTTP side door.
- Add the patterns while
*is still Ignore. Only the connectors they match are affected. - Check the impact, test in a sandbox, pilot on dev environments, then flip
*to Blocked on an announced date. - Run it after go-live: requests, a monthly inventory and a rollback plan.
Step 1: Start with a tenant-level policy
Custom connector URL patterns live in a tenant-level data policy. That's also the only kind of policy that can cover more than one environment: an environment-level policy holds exactly one (policy scope).
A tenant-level policy has a Scope step with three options: all environments, multiple selected environments, or all environments except the ones you exclude. The inventory covers the whole tenant, so I scope the policy to all environments. If you exclude an environment, it needs a policy of its own.

Check the policies you already have before you create one. All policies that apply to an environment are evaluated together, Blocked in any of them wins, and every extra policy splits the connector groups further (combined effect of multiple policies). Microsoft recommends as few policies per environment as possible. If a tenant-level policy already covers your environments, add the custom connector rules there.
Step 2: Inventory the custom connectors
Install the module and sign in
This is the whole sequence, verified with module version 2.0.218 on Windows PowerShell 5.1. On a managed laptop behind a proxy, every line is there for a reason. The troubleshooting section at the end explains which error each one fixes.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
Register-PSRepository -Default
Install-Module Microsoft.PowerApps.Administration.PowerShell -Scope CurrentUser
Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned
Import-Module Microsoft.PowerApps.Administration.PowerShell
Add-PowerAppsAccount
# Sanity check: should match the number of environments in the tenant
(Get-AdminPowerAppEnvironment).CountIf the environment count matches what you see in the admin center, you're signed in with enough rights to continue.
Run the inventory
Three cmdlets give you everything: environments, connectors and connections. The script joins them into one row per custom connector and saves a CSV.
$envs = Get-AdminPowerAppEnvironment
$connectors = Get-AdminPowerAppConnector
$connections = Get-AdminPowerAppConnection
$rows = foreach ($c in $connectors) {
[pscustomobject]@{
Environment = ($envs | Where-Object EnvironmentName -eq $c.EnvironmentName).DisplayName
Connector = $c.DisplayName
HostUrl = $c.Internal.backendService.serviceUrl
CreatedBy = $c.CreatedBy.email
Connections = @($connections | Where-Object {
$_.ConnectorName -eq $c.ConnectorName -and
$_.EnvironmentName -eq $c.EnvironmentName }).Count
AlmMode = $c.Internal.almMode
}
}
$rows | Sort-Object Environment, Connector | Export-Csv .\custom-connectors.csv -NoTypeInformation
$rows | Sort-Object Environment, Connector | Format-Table -AutoSize -WrapWhat each column is for:
- HostUrl is the backend the connector calls. This becomes the allow pattern later.
- CreatedBy is who you talk to when a connector lands in the "ask" bucket.
- Connections counts the connections created against the connector in that environment. It's a proxy for "in use": zero connections usually means nobody uses it, a high count means something depends on it.
- AlmMode shows whether the connector lives in a solution (
Solution) or was created loose in the environment (Environment).
Two gotchas cost me time.
The endpoint path. My first attempt read Internal.properties.backendService.serviceUrl and the HostUrl column came back empty. The property sits one level higher. I found it by listing what the Internal object actually contains:
$connectors[0].Internal | Get-Member -MemberType NotePropertyThat listed backendService and almMode directly under Internal, so the correct path is Internal.backendService.serviceUrl.
Solution connectors. Microsoft's documentation says Get-AdminPowerAppConnector does not list custom connectors that are part of a solution. In my run most rows had AlmMode Solution, so in module version 2.0.218 they were returned. Don't trust the docs on this and don't trust me either. Look at your own AlmMode column, then open one production environment in the maker portal and compare its custom connector list to the CSV. If a connector is missing, you have a gap to close before you block anything.
Read the results
Here is what the output looked like, with Contoso standing in for the real organisation:

The same data as a table:
| Environment | Connector | HostUrl | CreatedBy | Connections | AlmMode |
|---|---|---|---|---|---|
| Contoso - Dev | Release Notes | https://www.microsoft.com/ | dev.one@contoso.com | 1 | Solution |
| Contoso - Dev | Microsoft Learn | https://learn.microsoft.com/ | dev.one@contoso.com | 2 | Solution |
| Personal Productivity | Field Services | https://fieldservices-contoso.msappproxy.net/ | maker.two@contoso.com | 16 | Environment |
| Personal Productivity | Field Services (legacy) | http://fieldservices.corp.contoso.com/ | maker.two@contoso.com | 1 | Environment |
| Personal Productivity | Fabric Reporting | https://api.fabric.microsoft.com/ | analyst.three@contoso.com | 1 | Solution |
| Personal Productivity | Databricks Reporting | https://adb-1234567890123456.7.azuredatabricks.net/ | analyst.three@contoso.com | 0 | Solution |
| Personal Productivity | VM Management | https://management.azure.com/ | ops.four.ext@contoso.com | 1 | Environment |
| Personal Productivity | Expense Helper | https://home-server.tail0a1b2c.ts.net/ | contractor.five.ext@contoso.com | 1 | Solution |
| Personal Productivity | Pokemon API | https://pokeapi.co/api/v2/ | maker.two@contoso.com | 1 | Environment |
Three things stand out.
Nothing is in production. Every connector sits in a dev environment or in the default environment, renamed Personal Productivity. That's good news for the rollout: no production app breaks when * becomes Blocked, as long as the allowlist is right.
One connector carries most of the usage. Field Services has 16 connections. Everything else has one or two. Whatever happens, that one must keep working.
One connector has no connections. Databricks Reporting exists but nobody has connected to it. That's a question for its owner, not an automatic allow.
Step 3: Classify every host
Every host goes into one of three buckets: allow, ask the owner first, or don't allow. Four questions decide it:
- Who controls the host?
- What can the connector do with the user's rights?
- Does anything actually use it?
- Does the data stay on infrastructure the organisation manages?
Classification by host type
This table is the reference I use in any tenant:
| Host type | Examples | Bucket | Why |
|---|---|---|---|
| Your own APIs behind Entra application proxy or API Management | fieldservices-contoso.msappproxy.net, contoso.azure-api.net | Allow the exact host | You control the host and the sign-in. Never allow *.msappproxy.net, which includes every other organisation's apps. |
| Microsoft APIs with a clear purpose | api.fabric.microsoft.com, learn.microsoft.com | Allow | Known vendor, and the purpose is easy to state. |
| SaaS vendors with a contract | The vendor's API host | Allow after a check | Someone owns the contract and the data agreement. |
| Management-plane APIs | management.azure.com, graph.microsoft.com | Ask | They act on resources, mail, files or the directory, depending on the permissions granted. |
| Shared cloud services | *.azuredatabricks.net, *.azurewebsites.net | Ask, then allow the exact host | A wildcard also allows other organisations' instances. |
| Plain HTTP | http:// anything | Ask, plan a move to HTTPS | Data travels unencrypted. |
| Zero connections | Any host | Ask | An unused pattern stays in the policy forever. |
| Tunnels and personal devices | *.ts.net, *.ngrok-free.app, *.devtunnels.ms | Don't allow, tell security | Company data leaves managed infrastructure. |
| Public demo and test APIs | pokeapi.co | Don't allow | No business purpose in a governed tenant. |
| Raw IP addresses | https://203.0.113.10/ | Don't allow unless documented | Nobody can tell who owns it, and it can change. |
The Contoso inventory, sorted

Allow:
- Field Services at
fieldservices-contoso.msappproxy.net. An internal API published through Entra application proxy. The host is Contoso's, authentication runs through Entra, and 16 connections depend on it. - Fabric Reporting, Microsoft Learn and Release Notes. Microsoft APIs with a clear purpose.
Ask the owner first:
- VM Management at
management.azure.com. This is the Azure management plane. A connector against it can create, change and delete Azure resources with whatever rights the signed-in user has. It may be legitimate, but someone has to own that decision. - Databricks Reporting with zero connections. Ask whether it's still needed. If it is, allow the exact workspace host, never
*.azuredatabricks.net. - Field Services (legacy) at
http://fieldservices.corp.contoso.com. Unencrypted HTTP, same name as the application proxy version, one connection. It looks like a leftover from before the proxy existed. Confirm that with the owner and let it go.
Don't allow:
- Expense Helper at
home-server.tail0a1b2c.ts.net. Ats.nethost is a Tailscale tunnel. This connector sends company data to a device on someone's personal network. Don't wait for the policy rollout to deal with this. Raise it with security the same day. - Pokemon API at
pokeapi.co. A public demo API. Fine for learning in a sandbox, no place in a governed tenant.
Step 4: Turn hosts into patterns
The policy wants URL patterns, not hosts. I take each approved HostUrl from the inventory, drop the trailing slash and add *, the form Microsoft uses in its own example. For Contoso:
https://fieldservices-contoso.msappproxy.net*
https://api.fabric.microsoft.com*
https://learn.microsoft.com*
https://www.microsoft.com*Rules to get right:
- Know what the documented form allows. Microsoft's example is
https://www.mycompany.com*, and that's the only matching guidance it publishes. Read as a wildcard, it also matches a look-alike host such aswww.mycompany.com.example.net, and PowerShell's-likeoperator does match it. Exploiting that takes a maker in your tenant who builds a connector to such a host. If you want to rule it out, tryhttps://host/*in the sandbox test in Step 6, and only use it if the test connector still runs. - Scheme matters. A plain-HTTP endpoint needs a pattern that starts with
http://, such ashttp://fieldservices.corp.contoso.com*. - Match the data group. Put each allowed pattern in the same data group as the connectors it's used with. Field Services is used with SharePoint, which is Business, so the pattern goes in Business. Put it in Non-Business and every flow that combines the two breaks.
- Order matters. Rules are evaluated top to bottom and
*is always last (Microsoft Learn). - Ignore is only available on
*. Every other pattern is Business, Non-Business or Blocked. - Patterns only, at tenant level. If a custom connector was added to the tenant policy by name through PowerShell, that classification overrides the URL patterns. Microsoft recommends only URL patterns in tenant-level policies, because a connector's name has no meaning outside its environment.
- Policy evaluation runs before "Set host URL". A connector whose host is allowed can still redirect to another API at runtime through that policy template. The data policy can't see it. That's why only trusted makers should build custom connectors, and why the CreatedBy column matters.
Close the HTTP side door
Custom connectors aren't the only way to call any endpoint. The HTTP, HTTP Webhook and When an HTTP request is received connectors are prebuilt connectors you classify in the same policy (connector classification). If they sit in Business next to SharePoint, your custom connector allowlist has a side door.
Be careful when you move them. Child flows depend on the HTTP connector internally, so its data group affects whether child flows run. For shared environments such as the default environment, Microsoft's advice is to classify HTTP as Non-Business or block it, and to give makers who need it a dedicated environment. For finer control, connector endpoint filtering limits the HTTP connectors to specific endpoints. It's in preview.
Step 5: Add the patterns while * is still Ignore
While * stays on Ignore, connectors that match no pattern keep working as before. Connectors that do match are classified straight away and now follow the pattern's data group. That's useful: a data group mistake shows up now, on a few known connectors, instead of on flip day. Add the patterns when the connector owners know it's happening.
In the admin center
Open the policy, go to Custom connectors and select Add connector pattern. Enter the pattern, choose the data group and save. New patterns land just above *.

Or with PowerShell
With more than a handful of hosts, I keep the approved list in a CSV and let a script build the rules. That CSV becomes the source of truth for every request later. Save it as allowed-patterns.csv:
Order,Pattern,DataGroup
1,https://fieldservices-contoso.msappproxy.net*,Business
2,https://api.fabric.microsoft.com*,Business
3,https://learn.microsoft.com*,Business
4,https://www.microsoft.com*,BusinessThen apply it. Your tenant ID is on the overview page of the Microsoft Entra admin center. The policy name is the policy's GUID, not its display name, and Get-DlpPolicy lists it.
$TenantId = "<your-tenant-id>"
$PolicyName = "<policy-guid>" # the GUID from Get-DlpPolicy, not the display name
$CatchAll = "Ignore" # change to "Blocked" on the announced date
# Save the current patterns first, so nothing added in the admin center gets lost unnoticed
Get-PowerAppPolicyUrlPatterns -TenantId $TenantId -PolicyName $PolicyName |
ConvertTo-Json -Depth 10 | Set-Content ".\url-patterns-before-$(Get-Date -Format yyyyMMdd-HHmm).json"
# The admin center says Business and Non-business, PowerShell says Confidential and General
$classification = @{ "Business" = "Confidential"; "Non-business" = "General"; "Blocked" = "Blocked" }
$allowed = Import-Csv .\allowed-patterns.csv | Sort-Object { [int]$_.Order }
$rules = @()
$order = 1
foreach ($p in $allowed) {
$rules += @{ order = $order; customConnectorRuleClassification = $classification[$p.DataGroup]; pattern = $p.Pattern }
$order++
}
# The * rule always goes last
$rules += @{ order = $order; customConnectorRuleClassification = $CatchAll; pattern = "*" }
New-PowerAppPolicyUrlPatterns -TenantId $TenantId -PolicyName $PolicyName -NewUrlPatterns @{ rules = $rules }
Get-PowerAppPolicyUrlPatterns -TenantId $TenantId -PolicyName $PolicyNameMicrosoft's cmdlet reference says New-PowerAppPolicyUrlPatterns creates URL patterns for a policy. It doesn't say whether it replaces an existing list or adds to it. That's why the script saves the current list to a JSON file first and reads the result back at the end. Compare the two before you move on. I built the script from the syntax on Microsoft Learn and tested the rule building locally, so run it against the sandbox test policy from Step 6 before your main policy.
Step 6: Check, test and pilot, then flip * to Blocked
Run the impact check
Before you flip, find out exactly what will stop working. This script matches every host from the inventory against the allowed patterns, in order, and marks the rest as blocked:
$allowed = Import-Csv .\allowed-patterns.csv | Sort-Object { [int]$_.Order }
$rows = Import-Csv .\custom-connectors.csv
$rows | ForEach-Object {
$hostUrl = $_.HostUrl
$match = $allowed | Where-Object { $hostUrl -like $_.Pattern } | Select-Object -First 1
[pscustomobject]@{
Result = if ($match) { "Allowed ($($match.DataGroup))" } else { "BLOCKED" }
Environment = $_.Environment
Connector = $_.Connector
HostUrl = $hostUrl
Connections = [int]$_.Connections
}
} | Sort-Object Result, Environment, Connector | Format-Table -AutoSizeFor Contoso it returns:
Result Environment Connector HostUrl Connections
------ ----------- --------- ------- -----------
Allowed (Business) Contoso - Dev Microsoft Learn https://learn.microsoft.com/ 2
Allowed (Business) Contoso - Dev Release Notes https://www.microsoft.com/ 1
Allowed (Business) Personal Productivity Fabric Reporting https://api.fabric.microsoft.com/ 1
Allowed (Business) Personal Productivity Field Services https://fieldservices-contoso.msappproxy.net/ 16
BLOCKED Personal Productivity Databricks Reporting https://adb-1234567890123456.7.azuredatabricks.net/ 0
BLOCKED Personal Productivity Expense Helper https://home-server.tail0a1b2c.ts.net/ 1
BLOCKED Personal Productivity Field Services (legacy) http://fieldservices.corp.contoso.com/ 1
BLOCKED Personal Productivity Pokemon API https://pokeapi.co/api/v2/ 1
BLOCKED Personal Productivity VM Management https://management.azure.com/ 1Every BLOCKED row with a connection is a conversation to have before the date. Here that's four connectors, which matches the ask and don't-allow buckets. The -like operator is PowerShell's wildcard match, not the policy engine, so treat the result as a forecast.
Test the patterns in a sandbox
The main policy can't tell you whether a pattern works. While * is Ignore, a connector that misses its pattern simply keeps working, and you only find out on flip day, everywhere at once. Power Platform data policies have no simulation mode, so the test is a second, small policy where a miss is blocked:
- Create a test connector. In a sandbox environment, build a custom connector with one simple action against an approved host, such as
learn.microsoft.com. - Create a test policy. Make a new tenant-level policy and scope it with Add multiple environments to the sandbox only. Leave the prebuilt connectors in the default Non-Business group. On the Custom connectors step, add your pattern as Non-Business and set
*to Blocked. - Wait for it to apply. Policy changes usually take effect within an hour and can take up to 24 hours (latency).
- Prove the match. Use the test connector in a flow. It must run.
- Prove the block. Change the connector's host to one that isn't on the list, such as
pokeapi.co. The flow must now be flagged by the data policy.
Why Non-Business in the test policy: a new policy puts every prebuilt connector in Non-Business by default. With the pattern in the same group, the test policy only decides whether a connector is blocked. All policies that apply to an environment are evaluated together, so the data groups still come from your main policy.
Pilot on the dev environments
When the test passes, add all approved patterns to the test policy and widen its scope to your dev environments. That's the flip on a small scale. Leave it for a week or two, and fix whatever breaks there first.
Flip in this order
- Agree the buckets with whoever owns governance. Share the inventory, the impact check and the pilot results, and get a written yes before anything changes.
- Talk to the owners of every BLOCKED row. Some will move to allow with a good reason. Some will delete their connector before you ever block it.
- Set an admin contact for the error message. Data policy errors can show an admin contact and a link to your governance page, set through PowerShell (impact on apps and flows). Makers who hit the block then know who to ask.
- Announce a date, then set
*to Blocked in the main policy. Change the*rule in the admin center, or run the script again with$CatchAll = "Blocked". Once the change has applied, delete the test policy.

What happens after the flip
Once * is Blocked, any custom connector whose host matches no pattern stops working in every environment in the policy's scope. Apps that use it show a data policy error when someone opens them. Flows are marked Suspended and don't run until the violation is fixed.
The change isn't instant. Apps and flows check for policy changes periodically (process for policy changes). In most tenants full enforcement takes less than an hour, and in the largest it can take up to 24 hours. One known gap: apps last published before October 2020 aren't covered by custom connector enforcement at all (known limitations).
Step 7: Run it after go-live
Handle requests for new hosts
Every new custom connector now needs an approved pattern before it works, so make asking easy. A request needs:
- the connector name and environment,
- the host URL,
- the owner and the business purpose,
- the data it reads or sends,
- the connectors it's combined with, which decide the data group.
Approved hosts go into allowed-patterns.csv and through the same script. Keep that file in source control and every change has a date and a reason.
Re-run the inventory every month
Run the inventory and the impact check once a month. BLOCKED rows with connections are makers who hit the wall without asking. New hosts show you integrations before they reach production.
Roll back without reopening everything
If something important breaks, add the missing pattern instead of setting * back to Ignore. Ignore reopens every host at once, so keep it as a last resort. Either way the change takes time to roll out. Afterwards, check the flows that were suspended.
Troubleshooting: PowerShell on a locked-down machine
On a managed laptop behind a proxy, installing the module took me four rounds of error and fix. Each one maps to a line in the install script in Step 2.
1. Install-Module fails with "No match was found". The PowerShell Gallery wasn't reachable. Get-PSRepository returned "Unable to find module repositories", so there was no repository registered at all. Forcing TLS 1.2 alone did not help. What worked was passing my default credentials to the proxy and re-registering the default repository.
2. "Running scripts is disabled on this system". The execution policy blocked the module's scripts. Setting it for the current process only avoids a change to the machine and needs no admin rights.
3. Add-PowerAppsAccount fails with "ActiveX control ... cannot be instantiated because the current thread is not in a single-threaded apartment". The sign-in dialog needs an STA thread. There are three known workarounds: run the cmdlet a second time, use PowerShell ISE, or start powershell.exe -STA.
4. The module needs Windows PowerShell 5.x. Not PowerShell 7. If you're in pwsh, open the blue Windows PowerShell instead.
FAQ
Which role do I need to govern custom connectors?
Power Platform Administrator or Global Administrator. You need it to create a tenant-level data policy and to see every environment in the admin PowerShell cmdlets. An environment admin only sees their own environments.
Does setting * to Blocked break existing apps and flows?
Yes, for every custom connector whose host matches no pattern, in every environment in the policy's scope. Apps show a data policy error and flows are suspended. Run the impact check, test your patterns in a sandbox and pilot on dev environments first.
Can I use an environment-level policy instead?
Environment admins can classify custom connectors by name, one environment at a time. A tenant-level policy uses URL patterns and covers many environments at once, which is what an allowlist needs.
How do I allow a new endpoint later?
Add a pattern for its host above the * rule, in the data group of the connectors it's used with. Keep the approved list in a CSV and apply it with the script from this post.
Do advanced connector policies replace this?
Not yet. Advanced connector policies cover certified connectors only. Microsoft says to keep using classic data policies for custom connectors and HTTP connectors.
Published , updated

