In my previous post on using VS Code for authoring ARM templates I recommended using an ARM Snippets from the plugin gallery. However since then I have come to realise this plugin is fairly limited in the amount of plugins, and difficult to extend. Given this I would now recommend utilising the set of snippets provided by the Azure Cross Platform Tooling Samples
These snippets don’t have a nice VS Code Gallery plugin to install them, but they are much more extensive, and most importantly it is easy to add your own and also commit these back to the repository to share with the community.
As there isn’t a nice gallery installer you do need to install these manually, but it’s a pretty straightforward process:
1. Browse to the snippets file on Github – https://github.com/sam-cogan/azure-xplat-arm-tooling/blob/master/VSCode/armsnippets.json
2. Copy the contents of the file to your clipboard.
3. Launch Visual Studio Code.
4. Navigate to File > Preferences > User Snippets > JSON.
Append (paste) the contents of the Github file into your user snippets file before the final “}”.
5. Save and close the user snippets file.
Once you have the snippets installed, open up or create a .json file and type “arm”, VS Code should then present you with an auto-complete menu with all the snippets listed.
Select the snippet you want and it will appear in your editor. Edit the fields that require it and your good to go.
If you do end up adding your own snippets to this, don’t forget to commit them back to share with the rest of us!