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.
Either go to the Solution Explorer -> Right Click on the project and select "Deploy -> New Deployment" as shown below:
Or you can go to the menu option Project -> Deploy -> New Deployment as shown below:
Once you click on the "New Deployment", you will be presented with the below Dialog for the deployment.
If you are not logged in then it will ask you to log into your Azure account.
In the Dialog for "Deploy to Resource Group" select the Subscription by clicking on the first drop down.
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.
If you click on "
" option to create a new Resource Group then you will be presented with an 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.
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:
Additional dialog to provide parameters is shown below:
Note the following points in the parameters:
- Corresponding to the string parameters, a text box is provided.
- For the secure string parameters like password, a secure password text box is provided.
- 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.
- Next, click on the Deploy button to deploy the template to Azure.
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:
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:
This is it! Navigate to the Azure portal and validate the deployed resources in your selected resource group.