Automate Azure VM Creation and Windows and SQL Server Installation and other configurations using Azure Resource Manager Template

Shivendoo Kumar 736 Reputation points

Hi All,
Recently, I created an

  1. Azure VM and enabled RDP Port (
  2. Installed Windows and SQL Server 2016 on it.
  3. Also Infra Structure guy has created Site-to-Site VPN. ( OR
  4. and joined Azure VM to Active Directory domain (
  5. Enable Ports (TCP port 2383 and 2382) for SSAS (,click%20Endpoints%2C%20and%20click%20Add.&text=Then%2C%20log%20into%20the%20VM,port%202383%20in%20Inbound%20Rules. OR

I want to automate whole process so that next time if I have to do same thing I can do it quickly and using Azure Resource Manager Template. Or may be using Power-Shell Script.

Please Gurus Help me. I need to know how other people achieve this and best and easiest way to automate this.

Infra guy has created following to achieve Site-to-Site VPN:

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,516 questions
{count} vote

Accepted answer
  1. prmanhas-MSFT 17,901 Reputation points Microsoft Employee

    @ShivendooKumar-8455 Thank you for your response.

    The easiest way to recreate a group of resources is to first export the template for the entire resource group. In the portal, navigate to the "Resource Group" blade and choose "Export Template" from the menu on the left. You will get a file named "ExportedTemplate-[rg_name].zip" which contains files named "template.json" (this is your ARM template) and "parameters.json".

    When you are ready to redeploy your resources, you will need to use az group deployment create (deprecated) or az deployment group create, depending on which version of Azure CLI you are running. The command-line will look something like: "az group deployment create --resource-group RG-NAME --mode incremental --template-file template.json --parameters @parameters.json". The "deploy a custom template" service in the Azure Portal (referred to in your link) is equivalent to the Azure CLI command "az group deployment create".

    Please note, if you have other resources in the resource group that weren't deleted and you have changed them via portal after exporting your template, you should remove them from the template before importing. Otherwise, configuration changes you have made could be reverted.

    You can also follow the same sequence using each of the individual resources and deploy them one at a time. Using this method, attention will need to be paid to the ordering of resource creation based on dependencies between your resources. If you export the entire resource group, Azure will take care of the inter-dependencies automatically.

    Please let me know if you have any additional questions.

    Hope it helps.

    Please 'Accept as answer' if it helped, so that it can help others in the community looking for help on similar topics

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. prmanhas-MSFT 17,901 Reputation points Microsoft Employee

    @ShivendooKumar-8455 Thank you for your question.

    Azure Resource Manager Template can help you automate manual actions items including all the items mentioned above. Azure has multiple samples of same available in GitHub which you can look at as reference point.

    In case you need help with some specific template, let me know and I will try to help you about it.

    Hope this helps.

    Please 'Accept as answer' if it helped, so that it can help others in the community looking for help on similar topics.

    1 person found this answer helpful.