I recently had a fun task come across my desk. A customer of mine has a large tenant, with a lot of Power Apps and a lot of Power App makers. They’re doing a tenant migration, and the Power Apps themselves will likely move over pretty easily. A lot of them are connecting to the tenant’s SharePoint site, and after the tenant move those SharePoint URLs are going kaput. The customer wanted to be able to find out which Power Apps were going to be broken so they could reach out to the owners to get them fixed. That’s where I, and my PowerShell prowess came in.
I had whipped up some quick and dirty PowerShell for this customer before so they asked if I could work my magic with this. I have dabbled a bit with the Power Apps and Flow Power Automate PowerShell in the past, and while I found it… lacking, I figured this was something it could handle. Here is the PowerShell I eventually went with:
Get-AdminPowerApp | ForEach-Object { if (Get-AdminPowerAppConnectionReferences -EnvironmentName $(Get-PowerAppEnvironment).EnvironmentName -AppName $_.AppName | Where-Object -Property ConnectorName -EQ -Value "shared_sharepointonline") {$_ | Select-Object DisplayName, @{Label="Owner";e={$_.Owner.displayName}},@{Label="Email";e={$_.Owner.userPrincipalName}}, AppName }}
Here’s what it looks like when it runs:
I have the following two Power Apps modules installed with these versions:
2.0.61 Microsoft.PowerApps.Administration.PowerShell
1.0.9 Microsoft.PowerApps.PowerShell
(Full list of Office 365 PowerShell modules)
You’ll get prompted to log in. The account will have to have the necessary permissions to enumerate all of the Power Apps in the tenant.
I know what you’re thinking, “Todd, that’s amazing! Solid work! I hate to seem greedy, but, um, where is the URL of the SharePoint site the Power App is connecting to?” That’s a funny story, but the punchline is, there isn’t a way. At least not from the PowerShell modules we have today. Apparently the Center of Excellence Starter Kit has a way to get that information, but it’s a really big hammer for a nail this small.
This will work for any of the Connectors. You can use the following PowerShell to see all Connectors that are in use:
Get-AdminPowerAppConnection | Select-Object ConnectorName
That will give you the value you need to search for with the Where-Object. If you’re looking for more ways to abuse Power Apps and Power Automate with PowerShell (so many Powers there) you can watch Shane’s so-so PowerShell for PowerApps and Flow video. It’s okay. I guess. In a pinch.
Enjoy.
tk
ShortUrl: https://www.toddklindt.com/PoshFindPowerAppsConnectors