Step By Step Instructions on Installing Azure ARM template test toolkit
Posted by Sriram Sanka on April 5, 2023
Azure ARM Template Validation Tool Kit helps you to validate & meet the Requirements to Publish your Solution to Azure Market Place.
You can Download the Latest Toolkit from https://github.com/Azure/arm-ttk/releases .
- Download and Extract(unzip) arm-ttk.zip file
- Start the Power Shell as administrator
- Navigate to the Extracted Folder/Directory.
- Unblock the script files Using “Get-ChildItem *.ps1, *.psd1, *.ps1xml, *.psm1 -Recurse | Unblock-File”
- Import the module using ” Import-Module .\arm-ttk.psd1 “
- Validate Templates using module “Test-AzTemplate”
Get-ChildItem *.ps1, *.psd1, *.ps1xml, *.psm1 -Recurse | Unblock-File
Import-Module .\arm-ttk.psd1
Test-AzTemplate -TemplatePath \path\to\template
Download and Extract(unzip) arm-ttk.zip file

Start the Power Shell as administrator & Navigate to the Extracted Folder/Directory.

Unblock the script files Using “Get-ChildItem *.ps1, *.psd1, *.ps1xml, *.psm1 -Recurse | Unblock-File”

Import the module using ” Import-Module .\arm-ttk.psd1 “

As mentioned in the Error, we need to Enable Execution Policy as Remote Signed to Local Machine to avoid the above Error.

Note : If you do not wish to Import the Module, You can still run the Test-AzTemplate as Local using “./Test-AzTemplate ” check the help provided for more Details.
Run “Test-AzTemplate -TemplatePath \path\to\template” to validate your ARM Templates (In My Case UI Definition and MainTemplate)

Fix the Reported issues and revalidate.
PS D:\ARMTTK\arm-ttk> Test-AzTemplate -TemplatePath "D:\ARMTTK\XcellNoWorkFlow\" Validating XcellNoWorkFlow\createUiDefinition.json JSONFiles Should Be Valid [+] JSONFiles Should Be Valid (30 ms) Allowed Values Should Actually Be Allowed [+] Allowed Values Should Actually Be Allowed (100 ms) Controls In Outputs Must Exist [+] Controls In Outputs Must Exist (19 ms) CreateUIDefinition Must Not Have Blanks [+] CreateUIDefinition Must Not Have Blanks (21 ms) CreateUIDefinition Should Have Schema [+] CreateUIDefinition Should Have Schema (13 ms) Credential Confirmation Should Not Be Hidden [+] Credential Confirmation Should Not Be Hidden (93 ms) Handler Must Be Correct [+] Handler Must Be Correct (10 ms) HideExisting Must Be Correctly Handled [+] HideExisting Must Be Correctly Handled (154 ms) Location Should Be In Outputs [+] Location Should Be In Outputs (9 ms) Outputs Must Be Present In Template Parameters [+] Outputs Must Be Present In Template Parameters (10 ms) Parameters Without Default Must Exist In CreateUIDefinition [+] Parameters Without Default Must Exist In CreateUIDefinition (20 ms) Password Textboxes Must Be Used For Password Parameters [+] Password Textboxes Must Be Used For Password Parameters (65 ms) PasswordBoxes Must Have Min Length [+] PasswordBoxes Must Have Min Length (60 ms) Textboxes Are Well Formed [?] Textboxes Are Well Formed (66 ms) TextBox 'AppLoginEmail' regex does not have a length constraint. Tooltips Should Be Present [+] Tooltips Should Be Present (66 ms) Usernames Should Not Have A Default [+] Usernames Should Not Have A Default (61 ms) Validations Must Have Message [+] Validations Must Have Message (60 ms) VMSizes Must Match Template [+] VMSizes Must Match Template (62 ms) Validating XcellNoWorkFlow\mainTemplate.json adminUsername Should Not Be A Literal [+] adminUsername Should Not Be A Literal (59 ms) apiVersions Should Be Recent In Reference Functions [+] apiVersions Should Be Recent In Reference Functions (11 ms) apiVersions Should Be Recent [+] apiVersions Should Be Recent (117 ms)
artifacts parameter
[+] artifacts parameter (18 ms)
CommandToExecute Must Use ProtectedSettings For Secrets
[+] CommandToExecute Must Use ProtectedSettings For Secrets (68 ms)
DependsOn Best Practices
[+] DependsOn Best Practices (59 ms)
Deployment Resources Must Not Be Debug
[+] Deployment Resources Must Not Be Debug (56 ms)
DeploymentTemplate Must Not Contain Hardcoded Uri
[+] DeploymentTemplate Must Not Contain Hardcoded Uri (14 ms)
DeploymentTemplate Schema Is Correct
[+] DeploymentTemplate Schema Is Correct (9 ms)
Dynamic Variable References Should Not Use Concat
[+] Dynamic Variable References Should Not Use Concat (12 ms)
IDs Should Be Derived From ResourceIDs
[+] IDs Should Be Derived From ResourceIDs (67 ms)
Location Should Not Be Hardcoded
[+] Location Should Not Be Hardcoded (154 ms)
ManagedIdentityExtension must not be used
[+] ManagedIdentityExtension must not be used (10 ms)
Min And Max Value Are Numbers
[+] Min And Max Value Are Numbers (10 ms)
Outputs Must Not Contain Secrets
[+] Outputs Must Not Contain Secrets (12 ms)
Parameter Types Should Be Consistent
[+] Parameter Types Should Be Consistent (87 ms)
Parameters Must Be Referenced
[+] Parameters Must Be Referenced (52 ms)
Password params must be secure
[+] Password params must be secure (16 ms)
providers apiVersions Is Not Permitted
[+] providers apiVersions Is Not Permitted (18 ms)
ResourceIds should not contain
[+] ResourceIds should not contain (22 ms)
Resources Should Have Location
[+] Resources Should Have Location (11 ms)
Resources Should Not Be Ambiguous
[+] Resources Should Not Be Ambiguous (12 ms)
Secure Params In Nested Deployments
[+] Secure Params In Nested Deployments (56 ms)
Secure String Parameters Cannot Have Default
[+] Secure String Parameters Cannot Have Default (12 ms)
Template Should Not Contain Blanks
[+] Template Should Not Contain Blanks (164 ms)
URIs Should Be Properly Constructed
[+] URIs Should Be Properly Constructed (173 ms)
Variables Must Be Referenced
[+] Variables Must Be Referenced (11 ms)
Virtual Machines Should Not Be Preview
[+] Virtual Machines Should Not Be Preview (64 ms)
VM Images Should Use Latest Version
[+] VM Images Should Use Latest Version (9 ms)
VM Size Should Be A Parameter
[+] VM Size Should Be A Parameter (82 ms)
Pass : 48
Fail : 0
Total : 48
Restrict the Execution Policy to its previous state.

Hope you find it useful, Happy Learning.
Leave a Reply