I needed to create a script to automate some steps in Azure. I had mainly two options. Azure CLI and Azure PowerShell. CLI is a good option to do quick things on Azure because it’s easy to write and remember syntax. But when I want to create a script, PowerShell is the option for me because I am a .NET developer. PowerShell’s syntax and concept is more familiar to a .NET developer like me.
I can apply almost same object oriented programming concepts in PowerShell like what I used to do in C#. Ok, not all object oriented concept but at least I can break my solution into different classes with single responsibility. I can create properties and methods inside them. Create objects of that class and use the properties and methods.
GitHub – Arnab-Developer/PowerShellClassDemo: PowerShell class demo
Every PowerShell cmdlet returns some object you can store them in a variable and use the properties of them. You can use collection of object. You can use the .NET Framework level APIs in PowerShell.
Overall if you are a .NET developer and you need to automate some administrative work, PowerShell can be a very good choice for you. Syntax is different but the concept and the Framework level APIs are same like a .NET program.