Project Grasshopper: DIY Pipelines with PowerShell and PAC CLI
Last week, I shared my post, 10 Lessons Learned about DevOps in Power Platform. The real lessons were in the comments, where Agnius Bartninkas (whose Power Automate Desktop framework is the real deal) made the gentle suggestion that my environment strategy was not what he would recommend in most cases, if ever. But if I insisted on continuing with my setup, he added, there were two ways forward: Azure DevOps Pipelines (instead of Power Platform Pipelines); or PAC CLI “with some PowerShell magic.”
Magic, you say?
Let’s do it.
To recap: A simple and effective three-environment strategy consists of a single solution moving from Dev to Test and Prod using Power Platform Pipelines. First, you make changes in Dev. Then, get someone to try those changes in Test. Finally, deploy to Prod. Me, I want at least three development sandbox environments, with the option to spin up more, all linked to the same base layer and apps.
The idea is to have a set of base layer database tables powering different apps and different websites for different clients. For example, with my QR Cards program for destination marketing organizations, the base layer handling content management for destinations and activities can support one app for QR Card generation and a separate app for generative itinerary suggestions. These two apps don’t need to live together in the same environment, nor should they have to share the same website. ?
And someone might come along and say, “Hey, we love the product, but can we build a different website experience?” Or “Can we change the business logic for creating QR Cards?”
I want to say yes to those requests: “Yes, you can build a different website experience, and you can change the business logic, because you’ll have your own low-code development environment.” Do it yourself.
What’s the point of a low code environment unless everybody gets to play?
Here’s a sketch of my approach:
?
The hard part is keeping the versions synchronized between Dev environments.
In a simple application lifecycle management (ALM) strategy, a change in Dev needs only two deployments: one to Test and one to Prod.
With my approach, any change also requires deployments to every downstream development environment. When you make a change to an App, you need to update one or more Sites environments. And if you make a change to the Base Layer, you need to update everything to the right – all the Apps, all the Sites, all at once.
pac 4ever, man!
I fired up VS Code with Github Copilot and started experimenting with Microsoft Power Platform CLI, formerly PowerApps CLI, invoked with “pac” at the command line.
It really is magic. Instead of going to Power Apps, finding your solution, going to the menu and selecting Export, and then waiting for a link to download a file through your browser, you can type a one-line command that puts your <solution>.zip file wherever you like.
So how about a simple export/import script that says: “first, download solutions a, b, c from environments x, y, z; and then upload them where specified”?
About 1,300 lines of (AI-generated, human-reviewed) code later, that’s exactly what I wrote.
It ain’t perfect, but it gets the job done.
NOTES FROM PROJECT GRASSHOPPER
Day One (Wednesday): do not attempt
领英推荐
Day Two (Thursday): one step forward, two steps back
Day Three (Friday): hello it’s me me me
Day Four (Monday): may I see your badge again please
Day Five (Tuesday): what have I done
Closing thoughts
If I had to do it again, I would start with Azure DevOps.
But I’m glad I took the time to work on this project, for a few reasons:
DevOps appreciation. There’s nothing like a DIY project to motivate your interest in using professional tooling. ?
Learned a new mode of interactive programming. In the past, we had REPL, the Read-Evaluate-Print Loop. Now, we have CAT PEE:
·??????? Copilot: Ask AI to write code for you.
·??????? Accept: Whatever it writes, that looks good.
·??????? Test: Let’s see if it works.
·??????? Paste Error: Ask AI to figure out the cryptic errors and just fix whatever’s not working.
·??????? Explain: Oh ok, fine, I’ll figure it out myself, just tell me what you wrote earlier.
Ideal science project. It’s not like I have any paying clients for my app yet. But when I do, now they can build whatever they want on top of my solutions!
Skills showcase. Speaking of paying clients, I’ve spent the last year learning Power Platform and so far all I have to show for it are a couple of sweaty #PPCC24 Power Platform t-shirts that I use at the gym. (Oh, and a trophy!)
Beyond building out and commercializing my QR Cards project, I’m looking to work on a professional team in some capacity, to learn from the pros while getting hands-on with business challenges. I speak MBA, I’ve worked with top consulting companies, I know Power Platform and a growing number of Azure capabilities, and look! Now I’m this close to being an ALM pro. I'm particularly interested in working with Dynamics 365, because that’s where it all comes together.
If you have any ideas about a potential fit, let’s talk.
?
Operational Excellence and Automation Consultant | Power Platform Solution Architect | Microsoft Biz Apps MVP | Speaker | Author of PADFramework
1 个月Great job. I honestly did not expect you would actually go all the way and try this. Especially when you could have gone with Azure DevOps. But this must have been a great learning experience. Also loving the CAT PEE approach! You should absolutely coin that!