Skip to content

manishkulkarni/arm-ttk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure Resource Manager Template Toolkit (arm-ttk)

The code in this repository can be used for analyzing and testing Azure Resource Manager Templates. The tests will check a template or set of templates for coding best practices. There are some checks for simple syntactical errors but the intent is not to re-implement tests or checks that are provided by the platform (e.g. the /validate api).

Note: Starting with the 0.10 release, Bicep now contains all of the deploymentTemplate test cases included in the TTK. We will begin moving the investment in new tests to the Bicep linter. The TTK will remain available to support available JSON and createUiDefinition scenarios.

Using the TTK

For detailed instruction on how to use the arm-ttk, see this readme. More information can be found in the documentation.

For a guided tutorial on the arm-ttk, check out this MS LEARN module.

Philosophy

A little bit about the tests... These are the tests that are used to validate templates for the Azure QuickStart Repo and the Azure Marketplace. The purpose is to ensure a standard or consistent set of coding practices to make it easier to develop expertise using the template language (easy to read, write, debug).

As for the type, number and nature of the tests a test should check for something in the following categories (add more as you think of them :))

  • Validating the author's intent (unused parameters or variables)
  • Security practices for the language (outputting secrets in plain text)
  • Using the appropriate language construct for the task at hand (using environmental functions instead of hard-coding values)

Not everything is appropriate for a universal set of tests and not every test will apply to every scenario, so the framework allows for easy expansion and individual selection of tests.

Running Unit Tests locally before request a PR

Tests can be run directly in PowerShell, or run from the command line using a wrapper script.

You can run all of the unit tests by using .\arm-ttk.tests.ps1.

This will run the full suite of unit tests against the tests json files.

use:

# set your location in the project directory:
Set-Location -Path "$(YourGithubProjectFolder)\arm-ttk\unit-tests"

# import the module from the current branch, use -Force to make sure you have imported any code changes
Import-Module ..\arm-ttk\arm-ttk.psd1 -Force

# These are the same tests that run in the pipeline when doing a commit or a pull request (PR). 
.\arm-ttk.tests.ps1

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct.

For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

About

Azure Resource Manager Template Toolkit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PowerShell 99.6%
  • Other 0.4%