DEV Community

Rajat Kumar
Rajat Kumar

Posted on

The 20-Minute Miracle: How PowerShell Ends the "Manual Grind" in Azure

We've all been there: a high-stakes production request lands on your desk, and the "traditional" way to solve it is a soul-crushing manual process.

I recently faced this exact scenario. We had 2,000 users who needed specific licenses assigned in Azure immediately. It was critical, time-sensitive, and high-pressure. My team started doing what we usually do, opening the Azure Portal, searching for a user, clicking 'Licenses,' selecting the SKU, and hitting save one by one.

At that rate, we would have been there for days. I decided to step back, open a terminal, and let PowerShell do the heavy lifting.

The Problem: The "Click-Ops" Bottleneck
Manual work in the Azure Portal (often called "Click-Ops") is fine for one or two users. But at scale, it's a liability.

Human Error: After the 50th user, you will misclick. You'll miss a license or assign the wrong one.

The Time Sink: If it takes 60 seconds per user, 2,000 users would require 33 hours of nonstop clicking. That's not a job; that's a prison sentence.

Inconsistency: There's no record of how it was done, making it impossible to audit or repeat later.

The Solution: Scripting the Intent
While the team was clicking, I spent 20 minutes writing a script. The goal wasn't just to "do the task," but to create a repeatable logic.

By using the Microsoft Graph PowerShell SDK, the logic became simple:

Connect: Authenticate once to the tenant.

Identify: Pull the list of 2,000 users (from a CSV or an Azure AD Group).

Execute: Run a foreach loop that tells Azure: "For every person in this list, assign this specific SKU ID."

The script took 20 minutes to write and test on a single user. Once I hit 'Run,' it took exactly 20 more minutes for Azure to process all 2,000 assignments.

Why This is a Mindset Shift, Not Just a Script
This isn't just about saving time; it's about how we value our energy as engineers.

Scale is Irrelevant: The script doesn't care if it's 2,000 users or 20,000. The effort for me remains the same.

Auditability: I now have a .ps1 file that serves as documentation. If someone asks, "Who got these licenses?" I can show them the code and the input file.

Self-Healing Automation: We can take this further. Instead of a one-time script, we can put this in an Azure Automation Runbook. Now, whenever a user joins a specific department, the license is assigned automatically. No one ever has to click "Assign" again.

The Takeaway for Engineers
If a task feels repetitive, it is a candidate for automation. The 40 minutes I spent (20 writing, 20 running) saved my team an entire work week of manual labor. That is the true power of being an "Automation-First" engineer. We aren't paid to click buttons; we're paid to build the systems that click the buttons for us.

Top comments (0)