Power Platform Governance: Deleting unwanted environments with PAC CLI
Image Source: Shutterstock.com
Apr 21, 2023 7:00 PM

Power Platform Governance: Deleting unwanted environments with PAC CLI

External Blog Post

I recently ran a training session where the attendees created 25 trials in our training tenant. While trials expire in 30 days,

I recently ran a training session where the attendees created 25 trials in our training tenant. While trials expire in 30 days, I started wondering how I could automate the deletion of trials with PAC CLI (“Power Platform Command Line Interface”).

Why that and not Power Automate? Well, to be honest, I just wanted to learn how it’s done. We’re only talking about 25 environments so manually deleting them is faster than with Power Automate. But what about PAC CLI?

Determining what to delete

The first thing that we need to consider is how do we loop through all environments that we want to delete. Looping through them based on their type doesn’t seem to be possible in PAC CLI (correct me if I’m wrong and there’s a way to do it) so looking at their names is a logical option. Ok, so name it is. Now, let’s look at image 1 below to understand how the trial environments are named in the tenant. As we can see, the names are all over. There’s no specific naming convention for them, except how they become named by the platform on create. Field Service Trial is a good example of a platform named trial environment.

Open full article

Deleting unwanted Power Platform environments with PAC CLI - Forward Forever

What is The Power Platform Command Line Interface (CLI) ?

The Power Platform Command Line Interface (CLI) is a command-line tool that allows users to manage and automate various tasks related to the Microsoft Power Platform. The Power Platform is a suite of tools that includes Power Apps, Power BI, Power Automate, and Power Virtual Agents.

With the Power Platform CLI, users can perform a variety of tasks, such as creating and managing apps, flows, environments, solutions, and connectors. Users can also automate common tasks and integrate the Power Platform with other systems by creating scripts and using the CLI’s REST API.

The Power Platform CLI is a cross-platform tool, which means that it can be used on Windows, macOS, and Linux. It can be installed as a standalone tool or as part of the Power Platform Developer Tools for Visual Studio Code. The CLI uses Node.js and is designed to be easy to use and extendable.

Missing: PAC ‎CLI

In order to delete the site content records in one environment and also delete the same content records in another environment using the PAC CLI, you will need ...