Code Monkey home page Code Monkey logo

vscode-azurearmtools's Introduction

Azure Resource Manager (ARM) Tools for Visual Studio Code (Preview)

Version Installs Build Status

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.

Getting Started

The following guides detail how to use the ARM Tools extension features.

Snippets

Snippets are used to create basic templates and add elements such as parameters, resources, and outputs to existing templates.

Create a new ARM template

When in an empty JSON file, typing arm produces a list of scaffolding snippets. These snippets can be used to create an empty template for any ARM deployment scope (Tenant, Subscription, Management Group, and Resource Group).

Image showing the arm template scaffolding snippet

Notice that adding scaffolding for an ARM template changes the Visual Studio Code language mode to Azure Resource Manager Template.

Image showing that the language type has changed to Azure Resource Manager Template

Add Azure resource to an ARM template

Once you are working in an ARM template, placing your cursor in the resource and typing arm, CTRL + Space, or { produces a list of 70+ snippets for Azure resources. Selecting a snippet adds an instance of the resource type to the ARM template.

Image showing a storage account being added with a snippet

Each snippet includes tab stops to help navigate through commonly modified configurations. Press the tab key to navigate to the next stop, and shift + tab to navigate to the previous stop. As seen in the following example, some stops are pre-populated with a list of common values for quick selection.

Image showing snippet tab stops with pre-populated parameter values

Snippet Reference

The following table lists the available ARM Tools snippets.

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.
"" While in the parameters section adds a parameter to the template.
"" While in the variables section adds a variable to the template.
{} While in the functions section add a new user-defined function.
arm- or the resource name Displays 70+ snippets for creating Azure resources. For example, type arm-ubuntu to add all five resources necessary for a basic Ubuntu virtual machine.
"" While in the outputs section adds an output to the template.

Azure schema completion and validation

The ARM Tools extension uses Azure schemas to provide resource completion and validation. These schemas help you verify that Azure resources are configured correctly before deployment time.

Schema Completions

Entering double quotes "" or selecting ctrl + space while the cursor is in a resource declaration provides potential properties and property values for each Azure resource.

In the following example, the potential values for an Azure Storage account tier are returned from the Azure Storage schema.

Image showing a list of storage account tier values returned from the storage Azure schema

Schema Validation

If an invalid property or property value is specified, a validation warning is shown. In the following example, an invalid value has been provided for the storage account tier (line 19). Notice that the warning message includes a list of valid values.

Image showing a schema validation error

Parameter files

Associating a parameter file with an ARM template enables full validation across both the parameter file and template. A parameter file association can be made by either creating a new parameter file from an existing template or by associating an existing parameter file to the template.

Create a new parameter file

To create a new parameter file from an existing template, click on the code lens text `Select or create a parameter file to enable full validation...

Image showing the code lens for creating a parameter file association

Select New from the context menu.

Image showing the parameter file creation options (none, new, and browse)

Selecting All parameters adds every parameter from the template into the new parameter file. Selecting Only required parameters adds only parameters that do not have a default value specified in the template file.

Image showing options for adding parameters for parameter file (All parameters, only required parameters)

Select a name and location for the parameter file.

Image showing a file save as dialog box

Once done, a parameter file has been created. Where needed, remove the TODO comment and add a parameter value.

Image showing new parameter file

Also, notice that on the template file that the code lens text has been updated to reflect the current parameter file association. This association is also shown on the Visual Studio Code staus bar.

Image showing that the parameter code lens has been updated to reflect associated parameter file

Associate an existing parameter file

To create an association with an existing parameter file, click on the code lens text `Select or create a parameter file to enable full validation'.

Image showing the code lens for creating a parameter file association

If a parameter file with a matching name (template name + ".parameter") is found, it can be selected from the list. If a matching file is not found, select Browse from the list and then select the parameter file.

Image showing the parameter file creation options (none, new, and browse)

Parameter validation

Once a parameter file has been associated with a template, the extension provides parameter validation across both files. In the following example, a parameter is specified with a set of allowed values. In the parameter file, a value is specified that is not part of the allowed values list. Because of this, the extension produces an error.

Image showing a parameter validation issue

Add missing parameters

To add missing parameters to an existing parameter file, ensure that an association has been created, click somewhere inside "parameters", and then click the light bulb icon.

Image showing the light bulb helper for adding missing parameters

Select the option to add only required or all missing parameters.

Image showing missing parameter options (Add missing required parameters, Add all missing parameters)

Enter a value for the added parameters and also remove the 'TODO' comment.

Image showing parameter file after missing parameters have been added

Rename a parameter

Right-click on the parameter name and select Rename Symbol. This action renames the parameter and all template and parameter file references to the parameter.

Image showing the rename parameter dialoug

Remove or update parameter file association

Click on the code lens option for changing a parameter association.

Image showing the code lens for creating a parameter file association

Select a new parameter file or create a new parameter file to update the association. Select None to remove the parameter file association.

Image showing the parameter file creation options (none, new, and browse)

Linked Template Support

When a linked template is referenced, it gets validated using the parameter values that are passed in.

linkedTemplateValidation

Linked template support requires that all top-level parameters have a value. This means that a parameter file is associated with the template OR all top-level parameter definitions have a default value.

Scenarios supported:

  • Relative path (requires Microsoft.Resources/deployments apiVersion 2020-06-01 or higher for use in template specs and 2020-10-01 for use in direct deployments):
{
  name: "linkedDeployment1",
  type: "Microsoft.Resources/deployments",
  apiVersion: "2020-10-01",
  properties: {
    mode: "Incremental",
    templateLink: {
      // Relative to current template's folder
      relativePath: "child.json",
    },
    parameters: {},
  },
}
  • Full URI:
{
  name: "linkedDeployment1",
  type: "Microsoft.Resources/deployments",
  apiVersion: "2020-10-01",
  variables: {
    templateUri: "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-vm-simple-windows/azuredeploy.json",
  },
  properties: {
    mode: "Incremental",
    templateLink: {
      uri: "[variables('templateUri)]",
    },
    parameters: {},
  },
}
  • Relative to deployed template location
{
  name: "linkedDeployment1",
  type: "Microsoft.Resources/deployments",
  apiVersion: "2020-10-01",
  properties: {
    mode: "Incremental",
    templateLink: {
      // When the template is deployed from a staging location, the URI be relative to the deployed
      // location.
      // While editing, this will be relative to the current template's local file folder.
      uri: "[uri(deployment().properties.templateLink.uri, 'child.json')]",
    },
    parameters: {},
  },
}

Additional features:

  • CTRL-click on relativePath value or click on code lens to navigate to linked template
  • "Light-bulb" and snippet support to fill in parameter values for a linked template linkedtemplatelightbulb

Template navigation

The ARM tools extension for VS Code offers several features for navigating around an ARM template.

ARM template outline

The ARM template outline is used to navigate to and select any element of an ARM template.

Image showing the ARM template outline with a storage account resource selected

In addition to navigation, several features such as insert item and template sorting can be engaged using the buttons found on the ARM template outline.

Go to Definition

Go to definition can be used to navigate to parameter, variable and user-defined function definitions. To use go to definition, place your cursor on the parameter, variable or function name and press F12 or right-click and select Go to Definition.

Image showing the Go to Definition dialog on a parameter reference

Find all references

Right-click on a parameter, variable, or user-defined function name and select Go to References. Double-clicking on any reference moves your cursor to the reference location.

Image showing the go to reference user interface

Completions

The ARM Tools extension provides code completions for many built-in functions, for example resourceId and variables, as well as for entries inside a dependsOn list and parameter values in a parameter file.

Other features

Insert Item

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 the code editor, select Insert Item and follow the on-screen prompts.

Inserting an item into an Azure Resource Manager template

You can also right-click on any element in the ARM Template Outline view to initiate the insert item process.

Inserting an item into an Azure Resource Manager template

Thanks to Nils Hedström @nilshedstrom for implementing this feature!

Sort template

To sort elements of an ARM template alphabetically, right-click on the template and select Sort Template....

Image showing the sort template options (Resource, Function, Output, Parameter, Variable)

Select the element that you want to sort.

Image showing the insert resource menu

Template sorting can also be engaged using the ARM template outline.

Thanks to Nils Hedström @nilshedstrom for implementing this feature!

Extract to variable or parameter

Select a JSON string or a subset of an expression string then select the lightbulb to extract it to a variable or parameter.

Image demonstrating extracting a variable and a parameter

Thanks to Nils Hedström @nilshedstrom for implementing this feature!

Hover to format complex expressions or multi-line strings

Image showing hovering over an expression

Image showing hovering over a multi-line string

To assist with navigating complex expressions or multi-line strings, VS Code has a "Go to Bracket" command. You can use the command palette or a keyboard shortcut:

  • Mac: Cmd+Shift+\
  • Windows: Ctrl+Shift+\
  • Windows with Spanish keyboard: Ctrl+Shift+|
  • Windows with German keyboard: Ctrl+Shift+^

Miscellaneous Features

  • Signature help for TLE function parameters
  • Peek for variable and parameter definitions
  • Find all references (Shift + F12) for variables and parameters
  • Rename (F2) variables and parameters and their references, as well as user-defined functions or namespaces
  • 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
  • Nested templates (with inner or outer scope)
  • Quick fix to add missing parameter values in the parameter file or in nested templates

Extension configuration

You may be interested in adjusting the following extension configurations. These can be configured in VS Code User Settings.

Configuration Description
azureResourceManagerTools.autoDetectJsonTemplates Auto-detects ARM template and sets editor language type to Azure Resource Manager Template.
azureResourceManagerTools.checkForLatestSchema Check if the root schema for deployment templates is using an out-of-date version and suggest updating it to the latest version.
azureResourceManagerTools.checkForMatchingParameterFiles Check if an opened template file has a matching parameter file and prompt to create an association.
azureResourceManagerTools.codelens.enable Set to false to disable all code lens functionality.
azureResourceManagerTools.codelens.parameters Set to false to disable code lens for parameters.

Automatic Detection of deployment template files

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 associations 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
}

Troubleshooting

Use the following wiki article to help troubleshoot these known issues.

Related Links

Visualizing ARM Templates

Another helpful extension for authoring ARM templates is the ARM Viewer for VS Code extension. This extension displays a graphical preview of ARM templates. The view will show all resources with the official Azure icons and also linkage between the resources.

You can find details on its features and usage by visiting the GitHub repo here: https://github.com/benc-uk/armview-vscode#usage

Contributing

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 run npm install.
    • To build, press F1 and type in Tasks: Run Build Task.
    • Debug: press F5 to start debugging the extension.

Legal

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.

Code of Conduct

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.

Telemetry

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.

License

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.

vscode-azurearmtools's People

Contributors

alexgav avatar andrewcs149 avatar anthony-c-martin avatar bgold09 avatar bhsubra avatar bmoore-msft avatar cweining avatar dependabot[bot] avatar ejizba avatar eltociear avatar elvenspellmaker avatar fiveisprime avatar jagilber avatar kilasuit avatar lawrencegripper avatar lostintangent avatar marcusfelling avatar marcvaneijk avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar mjbvz avatar msftbot[bot] avatar msftgits avatar neilpeterson avatar nilshedstrom avatar nturinski avatar sanjaiganesh avatar stephenweatherford avatar whiskeyjay avatar wilfriedwoivre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-azurearmtools's Issues

Network Schema out of date

Why is the network schema out of date? Creating a resource like:

{
      "apiVersion": "2017-06-01",
      "type": "Microsoft.Network/virtualNetworkGateways",
      <SNIP>
}

Yields the warning: "Value is not accepted. Valid values: "Microsoft.Network/networkInterfaces"."

Login-AzureRMAccount - Bring to front

This issue has been moved from Microsoft/vscode/
Original author is
@FlemmingRohde
@FlemmingRohde


Issue Type

Bug

Description

When trying command Login-AzureRMAccount the login prompt is hidden behind the Studio Code GUI. Please make the login prompt focus (bring to front)

VS Code Info

VS Code version: Code 1.20.1 (f88bbf9137d24d36d968ea6b2911786bfe103002, 2018-02-13T15:33:21.935Z)
OS version: Windows_NT ia32 10.0.16299

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz (4 x 2808)
Memory (System) 15.93GB (8.76GB free)
Process Argv C:\Program Files (x86)\Microsoft VS Code\Code.exe
Screen Reader no
VM 0%
Extensions (10)
Extension Author (truncated) Version
azureautomation Awe 0.6.2
xml Dot 1.9.2
git-project-manager fel 1.4.0
prettify-json moh 0.0.3
azurecli ms- 0.4.0
PowerShell ms- 1.5.1
azurerm-vscode-tools msa 0.4.0
vscode-manifest-yaml Piv 0.1.3
vscode-icons rob 7.20.0
arm-snippets sam 1.1.0
Reproduces without extensions

Add configuration option to control the primary resource attribute displayed in sidebar

Per the title, often we'll have a "copy" resource whose "name" is constructed in the copy loop and may contain text such as: "[variables('refname')[copyIndex()].attrib]". It would be helpful to be able to control which attribute gets displayed for resources in the sidebar window. For example, if I could specify "comments" and enter appropriate free-form text there, it would be much easier to identify entries in the JSON Outline view.

Doubled single-quote escaped syntax flagged as incorrect

Here's a line form a working mainTemplate.json:

"commandToExecute": "[concat('cd /hub*/docker-compose; sudo docker-compose down -t 60; sudo -s source /set_hub_url.sh ', reference(parameters('publicIpName')).dnsSettings.fqdn, ';  sudo docker volume rm ''dockercompose_cert-volume''; sudo docker-compose up')]"

The escape syntax for single quotes ('', i.e. two single quote characters next to each other) gets incorrectly gets red-underlined:

image

Extension is installed and it doesn't load

I'm using version 0.4.0
Windows 10 x64
VS Code Version: 1.21.1 x64

I used to be able to rename my arm template parameters with F2.
Now F2 doesn't work.

I can't also jump to definition.
I don't have intellisense either.

I don't know how to troubleshoot why my extension is not loading and why.
Best I can find on the Output console is this

[2018-03-20 09:50:40.409] [exthost1] [info] ExtensionService#_doActivateExtension msazurermtools.azurerm-vscode-tools {"startup":false,"activationEvent":"onLanguage:json"}

Update: I toggled developer tools and found the following console error:

console.ts:136 [Extension Host] Activating extension `msazurermtools.azurerm-vscode-tools` failed:  Cannot find module 'open'

[Extension Host] Here is the error stack:  Error: Cannot find module 'open'
	at Function.Module._resolveFilename (module.js:470:15)
	at Function.Module._load (module.js:418:25)
	at Function.o._load (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:671:784)
	at Module.require (module.js:498:17)
	at Module.patchedRequire [as require] (c:\Program Files\Microsoft VS Code\resources\app\extensions\git\node_modules\diagnostic-channel\dist\src\patchRequire.js:14:46)
	at require (internal/module.js:20:19)
	at Object.<anonymous> (C:\Users\FacundoGauna\.vscode\extensions\msazurermtools.azurerm-vscode-tools-0.4.0\out\src\AzureRMTools.js:12:14)
	at Object.<anonymous> (C:\Users\FacundoGauna\.vscode\extensions\msazurermtools.azurerm-vscode-tools-0.4.0\out\src\AzureRMTools.js:602:3)
	at Module._compile (module.js:571:32)
	at Object.Module._extensions..js (module.js:580:10)

CopyIndex with 2 arguments is considered an error

I have a functioning template that incorrectly triggers an alert in VSCode (using Azure Resource Manager Tools 0.4.0)

image

But copyIndex can accept 2 arguments and the script above is working as intended

image

Support validating subproperties of functions that return objects

See: https://github.com/Microsoft/vscode-azurearmtools/blob/master/assets/ExpressionMetadata.json#L108

The return members on the function are:
name
properties

And then the properties object contains these return members
properties.template
properties.templateLink
properties.parameters
properties.mode
properties.provisioningState

and some of those members also have children, see: https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions-deployment#deployment

Not sure if the extension supports it or how to author that in the expression metadata so I'm going to submit a PR to just fix the top level members... Use this issue to track the remaining corrections.

Fix and enable unit tests on Travis CI

There's a bunch of existing tests, but we're not running them with Travis CI. Unfortunately there's a lot of failing tests so we'll have to fix that before we can enable this in CI

The JSON OUTLINE doesn't display when open a parameters file

Repro Steps:
1.Open an AzureResourceGroup1 solution AzureResourceGroup1.zip which contains 2 json files
2.Click the LoadBalancedVirtualMachine.json file and LoadBalancedVirtualMachine.parameters.json file one by one

Expect:
The JSON OUTLINE display when click either of them.
expect
Actual:
The JSON OUTLINE doesn't display when open a json file which contains no items
actual

Json Outline pane doesn't use displayName tag

If a resource has tags ➝ displayName, Visual Studio's JSON outline view would display this value in the outline view rather than the 'name' variable. It seems this extension just uses the 'name' variable here. This is particularly useful to make the outline more readable when all the names come from variables/parameters.

Could this be supported for more friendly display names in the JSON outline pane?

Unrecognized function name 'listCallbackUrl'.

I'm using listCallbackUrl in one of our ARM templates. It is working fine but I get the warning "Unrecognized function name 'listCallbackUrl'." in VS Code.

I figured out that listCallbackUrl works a bit different compared to the listKeys and listSecrets methods. The latter two are "built in" and available, whereas the first one depends on the resource. To figure out which ones are available you can "View the REST API operations... or Use the Get-AzureRmProviderOperation PowerShell cmdlet ... or Use the following Azure CLI command"

Is it possible to add listCallbackUrl as a valid function?

Should I create a PR where this function is added to ExpressionMetadata.json?

JSON outline not shown for unsaved new ARM template

  1. In VS Code, create a new document.
  2. Change the document type to JSON from the lower right corner.
  3. Type or paste in some valid JSON content.

Expected:
The JSON outline tree is shown.

Actual:
The JSON outline tree is not shown.

The icons of the .deployproj file are inconsistent for one opened ARM project

Repro Steps:

  1. Open an ARM solution 'AzureResourceGroup1'.
  2. Expand the 'AzureResourceGroup1' and check the icon of AzureResourceGroup1.deployproj file.
  3. Check the opened icon for the AzureResourceGroup1.deployproj file.

Expect:
These two icons are conistent.

Actual:
These two icons are inconstent. Please see the below attachment.
icons

More info:
This issue doesn't reproduce for one new created .deployproj file.

ARM template variable copy block highlighting error

There is a syntax highlighting error in the azurerm-vscode-tools extension when editing ARM templates. In the following block in the variables section, the opening "copy": block is underlined green indicating that it is never used and all references to the name "generatedSecurityRules" are underlined red indicating that it is not defined. The template actually executes fine when run against the Azure API.

"copy": [
            {
                "name": "generatedSecurityRules",
                "count": "[length(parameters('appServiceRules'))]",
                "input": {
                    "name": "[parameters('appServiceRules')[copyindex('generatedSecurityRules')].name]",
                    "properties": {
                        "description": "[parameters('appServiceRules')[copyindex('generatedSecurityRules')].description]",
                        "protocol": "[parameters('appServiceRules')[copyindex('generatedSecurityRules')].protocol]",
                        "sourcePortRange": "[parameters('appServiceRules')[copyindex('generatedSecurityRules')].sourcePortRange]",
                        "destinationPortRange": "[parameters('appServiceRules')[copyindex('generatedSecurityRules')].destinationPortRange]",
                        "destinationPortRanges": "[parameters('appServiceRules')[copyindex('generatedSecurityRules')].destinationPortRanges]",
                        "sourceAddressPrefixes": "[parameters('appServiceRules')[copyindex('generatedSecurityRules')].sourceAddressPrefixes]",
                        "destinationAddressPrefixes": "[parameters('appServiceRules')[copyindex('generatedSecurityRules')].destinationAddressPrefixes]",
                        "access": "[parameters('appServiceRules')[copyindex('generatedSecurityRules')].access]",
                        "priority": "[parameters('appServiceRules')[copyindex('generatedSecurityRules')].priority]",
                        "direction": "[parameters('appServiceRules')[copyindex('generatedSecurityRules')].direction]"
                    }
                }
            }
        ],
        "securityRuleList": "[concat(variables('generatedSecurityRules'), parameters('denyInternetRule'))]"

Updates required to readme

  • Needs a link to the Microsoft Code of Conduct
  • Replace UserVoice (appears to be deprecated) with GitHub issue tracker for feedback

Add the ability to deploy a template

Add the following capability to the extension:

  1. Authenticate to a cloud (Azure, German, China, Governmental and Azure Stack clouds)
  2. Select a subscription
  3. Select an existing or create a new resource group
  4. Deploy a template
  5. Select an existing parameter file as input or ask for input values at deployment time
  6. Verbose logging of deployment

Incorrect number of parameters is not detected if function name differs in case

Checking for unrecognized functions doesn't care about case:
image

But checking for number of args does:
image
image

EXPECTED: According to https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions:
Template functions and their parameters are case-insensitive. For example, Resource Manager resolves variables('var1') and VARIABLES('VAR1') as the same. When evaluated, unless the function expressly modifies case (such as toUpper or toLower), the function preserves the case. Certain resource types may have case requirements irrespective of how functions are evaluated.

Unify JSON parsing & caching

Now the JSON outline view and the ARM template intellisense parse JSON documents on their own. This duplicated effort should be eliminated.

Add TreeDataProvider

The AzureRM SDK in Visual Studio provides a JSON outline to navigate large ARM templates. This feature is currently not available in the vscode-azurermtools extension and makes navigating large ARM templates somewhat troublesome.

While creating a TreeDataProvider for the azurermtools from this sample, I ran across this repo. The repo contains a treeview extension that also navigates code and does dynamic refresh of code changes. Great work by @DaGhostman

With some small changes (name value for objects in array, jump code on element with children, AzureRM specific icons and removing the other code languages support), the treeview code can be used as is and add a very useful feature to azurermtools.
Both repos are licensed by MIT.

If you agree, what approach do you prefer on this?

Marc

Extension doesn't work with jsonc file type

Recently VSCode started highlighting //comments in JSON files as errors unless the jsonc file type is used.

But, the ARM template extension only runs when the file type is json

Can the extension also run on jsonc file types? We have comments in our ARM template (mostly for variables).

ARM Template Extension: Mapping JSON files to JSONC breaks IntelliSense

From @erictorbenson on April 25, 2018 17:51

I currently map the "JSON with Comments" language type to *.json to allow editing of ARM templates without flagging comments as errors. When I do this, IntelliSense for the ARM template does not suggest completions. I can't find a setting that looks like it would let me override this behavior.

Steps to Reproduce:

  1. Install a fresh copy of VS Code and install the ARM Tools Extension.
  2. Add the following to the User Settings and reload VS Code:
    { "files.associations": { "*.json":"jsonc" } }
  3. Load an ARM template and attempt to auto-complete a parameter, variable, etc. IntelliSense window will not appear.
  4. Comment out the line above and reload, functionality returns.

Copied from original issue: microsoft/vscode#48696

TLE intellisense doesn't work on unsaved files

  1. Create a new file.
  2. Change the file type to json in the editor.

Expected:
TLE intellisense works.

Actual:
TLE intellisense doesn't work. In fact it only works when an existing file is opened in an editor.

Unhandled exception: Cannot read property 'catch' of null inside non-template JSON files

I get this when deleting and then re-adding one of the commas in a dependencies section in an extension package.json file.

TypeError: Cannot read property 'catch' of null
at AzureRMTools.onProvideSignatureHelp (c:\Repos\vscode-azurearmtools\src\AzureRMTools.ts:554:23)
at Object.provideSignatureHelp (c:\Repos\vscode-azurearmtools\src\AzureRMTools.ts:215:45)
at c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:635:403

private onProvideSignatureHelp(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken): Promise<vscode.SignatureHelp> {
    let result: Promise<vscode.SignatureHelp> = null;

    this.logOnError(() => {
        const deploymentTemplate: DeploymentTemplate = this.getDeploymentTemplate(document);
        if (deploymentTemplate) {
            const context: PositionContext = deploymentTemplate.getContextFromDocumentLineAndColumnIndexes(position.line, position.character);

            result = context.signatureHelp.then((functionSignatureHelp: TLE.FunctionSignatureHelp) => {
                let signatureHelp: vscode.SignatureHelp = null;

                **if (functionSignatureHelp) {**

...
}

                return signatureHelp;
            });
        }
    });


    return result.catch((error: any) => {    <<< result can be null

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.