BigTFromAZ
BigTFromAZ

Reputation: 776

Create an ARM template from an existing Azure object (e.g. a VM or VNET)

Here is what could be a dumb question but being somewhat new to Azure.

I created a virtual network and a number of RM/ARM virtual machines using the new portal. I have a gateway with two site-to-site connections. Now I discover (at least this is my perception at this time) that the certificate information needed for point-to-site capability can only be supplied when creating the network. I would also like to adjust the sub net sizes.

I think what this means is that I have to delete everything but the VHD files recreate the virtual network (providing the certificate, etc.) and then recreate the connections and VMs. It's a lot more work than I care to do in the portal (I keep dosing off waiting for things to finish, one-at-a-time). So here is the question.

Is there a tool or technique that can be used to create templates using existing Azure resources as input so that the resulting template can be used to easily restore the resources after deletion?

Any help you might offer would be greatly appreciated...

P.S. Before you bring it up, I know about azure quick start templates but flawlessly keying in parameters is not something I do well.

Upvotes: 3

Views: 5723

Answers (3)

Ken
Ken

Reputation: 56

Try https://resources.azure.com/. It should take the same credentials as the account you're using with Azure. You Expand the trees in the left-hand portion of the window to find the specific item you want to view. In your case, it's probably one of the following:

Subscriptions -> your subscription name -> providers -> Microsoft.Network -> virtualnetworks

Subscriptions -> your subscription name -> resourceGroups -> your resource group -> providers -> Microsoft.Network -> virtualnetworks -> your virtual network

Once you find the item you are interested in, you should see the JSON data on the right side of the screen. There are tabs above the URL, try selecting them to familiarize yourself with the different sets of information available. I usually find the Data tab to be pretty useful, but if I'm working in powershell, then selecting the PowerShell tab can be very useful.

Upvotes: 2

JulietBravo
JulietBravo

Reputation: 31

You can export ARM templates from the Portal or PowerShell:

Export-AzureRmResourceGroup -ResourceGroupName <String> [-Path <String>] [-IncludeParameterDefaultValue [<SwitchParameter>]] [-IncludeComments [<SwitchParameter>]]

See https://azure.microsoft.com/en-us/blog/export-template/

Upvotes: 2

Pedro G. Dias
Pedro G. Dias

Reputation: 3222

Fortunately, there is! Check out this:

http://capturegroup.azurewebsites.net

It takes a snapshot of an existing setup, and produces an ARM template :)

There is also a different tool that allows you to visually construct ARM templates, and then download them. It comes with a bunch of pre-configured templates for good measure too:

http://Armviz.io

Hope either of these helps you :)

Upvotes: 2

Related Questions