Azure Resource Management Tools

Free AWS Course for AWS Certified Cloud Practitioner (CLF-C01) Start Now!!

FREE Online Courses: Dive into Knowledge for Free. Learn More!

In our Azure series we have learned several things about Microsoft Azure. But today’s article is especially for the developers. So, in today’s article, we will discuss the Resource Management Tools which helps the Azure developers to perform their task smoothly.

Azure Resource Manager (ARM) Tools for Visual Studio Code

The Azure Resource Manager (ARM) Tools for Visual Studio Code offers multiple language support, resource snippets, and resource auto-completion which helps the users to create and validate Azure Resource Manager templates.

One can use a simple configuration language to manage your Azure. Deploy your resources concurrently to expedite the deployment process.

Declaratively create and update any Azure resource. Use one of the many sample templates or create your own with native tooling in Visual Studio or Visual Studio Code.

Creating Reproducible Infrastructure

creating reproducible infrastructure

Using Resource Manager templates, you can create and deploy your entire Azure infrastructure declaratively.

Repeatedly and consistently deploy resources such as virtual machines, network infrastructure, and storage systems throughout your development lifecycle.

Author templates using the existing development tools along with amazing community samples

Use the Visual Studio Code extension for Resource Manager to improve your template development authoring experience.

Use features such as syntax highlighting for Resource Manager language functions, comment support, and IntelliSense code completion to create your templates and build on top of community-built samples that cover a wide range of infrastructure and application patterns.

Deploying with Familiar Tools

Iterate quickly on your template deployments by using REST APIs, CLI, or PowerShell. Integrate your deployment tasks with your DevOps pipelines to create a CI/CD setup capable of automating large-scale deployments.

Integrating with Azure Platform Features

Examine deployments in the Azure portal to see which parameter values and output values were used. To remediate non-compliant resources, use Azure Policy.

To review, trace, and audit your infrastructure, check templates into source control. Using Azure Blueprints, you can build your environment by combining templates.

Now, let us talk about the tools available for the developers inside the Azure Resource Manager. They are as follows:

Snippets

In Azure, developers take the help of snippets for making basic templates and for adding the elements like parameters, resources and outputs towards the previous templates.

Create a New ARM template

In an empty JSON file, the developers should start typing arm and it will showcase a list of scaffolding snippets.

The following snippets can be used to build a blank template for any ARM deployment scope.

Note: The developers should remember that adding scaffolding in the ARM template will make changes in the visual studio code language mode in the Azure Resource Manager Template.

Adding Azure Resources to an ARM Template

Once the developer starts working in an ARM template they must keep their cursor in the resource and then type arm, CTRL + Space button.

Otherwise, it will showcase a list of 70+ snippets for Azure resources. Then, the developer must select a snippet that will add an instance of the resource type for the ARM template.

Every snippet will have the tap stops which will help the developers to navigate towards the commonly modified configurations.

Now, they should hit the Tab button for navigating towards the next stop. Next, press Shift + Tab for navigating towards the earlier stop.

ARM Tools Snippet Reference

Below we have mentioned the table which lists the available ARM Tools snippets.

Snippet

Description

arm!It will add the framework which will provide the deployment template file for the deployment of the resource group.
arm!sThis will add the framework for a complete deployment template file which is used for subscription deployments.
arm!mgIt will add a framework that is required for a full deployment template file required for the management group deployments.
arm!tThis will add the framework which is especially required for the complete deployment template file which is essential for management group deployments.
armp!It will add the framework for the complete deployment template parameters file.
“”While the developers are working in the parameters section it will add a parameter to the template.
“”When the developers are working in the variables section it will add a variable to the template.
{}In the functions section, it will add a new user-defined function.
arm- or the resource nameThis snippet will showcase more than 70 snippets for building Azure resources.
“”When the developer enters this in the outputs section it will add an output to the template.

Schema Validation

If the developer inserts an invalid property or the inserted property showcases any warning.

Parameter Files

When the developer associates the parameter file with the help of the ARM template it will allow them to complete validation across both the file and template.

Developers can associate the parameter file by making a new parameter file from the previous template or they can do it by associating an existing parameter file to the template.

1. Associating an Existing Parameter File

For making an association with the existing parameter file, the developer should click on the code lens text such as `Select or create a parameter file to enable full validation’.

If there is any parameter file that finds a matching name such as template name + .” parameter” then the developer can select it from the list.

If it is not available in the list, then they should browse from the list and choose the parameter file.

2. Parameter Validation

Once the parameter file is connected with the template the extension will offer a parameter validation across both the files.

Once a parameter file successfully gets associated with a template, then the extension offers parameter validation across both files.

3. Add missing parameters

For adding a missing parameter in an existing parameter file one must make sure that an association should be created. Then, click at any place inside the “parameters” and click on the bulb icon.

The developer must choose the option for adding only required or all missing parameters.

Now, one should provide a value for the added parameters and secondly should remove the ‘TODO’ comment.

4. Renaming the parameter

Here, the developer must Right-click on the parameter name and choose the Rename Symbol option.

The following action will rename the parameter and all template and parameter file references to the parameter.

5. Removing or Updating Parameter File Association

The developer should click on the code lens option for changing or editing the parameter association.

Now, one should choose a new parameter file otherwise they can create a new parameter file for updating the association.

Next, the developer should click on the None option for removing or deleting the parameter file association.

Linked Template Support

Here, when a linked template is referenced it gets validated with the help of parameter values that are passed in.

The linked template will support all the requirements which will level up the parameters which have a value.

It means that the parameter fill will be now associated with the template or all the top-level parameter definitions will hold a default value.

The Supported Templates are as follows:

Relative Path

{
            "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:

  • Developers can press the CTRL button and then click on relativePath value otherwise they can click on code lens for navigating towards the linked template
  • Developers can take the help of “Light-bulb” and snippet support for filling the details inside parameter for a linked template

ARM Template Navigation

Azure Resource Management tools extension for Visual Studio Code which provides various features which help the developers to navigate around ARM templates.

1. ARM Template Outline

Developers use the ARM template outline for navigating and selecting any other element of an ARM template.

Along with the navigation there are multiple features like inserting an item and template sorting is possible with the help of buttons available inside the ARM template outline.

2. Go to Definition

Developers can use the go-to definition for navigating towards the parameter, variable and user-defined function definition.

For using go to definition the developer should keep their cursor on the parameter, variable or the function name and then hit the F12 button or right-click and click on Go to Definition.

3. Finding all References

Now, developers must right click on the parameter, variable or in the user-defined function name and then click on the Go to References.

One should double click on the reference and then move their cursor to the reference location.

4. Completions

Azure Resource Management Tools extensions offer code completion for multiple built-in functions.

Azure Extension Configuration

ConfigurationDescription
azureResourceManagerTools.autoDetectJsonTemplatesIt will Auto-detect the ARM template and will adjust the editor language type to Azure Resource Manager (ARM) Template.
azureResourceManagerTools.checkForLatestSchemaThis configuration will check if the root schema for deployment templates is utilizing an out-of-date version then further it will suggest the developers update it with the latest version.
azureResourceManagerTools.checkForMatchingParameterFilesThis will check if an opened template file will consist of a matching parameter file and will message the developer to create an association.
azureResourceManagerTools.codelens.enableThe following configuration will set it to false and will disable all code lens functionality.
azureResourceManagerTools.codelens.parametersThis will be set to false for disabling the code lens for parameters.

Other features

Inserting Item

Developers can use the insert item feature for inserting the following:

  • new parameters
  • user-defined functions
  • variables
  • resources
  • outputs.

For performing it one must right-click the code editor and then select the Insert Item and perform the following steps displayed on the on-screen.

Developers can also right-click on any element inside the ARM Template Outline view for beginning the insert item task.

Sort Template

For sorting elements of an ARM template alphabetically one must right-click on the template and then choose Sort Template. Template sorting can also be engaged with the help of an ARM template outline.

Extract to Variable or Parameter

Developers must select a JSON string or a subset of an expression string and then secondly choose the lightbulb for extracting it towards a variable or parameter.

Hover To Format Complex Expressions or Multi-line Strings

For assisting with the navigation of complex expressions or with multi-line strings the developer should be firstly working inside the VS code and should have a “Go to Bracket” command.

One can use this command palette or the following keyboard shortcuts mentioned below. They are as follows:

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

Features of Azure Resource Management Tools

  • Any Azure resource can be created declaratively and repeatedly.
  • Your deployments will be managed centrally.
  • Deep integration with other Azure services, such as Azure Policy for non-compliant resource remediation and Azure DevOps for CI/CD.
  • Experience first-rate authoring with Visual Studio and Visual Studio Code.

Conclusion

Finally, we have reached the last section of the article and in today’s article, we have tried our level best to cover the Azure Resource Management Tools. We believe you liked this article and it was helpful.

Did you like this article? If Yes, please give DataFlair 5 Stars on Google

follow dataflair on YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *