A common piece of feedback I get from people who author ARM templates is that the design experience isn’t as great as it could be. There is some tooling in the full version of Visual Studio which helps get you started. But a lot of people don’t install Visual Studio as it seems overkill. After all, it’s just managing the text files that make up your typical ARM file based project. That got me thinking that surely there should be an easier way, and then the idea hit me! I set off to make a set of Yeoman generators for ARM resources. I think what I’ve come up with here will be super useful to a lot of people. Continue reading “Yo arm-template! Generating ARM templates with Yeoman”
Anyone that has talked to me recently about how I write PowerShell scripts will know that Visual Studio Code is my new one and only! You can write PowerShell scripts in there and hit F5 to have a similar debugging experience to what you would get in PowerShell ISE – but did you know that you can extend that to make it easier to debug and test different scenarios from within VS Code? If the answer to that is no, then read on! Continue reading “Using the launch.json file in VS code for improved PowerShell debugging”
Most people that I talk to about my experiences writing PowerShell scripts these days will know that Visual Studio Code is my absolute preference for editor these days. It’s a great tool with lots of little tricks to help you improve your productivity – and recently I came across another one to help when I work on SharePoint related scripts for SharePointDsc, and this is how I add intellisense for SharePoint PowerShell cmdlets when I’m authoring scripts on my laptop (which doesn’t have SharePoint installed on it). Continue reading “Adding additional intellisense to VS Code when editing PowerShell scripts”
PowerShellGet is a new module that is installed as part of PowerShell 5 (in Windows Management Framework 5.0) which allows you to easily connect to remote repositories to install PowerShell modules from. When you install WMF5 you’ll get a repository configured to point to the PowerShell Gallery, where you can download the release versions of all of the PowerShell teams DSC resources. However if you want to use the preview (in development but not yet released) builds, you have the option to connect to a secondary repository where the dev builds are created and install those directly to your machine. Continue reading “Consuming preview builds of xSharePoint through PowerShellGet”
Update: If you’re reading this then be sure to have a read of the comments too – some good insight and points from nohwnd on the Pester team that are also worth considering if you are interested in this stuff.
Update 2: I’ve posted a new post related to this which shows an improved way to test SP cmdlets
As we see PowerShell scripts get more and more complex (lets face it scripting guys, you’re basically writing code – we’ve turned you in to developers without you realising it! :P) people are discovering the need for things that help us maintain complex code bases, such as unit testing. Pester is a great tool for being able to write unit tests for PowerShell scripts, and will even integrate in to Visual Studio so you can run tests as you are writing your scripts. The way Pester lets us perform some pretty complex scenarios is through the ability to mock specific functions in a script, specifying what parameters to watch for in the input and what we will return from our mock – but for these mocks to work Pester needs to be able to see the original cmdlet or function you are mocking, which gets more complex in a SharePoint environment. Continue reading “How to unit test PowerShell scripts that call cmdlets from the SharePoint snap-in”