In a previous couple of articles I talked about how we used some powershell scripts to help identify and clean unused API connections.

We wanted to be able to automate these so that we can make this process a bit more streamlined. In this scenario we were using classic pipelines.

Pipeline 1

In this case we used a build pipeline which would trigger weekly and it would run the identify stage for all of our environments and we then publish a build artefact with the list of connections which are unused. You can see below that we have a pre-req script which just installs Az.RessourceGraph and then we run the identify script for each environment.

We then want to clean our build (CI) environment every week when this runs too.

Pipeline 2

We then created a release pipeline which we would run on demand when we want to clean other environments. We need to raise a change control for production so we will probably run this pipeline every few months and then trigger the pipeline which will clean the system test environment then it will seek approvals for UAT and Prod.

Below is the content of the stage.

You can see its a simple setup but just another of these things you want to do to keep your environments organized and remove clutter than can build up over time.


Buy Me A Coffee