In my previous post on using VS Code for authoring ARM templates, I recommended using ARM Snippets from the plugin gallery. However, since then, I have come to realize this plugin is fairly limited in the number of snippets — and difficult to extend. Given this, I would now recommend utilizing the set of snippets provided by 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. Still, it's a pretty straightforward process:
- Browse to the snippets file on GitHub.
- Copy the contents of the file to your clipboard.
- Launch Visual Studio Code.
- Navigate to File > Preferences > User Snippets > JSON.
Append (paste) the contents of the Github file into your user snippets file before the final "}".
- 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!