Which is mightier? The Shell of Power or XrmToolbox and other methods?
So you’ve got a task you need to perform; It would be super repetitive and inefficient (or is even impossible) using the standard interface D365/PowerApps gives you. How are you going to do it?
XrmToolbox is great, I just need to load the tool, configure all the 15 options correctly and I’ll be golden. Task done!
Now what if this task needs to be repeated every X days, X week, or every time you (or others in the team) deploy to a different environment?
OK, so I’ll create a 5 page guide for people to follow with screenshots and all the info. Done!
So after 3 months of development and improvements, you now have a 25 page set of instructions.
That’s fine. We enjoy 5 hour deployments where we need to concentrate… if we make a mistake and miss or mess up some steps, there’s only 2 hours of extra troubleshooting we need to do to determine what is wrong… I take that back… there must be a better way?
XrmToolbox and other manual steps are wonderful for one off tasks. But as soon as your regular process depends on it (or any other manual steps where a human needs to drive), it’s a liability.
XrmToolbox can also be inflexible, because it’s only easy to complete the tasks that the author of each tool has catered for.
Why?
Just like for many things, automation is the answer!
PowerShell is a Microsoft scripting language that is the standard for automation for system administrators across all of their products. You’ve already got it installed if you are using Windows.
After some one time setup instructions to install a suitable module PowerShell can easily interact with Dataverse.
$c = get-dataverseconnection -interactive
get-dataverserecord -connection $c -entityname process |
set-itemproperty -name statuscode -value Inactive |
set-dataverserecord -connection $c
Now I just need to save this into a script file and it can be executed (along with anything else I add in future) every time we deploy.
You absolutely can. However in my experience both of these options are significantly harder to create and maintain as well as being less flexible when compared to a general purpose scripting language… that’s once you’ve got over the initial learning and when doing something non trivial of course.
Fair point! But it’s just as simple as PowerFX and the other expression languages you’ve already managed to pick up across the Power Platform.
Over time, I’m going to try and post some content to help you learn how to apply PowerShell to automate the things people are commonly doing manually during deployment.
Of course this is all a shameless plug for my project Rnwood.Dataverse.Data.PowerShell which improves on Microsoft.Xrm.Data.PowerShell - which is not actually provided by MS. Click the link if you want to know why!
Stay tuned!