Azure Resource Manager Template parameters - azure

I am trying my hands on over Azure Resource manager templates.
So for making any new resource I am trying to find out which all parameters are required and if they are mandatory or optional. But couldn't get any documentation for same.
I am looking for documentation which is somewhat similar to AWS. To get better in sites about the resources.
Thanks in advance!!
EDIT
I am not looking for parameters in general which are passed to the template. What I want is the resources parameters. The parameters which are given under the properties tag of every resource
Example-
In the below resource "virtualNetworks" there are resource parameters like addressSpace, subnets.
virtualNetworks

This should help you.
It is the schema for deployment templates. Within it, there are schemas for every type of resource that can be put into an arm template. For example, if we look at the schema for Virtual Machines, it contains all the available properties, profiles, extensions, what is required or not, etc.
However, it shouldn't be necessary for you to really look at this and learn it. When you are creating your arm template in visual studio, intellisense should kick in and show you whether what you are putting in the template is valid or not. For example, here I am editing the properties of a public IP, and it shows me what the available properties to add are.

you are right, there is a lack of documentation for resources and required parameters.
My advice is:
Check the Azure-Quickstart Templates, more than enough examples: Quickstart Templates
Since some days you can export ARM Templates from the Azure Portal. So create your resource in portal and export the Templates & Parameters: Microsoft Blog
Check the resource Explorer: Resource Explorer

Related

Best way to export Azure resource group configuration?

I've created a resource group on Azure containing all of my resources for my project that is coming to a close and I'd like to not be charged for the resources I will soon no longer be using. I'd like to come back to this project in the future however so my question is: is there a way of backing up my entire resource configuration so I can just redeploy it with ease in the future?
Many thanks.
Yes, You Can Export Resources from ResourceGroup which will generate a new template and that exported template you can download and you can import the template later when you need.
Select the resources from your resource group which you want to export and click on the export template.
Once the Template is generated you can find an Option of download template as shown below.
When you select custom deployment you can deploy the template which you downloaded.

How do i export an ARM template correctly from Azure?

I have already installed my azure environment with a VM, a storage account and a data base server, and it works fine, but now i want to export the ARM template in order to automate the whole proccess to my customers. The problem is that when exporting this message shows up:
error
So the question is how do i export an ARM template correctly from Azure with all my resources without having to do much fixing my final template?
that is expected. some resource types cannot be exported. you'd have to take a look at the api definition and use that to export those (say at resources.azure.com)
Simple: use bicep. Azure Resource Manager's transpiler (it's a sweeter syntax that solves your needs)
In Bicep the directive you're looking for in your Azure Resource Manager "ARM" template is keyword "existing"
https://github.com/Azure/bicep/blob/main/docs/tutorial/05-loops-conditions-existing.md
keyword "existing" lets you reference a resource without a complete definition.
Otherwise you need to provide the entire ARM definition for the object.
Export failures per resource type occur when a given resource types schema is not available. We are looking into how we can autogenerate schemas for Azure resource providers and onboarding them to this new process, improving the overall success of the Export Template API.

Cloning an Azure resource group using Deployment Details?

I am trying to replicate an existing Azure resource group using arm templates from the automation script section but running into a warning message about 10 resources types cannot be exported yet. One being Azure data factory. After searching online I found that templates for some resource types are not yet available. While looking at the Deployment section in my resource group, I am able to see a deployment details download link for each resource.
Can those be used to recreate each resource into a new resource group? Or is my best bet downloading the template from the automation script section and manually adding the resources for which the template are not yet available?
Any help would be appreciated.
Some of the warnings I got:
ResourceTypeSchemaNotFound:
***The schema of resource type 'Microsoft.DataFactory/dataFactories' is not available. Resources of this type will not be exported to the
template. (Code: ResourceTypeSchemaNotFound, Target:
Microsoft.DataFactory/dataFactories
ExportTemplateProviderError: all related to sql server
***Could not get resources of the type 'Microsoft.Sql/servers/connectionPolicies'. Resources of this type
will not be exported. (Code: ExportTemplateProviderError, Target:
Microsoft.Sql/servers/connectionPolicies)
***Could not get resources of the type 'Microsoft.Sql/servers/backupLongTermRetentionVaults'
***Could not get resources of the type 'Microsoft.Sql/servers/extendedAuditingSettings'.
The Azure resource group ARM templates from the automation script section are not as comprehensive as they should probably be. For example, it is quite possible to deploy a Data Factory instance from ARM. It provides a reasonable starting point but you will find resources that don't deploy as well as a lot of superfluous cruft.
The approach I take is to start from a clean template in Visual Studio and then construct a project from a blank template or quick-start, then refer to the template documentation and build up from scratch, using your exported ARM template from your resource group to help work out how it should look. This results in a nice clean reusable template project.
Unfortunately I have not found an better way yet.

How can you get the Azure automation script for just a single service?

How can you get the Azure automation script for just a single service?
In this case I've selected an App Service Plan, but when I click on it's "Automation script" in the Azure Portal, I get the script for everything (minus the various resource types "that cannot be exported yet" )
Unfortunately, export function only allows to export everything in the resource group, so you get an ARM template that represents the resource group.
If you want to get an ARM template solely for that resource, please deploy it into it's own resource group and then use the Automation script option.
Alternatively, you can use armviz to get a visual representation. When you click on a particular element, it will take you directly to that object in the arm template. Not exactly what you are looking for, but might give you enough.
You can't export just a single resource if there are multiple resources in the resource group, but maybe visual studio can help.
If you export the template and load it in VS as an arm template project, you can easily delete the other resources from the sidebar and leave just the one you need. You might also need to clean up the vars/params though.

How can I download template json for an Azure Resource Group that I created in the portal?

I am trying to find a way to retrieve the JSON version of an Azure Resource Group that I created in the portal. I've looked through all the PowerShell documentation, tried scraping JSON from the portal, all to no avail. There are some earlier questions that state that it isn't supported, but they are all fairly old (in terms of Azure feature release speed).
Is there any way to get the JSON for a Resource Group created in the Portal UI? Or is the template approach the only way to go?
While it is possible to retrieve the JSON for a resource group from the Azure Resource Explorer, there are some caveats you need to be aware of.
Resource Explorer is a tool that describes the current runtime configuration rather than the deployment configuration that a resource template does. While it is primarily the same language there are a number of subtle differences.
For instance resource explorer will tell you the IP address that is assigned to a NIC, which isn't something that is possible to assign from a template.
While they can be a good starting point for building resource templates you will need to go through them and clean out the extraneous information.
Personally my three calling points in building resource templates are
Azure Resource Explorer
Azure Quickstart Templates
Azure Resource Manager Schemas
Between the three of those you can usually put together some concise, powerful templates.
There is a feedback item that is 'under review' to allow for the creation of full ARM templates from existing resource groups.
You can use the Azure Resource Explorer to view the JSON representation of your Azure resources. The source code is also available on GitHub in case if you want to learn how it works: https://github.com/projectkudu/ARMExplorer
This is now available in the Azure portal, portal.azure.com. If you browse to a resource group in the portal, under "All settings" for the resource group, there is now an "Export template" option.
Looking at portal.azure.com as of 3/28/2016 it looks like the options have changed from some of the previous responses...
Go to portal.azure.com and log in
Click on "Resource Groups"
Click on "All Settings"
Click on "Deployments"
Click on the particular resource/deployment for which you want to create a template
Click on "Export Template" near the top of the tile/page.
Note: Some of the deployments may not give access to the "Export Template" button. For these, you will most likely see a "Template Link" in the resource summary which gives access to the generic template for that resource deployment.

Resources