Find Orphaned Azure API Connectors in all Resource Groups with PowerShell

  • Sandro Pereira
  • Jul 12, 2021
  • 3 min read

Background: Finding Orphaned Azure API Connectors

Recently, I published my own version of a PowerShell script originally created by Mike Stephenson: Find Orphaned Azure API Connectors with PowerShell. That script scans all API Connections in a specific resource group and inspects every Logic App to determine whether those connections are still in use.

The main goal of that script is simple: quickly and effectively identify orphaned API Connections within a single resource group.

Improvements over the Original Script

I adapted the original script to better suit my needs and improve its usability. These changes focus mainly on output clarity and reporting:

  • Produce a clearer and more readable output.
  • Automatically add a Deprecated tag to all API Connectors, with a value of True or False.
  • Extend the CSV report generation with additional customization options.

These enhancements make it easier to review results and decide which connectors require cleanup.

Limitation of the Initial Approach

The main limitation of the original script is its scope. It only checks one resource group at a time.

In environments with multiple resource groups, this approach forces you to reconfigure and run the script repeatedly. For example, if your subscription contains three or four resource groups, you must execute the script the same number of times.

Expanding the Script to All Resource Groups

To streamline this process and avoid unnecessary repetition, I decided to create a new version of the script.

This updated script scans all API Connections across every resource group in a single Azure subscription. It then inspects the Logic Apps within each resource group to verify whether their API Connections are still in use or not. This approach significantly reduces execution time and simplifies administration in larger environments.

📝 One-Minute Brief

Managing Azure Logic Apps at scale often leads to unused API Connections spread across multiple resource groups. This article extends a previous PowerShell approach by scanning all resource groups in a subscription to identify orphaned Azure API Connectors, helping administrators clean up resources and improve governance.

What’s new on this PowerShell script:

  • It will check in all Resource Groups available on a single Subscription if API Connections are being used or not.
  • Subscription Details output is improved, with coloring to better read:
API Connectors
  • The list of available API Connectors grouped by Resource Group output is improved, with coloring to better read:
API Connectors
  • List of Logic Apps and API Connectors association group by Resource Group and Logic App output is improved, with coloring to better read:
Logic Apps binded to API Connectors
  • The list of Orphaned API Connectors ordered by Resource Group output is improved, with coloring to better read:
Orphaned API Connectors

Download

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

You can download Find Orphaned API Connectors in all Resource Groups 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