The Azure Resource Manager (ARM) Tools for Visual Studio Code provides language support, resource snippets, and resource auto-completion to help you create and validate Azure Resource Manager templates. See the Azure Resource Manager templates with Visual Studio Code quickstart for a guided tutorial experience.
- Azure Resource Manager template language server for providing ARM template language completion, validation, and error guidance.
- Resources are validated against Azure schemas, which provide validation based on resource type and apiVersion.
- ARM Template Outline view for easy navigation through large templates
- Colorization for Template Language Expressions (TLE)
- Analyze and validate JSON syntax, JSON schema conformance, and string expressions.
Template files can be mapped to a parameter file for an enhanced authoring and validation experience. To do so use the parameter file control in the Visual Studio Code status bar, or use the right-click contextual menu on an ARM template. Once a parameter file has been mapped, the following features are available.
- Full validation across both the template and parameter file
- Open an associated parameter file from a template
- Add all missing parameters to the parameter file and parameter auto-completion
- Rename parameters and all references across both the template and mapped parameter file
- Find and goto all references of a parameter across both the template and mapped parameter file
Snippets for deployment template scaffolding and 70+ Azure resources.
Snippet | Description |
---|---|
arm! |
Adds the framework for a full deployment template file for resource group deployments. |
arm!s |
Adds the framework for a full deployment template file for subscription deployments. |
arm!mg |
Adds the framework for a full deployment template file for management group deployments. |
arm!t |
Adds the framework for a full deployment template file for tenant deployments. |
armp! |
Adds the framework for a full deployment template parameters file. |
arm-param |
Adds a parameter to a template. |
arm-variable |
Adds a variable to a template. |
arm-userfunc |
Adds a user function to a template. |
arm-userfunc-namespace |
Adds a user function namespace to a template. |
arm- |
Displays 70+ snippets for creating Azure resources. For example, type arm-ubuntu to add all five resources necessary for a basic Ubuntu virtual machine. |
In addition to adding snippets from the code editor, the Insert Item feature can be used to insert new parameters, user-defined functions, variables, resources, and outputs. To do so right-click on the template in the code editor, select Insert Item and follow the on-screen prompts.
You can also right-click on any element in the ARM Template Outline view to initiate the insert item process.
- Built-in functions
- Parameter references
- Variable references
- resourceGroup() properties
- subscription() properties
- resourceId() function
- Properties of references to variables that are objects
- Signature help for TLE function parameters
- Go To Definition for variable and parameter references
- Peek for variable and parameter definitions
- Find all references (Shift + F12) for variables and parameters
- Rename (F2) variables and parameters and their references
- Hover for parameter description
- TLE brace matching
- User-defined template functions, see Azure documentation
- Variable iteration ("copy blocks"), see Azure documentation
- Sort template and template sections alphabetically
You may be interested in adjusting the following extension configurations. These can be configured in VS Code User Settings.
Auto-detect ARM Templates
Enables auto-detection of deployment template files with the extension *.json or *.jsonc. If set to true (default), the editor language will automatically be set to Azure Resource Manager Template for any .json/.jsonc file which contains an appropriate Azure Resource Manager Template schema.
"azureResourceManagerTools.autoDetectJsonTemplates": true,
Detect latest root schema
Check if the root schema for deployment templates is using an out-of-date version and suggest updating it to the latest version.
"azureResourceManagerTools.checkForLatestSchema": true,
Parameter files
Check if an opened template file has a matching params file and prompt to create a mapping.
"azureResourceManagerTools.checkForMatchingParameterFiles": true,
Parameter file mappings are stored in the azureResourceManagerTools.parameterFiles
user setting.
"azureResourceManagerTools.parameterFiles": {}
Code Lens
Disable all code lens functionality
"azureResourceManagerTools.codelens.enable": false
Disable code lens for parameters
"azureResourceManagerTools.codelens.parameters": false
By default, the extension recognizes a .json or .jsonc file as a deployment template file based on the $schema specified in the file (for instance, https://schema.management.azure.com/schemas/2018-05-01/deploymentTemplate.json#
) and will switch the editor language to "Azure Resource Manager Template" automatically. If you do not want that behavior, you can set the azureResourceManagerTools.autoDetectJsonTemplates
setting to false and use the below methods to determine which files to treat as deployment templates.
Besides automatic detection, you can also use the files.associations
setting to set up your own specific mappings based on specific files paths or patterns to mark them as deployment templates, e.g.
"files.associations": {
"*.azrm.json": "arm-template" // Treat these files as deployment templates
}
Use the following wiki article to help troubleshoot these known issues.
- VS Code Azure Resource Manager snippets and cross-platform deployment scripts
- Azure Quickstart Templates
There are several ways you can contribute to our repo:
- Ideas, feature requests, and bugs: We are open to all ideas and we want to get rid of bugs! Use the Issues section to report a new issue, provide your ideas or contribute to existing threads.
- Documentation: Found a typo or strangely worded sentences? Submit a PR!
- Snippets: Have a fix for a snippet or a new snippet idea? File an Issue or submit a PR!
- Code: Contribute bug fixes, features or design changes:
- Clone the repository locally and open in VS Code.
- Install TSLint for Visual Studio Code.
- Open the terminal (press
CTRL+
`) and runnpm install
. - To build, press
F1
and type inTasks: Run Build Task
. - Debug: press
F5
to start debugging the extension.
Before we can accept your pull request you will need to sign a Contribution License Agreement. All you need to do is to submit a pull request, then the PR will get appropriately labeled (e.g. cla-required
, cla-norequired
, cla-signed
, cla-already-signed
). If you already signed the agreement we will continue with reviewing the PR, otherwise, the system will tell you how you can sign the CLA. Once you sign the CLA all future PR's will be labeled as cla-signed
.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
VS Code collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. If you don’t wish to send usage data to Microsoft, you can set the telemetry.enableTelemetry
setting to false
. Learn more in our FAQ.
The source code in our public repository is licensed under the MIT license and may be locally built and used in accordance with this license.
When the extension is published to the VS Code Marketplace, it is bundled with the Azure Resource Manager language service binaries. The extension as bundled and published this way is licensed under a traditional Microsoft product license.