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.
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.
Choose the Blank Template by Microsoft.
You then have a new solution and project in Visual Studio 2015 that looks something like this.
Next, copy and paste everything from the template folder into the root of the project folder.
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.
Once complete, my project looked like this in Visual Studio 2015.
From here, I can right-click on the project and proceed with the deployment process as described in http://contoso.se/blog/?p=4142, 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.
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.
Again, Any and all feedback is invited.