Work with existing ARM templates in VS 2015

Extending some techniques found in the MVP blog posts below, I worked out a method for importing existing Azure Resource Manager (ARM) templates (e.g. custom Quickstart templates from the Gallery) into Visual Studio 2015 where you have a greater wealth of tools for working with them, not the least of which is the fabulous JSON viewer/editor.

I haven’t seen this exact method documented elsewhere and thought it might help some folks. I’m a long-time IT Ops pro but a relative newbie to cloud, so I haven’t worked this through end-to-end.  It’s merely a method for getting started. I encourage any and all corrections, additions, contributions, etc.

I’ll use a recent test of mine as an example. Say there’s an ARM template you downloaded from GitHub and (without getting into source control integration) you just want to make some changes and run the PowerShell script to deploy the resources to your environment.


Figure 1


In Visual Studio 2015 create a new project using the Azure ResourceGroup template.  I planned to work with additional templates, so checked the box to Create a directory for solution and named the Solution and Project accordingly.  Later, I will include another project in this solution with a template I downloaded from the Gallery to show another way this method can be used.


Figure 2


Choose the Blank Template by Microsoft.


Figure 3


You then have a new solution and project in Visual Studio 2015 that looks something like this.


Figure 4


Next, copy and paste everything from the template folder into the root of the project folder.


Figure 5a


Figure 5b


Figure 5c



Every template will be different. In some cases, it may be prudent to redistribute these files into the existing folder structure to optimize integration with Visual Studio functionality.  With this Quickstart template, a couple tweaks in the  Deploy‑AzureResourceGroup.ps1 script is all I need (see below) so everything was ok in the project root.

Next, right-click on the project and select Add > Existing Item (Shift-Alt-A), then select the new items you added to the root of the project folder.

Note: This only works for files. For folders, you have to go to the Project menu and select Show All Files (yes, it shows folders, too).  Then right-click the folder you wish to add and select Include In Project.

Again, every template will be different and I’m not sure what the best practice is.  For this one, I redirecting the Deploy‑AzureResourceGroup.ps1 to point to the azuredeploy.json and the azuredeploy.parameters.json files at the root, and removed the existing Templates folder from the project.


Figure 6


Once complete, my project looked like this in Visual Studio 2015.


Figure 7

From here, I can right-click on the project and proceed with the deployment process as described in, selecting the appropriate template Deployment template and Template parameters file when prompted.

As another example, I created a similar template in the MarketPlace Gallery using the Azure Portal, stopping just before the final creation step when the option to Download Template appears.


Figure 8


I followed similar steps except I placed the single template.json file download in the Templates folder and added it to the project file.  Here’s what that project looked like once it was set up.


Figure 9



Again, Any and all feedback is invited.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s