I have an existing Azure template that provisions the following resources
Microsoft.ClassicStorage/StorageAccounts (api version 2014-06-01)
microsoft.insights/components (api version 2014-08-01)
and some others ...
Using the code in the article Resource providers and types I found out that the resource API versions on my template are few versions behind:
Microsoft.ClassicStorage/StorageAccounts. Current: 2014-06-01, available:
2016-11-01
2016-04-01
2015-12-01
2015-06-01
2014-06-01
2014-04-01-beta
2014-04-01
2014-01-01
microsoft.insights/components. Current: 2014-08-01, available:
2015-05-01
2014-12-01-preview
2014-08-01
2014-04-01
Here are the questions that I have
ARM template willnot recreate/overwrite the existing resource, if the resource is specified in the template. It will update the resource if the property values for a resource are changed.
This API version corresponds to a version of REST API operations that are released by the resource provider (Microsoft.Compute/virtualMachines is the resource provider and namespace for virtual machines, Microsoft.Storage/storageAccounts is the resource provider and namespace for storage and storage accounts - as ...
Actually there is a way to always use the latest API Version. I do not recommend it but you can use:
[providers('<provider>','<type>').apiVersions[0]]
Here is a working example with a storage account:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "uniquename",
"apiVersion": "[providers('Microsoft.Storage','storageAccounts').apiVersions[0]]",
"location": "West Europe",
"sku": {
"name": "Standard_LRS"
},
"kind": "Storage",
"properties": {}
}
]
}
I would prefer to use the most latest version when writing the ARM template and check for newer version when I encounter errors or I have to use some new features. I wrote two articles about how to determine latest API version for a resource provider and how to find outdated Azure ARM templates.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With