Step by Step ARM Templates - Deploying ARM Templates using Visual Studio

@20aman    Sep 20, 2016

Index of all blogs in this Step by Step ARM Templates series is located here: Step by Step Azure Resource Manager (ARM) Templates - Index

In the last blog we saw How to use Visual Studio to author ARM templates. In this blog we will see how to use Visual Studio (VS) to deploy the template without leaving VS.

Deploying with Visual Studio is very simple, straightforward and very intuitive. Just follow the below steps.

  1. Either go to the Solution Explorer -> Right Click on the project and select "Deploy -> New Deployment" as shown below:
    New Deployment - Solution Explorer
    Or you can go to the menu option Project -> Deploy -> New Deployment as shown below:
    New Deployment - Project Menu
    Once you click on the "New Deployment", you will be presented with the below Dialog for the deployment.
    New Deployment Dialog
    If you are not logged in then it will ask you to log into your Azure account.
  2. In the Dialog for "Deploy to Resource Group" select the Subscription by clicking on the first drop down.
  3. Next click on the drop down for the Resource Group. You can either select an existing Resource Group or you can click on "" option to create a new resource group for the current deployment.
    Resource Group creation
    If you click on "" option to create a new Resource Group then you will be presented with an additional popup.
    Resource Group creation additional Popup
    In this additional popup, type the name for your new resoruce group and the location in Azure where this should be created. Click "Create" once done in the additional popup.

  4. Next, we are going to provide the value for the parameters. Go ahead and click on the "Edit Parameters..." link in the "Deploy to Resource Group" dialog. This will open another popup to provide the parameters.
    Button to edit parameters is shown below:
    Edit Parameters
    Additional dialog to provide parameters is shown below:
    Providing Parameters
    Note the following points in the parameters:
    1. Corresponding to the string parameters, a text box is provided.
    2. For the secure string parameters like password, a secure password text box is provided.
    3. Corresponding to the parameters for which you have defined the "Allowed Values" in your template, a combo box (or drop Down) is provided with the "default Value" selected by default.
    Click Ok once done
  5. Next, click on the Deploy button to deploy the template to Azure.
  6. You can check the results in the Outputs window in the Visual Studio. Along with time stamp, it will show you what steps Visual Studio took to perform the deployment. It uses the values of parameters you provided and uses the PowerShell script to deploy the resources. You will notice the PowerShell window opening and prompt for the Admin Password.
    Note 1: The PowerShell window may not come above as active window. Just search and click on the window in your Taskbar.
    Provide the password and hit Enter as shown below: PowerShell window

    Note 2: It may take some time to complete the deployment after that. Wait and do not close the PowerShell window. It should automatically close once done.
    Note 3: Once the deployment completes the last line in Output window in Visual Studio will be: "Successfully deployed template..." as shown below:
    Success - Output Window

This is it! Navigate to the Azure portal and validate the deployed resources in your selected resource group.

Comments powered by Disqus