Find Orphaned Azure API Connectors with PowerShell

  • Sandro Pereira
  • Jun 20, 2021
  • 3 min read

The Challenge of Managing Azure API Connections

Developing solutions on Azure is often straightforward. Managing Azure resources, however, is a different story. This PowerShell script focuses on simplifying one of those common administrative challenges.

What Are Orphaned API Connections?

When working with Azure Logic Apps, one recurring pain point is identifying API Connections that are no longer in use. These unused resources are commonly known as orphaned API Connections.

As Logic Apps evolve, developers update workflows to meet new requirements or fix issues. Over time, this process often leaves behind API Connections that no longer serve any purpose.

Why This Becomes a Problem

The Azure Portal does not make it easy to determine which API Connections are actively used by Logic Apps. It also provides no straightforward way to confirm whether a specific connector is orphaned.

As a result, environments quickly accumulate unused API Connections, increasing management overhead and making governance more difficult.

Why This Script Matters

This PowerShell script scans all API Connections in a resource group and checks whether any Logic App references them. By doing so, it helps administrators quickly identify orphaned API Connections and take informed cleanup actions.

📝 One-Minute Brief

Managing Azure Logic Apps over time often leads to unused API connections that are hard to identify in the Azure portal. This article presents a PowerShell script that scans a resource group, checks which API connectors are actually used by Logic Apps, and quickly highlights orphaned or deprecated connections to simplify cleanup and governance.

The Script

This PowerShell script scans all API Connections in a resource group and inspects every Logic App to determine whether those connections are still in use. It quickly highlights orphaned API Connections that have no Logic App references.

This script was initially created by Mike Stephenson, whom I took as a reference and improved or modified according to what I thought fit better to this task:

  • The script lists all API Connectors in a specific resource group and displays only the connector names, instead of the full IDs, to make the output easier to read:
Found connectors
  • The script lists API Connectors used by each Logic App and groups them per Logic App to make the output easy to read:
Bind connector with Logic App
  • The script also lists deprecated API Connectors and filters the output to show connectors marked as deprecated. This behavior serves the script’s main purpose, as it clearly identifies deprecated and orphaned API Connectors.
orphan connectors
  • Add a Deprecated tag on all the API Connectors. The reason to add this tag is that sometimes I just want to reference them and manually double-check on the subscription, talk with the development team, or make these changes (remove these API Connectors on the next intervention window, if companies have this kind of policy) :
    • If it is orphaned, then the value of this tag will be true.
    • Otherwise, the value of this tag will be false.
tags deprecated
  • The output CSV format now includes the option for you to specify what CSV character you want to use as a separator or delimiters, like a comma or a semicolon.

Download

THIS POWERSHELL SCRIPT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.

You can download Find Orphaned API Connectors from GitHub here:

Hope you find this helpful! If you liked the content or found it useful and would like to support me in writing more, consider buying (or helping to buy) a Star Wars Lego set for my son. 

Thanks for Buying me a coffe
Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

Leave a Reply

Your email address will not be published. Required fields are marked *

The Ultimate Cloud
Management Platform for Azure

Supercharge your Azure Cost Saving

Learn More
Turbo360 Widget

Back to Top