# Preserve the main-template context when testing one ARM file

> Does limiting an ARM toolkit run to one file remove its need for a recognized main template?

- Canonical URL: https://update.dsesecurity.com/updates/dse-20260909-428-preserve-the-main-template-context-when-testing-one-arm-file/
- Publisher: Detection Systems & Engineering (DSE Security)
- Author: DSE Security Editorial Team
- Published: 2026-09-10T00:24:48+00:00
- Modified: 2026-09-10T02:04:57+00:00
- Last reviewed by DSE: 2026-09-09
- Resource type: Guide
- DSE priority: Information
- Topics: IT, Networks & Infrastructure
- Reading time: 2 minutes

## What you need to know

Does limiting an ARM toolkit run to one file remove its need for a recognized main template?

## Potentially affected

ARM JSON template packages tested with Test-AzTemplate and its File option.

## DSE recommendation

DSE recommends retaining the main template and the relevant package structure while running the focused test.

## Article

## Source facts

With TemplatePath, the ARM test toolkit identifies azuredeploy.json or maintemplate.json as the main template and examines other templates as linked templates. Selecting one file through the File option still requires that recognized main template in the folder. The toolkit targets ARM templates; Microsoft directs Bicep validation to the Bicep linter. [Microsoft Learn](https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/test-toolkit).

## Applicability

Use this check when narrowing a package test to investigate one template. Identify the package root, the recognized main file and the selected file explicitly. Do not treat an isolated JSON file copied into an unrelated directory as equivalent to the original package context.

## DSE recommendation

DSE recommends retaining the main template and the relevant package structure while running the focused test. Record the command’s path and file selection with the result so a reviewer can distinguish a targeted diagnostic from a package-wide run. Keep the focused result separate from the complete validation required by the release process, and do not suppress a missing-context problem by simply omitting the test.

## Verification

Run a controlled focused check from the intended package directory and verify which file the result names. Follow it with the appropriate full-package check, retaining the main-template revision and test selection for both. Confirm the validation tool matches the source format before interpreting a clean result. A successful focused test should be reported as that specific test, not as evidence that every template and supporting file was examined.

## Official references

[Microsoft Learn](https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/test-toolkit). Source retrieved September 9, 2026.

## Primary reference

- Name: ARM template test toolkit - Azure Resource Manager | Microsoft Learn
- Authority: Microsoft Learn
- URL: https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/test-toolkit
- Source publication date: Not stated by the source

## Citation and use

Preferred citation: “Preserve the main-template context when testing one ARM file,” DSE Security, https://update.dsesecurity.com/updates/dse-20260909-428-preserve-the-main-template-context-when-testing-one-arm-file/
Publishing principles: https://update.dsesecurity.com/updates/dse-updates-editorial-methodology/
Usage and citation policy: https://update.dsesecurity.com/usage/
Copyright © 2026 Detection Systems & Engineering. All rights reserved.
