Skip to content
Custom tool linking relative paths for ARM templates in Visual Stuido.
C# PowerShell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
packaging Fiddling with packaging. Jan 22, 2020
src Links in PS module and some updates of the readme file. Jan 23, 2020
test/ARMTestProject Grasping at straws to enable simple custom tool code gen for armdeplo… Jan 12, 2020
.gitignore Fiddling with packaging. Jan 22, 2020
license.txt Seems to handle errors well, but have no idea how to show them. :/ (P… Jan 10, 2020
readme.md More concise readme Jan 27, 2020

readme.md

Overview

ARM Templates does not support local and relative paths. The only way to link to other files is to put them online.
This tool expects local and/or relative paths and merges your ARM templates into a one template.
A fuller narrative with example usage can be read on my blog here.

Install

install-module ARMLinker

PowerShell Usage

import-module ARMLinker
Convert-TemplateLinks -InputPath <path to main template> [-OutputPath <path to output file>]

If no output path is specified, the merged JSON is written to output.

Example input/output

azuredeploy.linked.json

{
    "$schema": "https//schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "parameters": {},
    "resources": [
        {
            "templateLink": {
                "uri": "./aresource.json"
            }
        }
    ]
}

aresource.json

{
    "type": "Microsoft.Web/connections",
    "apiVersion": "2016-06-01",
    "properties": "..."
}

Running Convert-TemplateLinks azuredeploy.linked.json azuredeploy.json will output a merged version of the two in a file called azuredeploy.json:

{
    "$schema": "https//schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "parameters": {},
    "resources": [
        {
            "type": "Microsoft.Web/connections",
            "apiVersion": "2016-06-01",
            "proper": "properties were probably here"
        }
    ]
}

If the JSON you want to link is at some deeper level in the linked JSON, you can specify a "jsonPath" as well:

azuredeploy.linked.json

{
    "$schema": "https//schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "parameters": {},
    "resources": [
        {
            "templateLink": {
                "uri": "./aresource.json",
                "jsonPath": "special.path"
            }
        }
    ]
}

aresource.json

{
    "special": {
        "path": {
            "type": "Microsoft.Web/connections",
            "apiVersion": "2016-06-01",
            "properties": "..."
        }
    }
}

Incidentally...

This works with any JSON, but the main goal is for ARM templates.
Hence following the same convension as the supported "full online URL" feature.

You can’t perform that action at this time.