Azure Resource Manager template considerations
Applies to: Azure Stack integrated systems and Azure Stack Development Kit
As you develop your application, it is important to ensure template portability between Azure and Azure Stack. This article provides considerations for developing Azure Resource Manager templates, so you can prototype your application and test deployment in Azure without access to an Azure Stack environment.
Resource provider availability
The template that you are planning to deploy must only use Microsoft Azure services that are already available or in preview in Azure Stack.
Public namespaces
Because Azure Stack is hosted in your datacenter, it has different service endpoint namespaces than the Azure public cloud. As a result, hardcoded public endpoints in Azure Resource Manager templates fail when you try to deploy them to Azure Stack. Instead, you can use the reference and concatenate function to dynamically build the service endpoint based on values retrieved from the resource provider during deployment. For example, rather than specifying blob.core.windows.net in your template, retrieve the primaryEndpoints.blob to dynamically set the osDisk.URI endpoint:
"osDisk": {"name": "osdisk","vhd": {"uri":
"[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), '2015-06-15').primaryEndpoints.blob, variables('vmStorageAccountContainerName'),
'/',variables('OSDiskName'),'.vhd')]"}}
API versioning
Azure service versions may differ between Azure and Azure Stack. Each resource requires the apiVersion attribute, which defines the capabilities offered. To ensure API version compatibility in Azure Stack, the following are valid API versions for each Resource Provider:
Resource Provider | apiVersion |
---|---|
Compute | '2015-06-15' |
Network | '2015-06-15' , '2015-05-01-preview' |
Storage | '2016-01-01' , '2015-06-15' , '2015-05-01-preview' |
KeyVault | '2015-06-01' |
App Service | '2015-08-01' |
Template functions
Azure Resource Manager functions provide capabilities required to build dynamic templates. As an example, you can use functions for tasks like:
- Concatenating or trimming strings
- Reference values from other resources
- Iterating on resources to deploy multiple instances
These functions are not available in Azure Stack:
- Skip
- Take
Resource location
Azure Resource Manager templates use a location attribute to place resources during deployment. In Azure, locations refer to a region like West US or South America. In Azure Stack, locations are different because Azure Stack is in your datacenter. To ensure templates are transferrable between Azure and Azure Stack, you should reference the resource group location as you deploy individual resources. You can do this using [resourceGroup().Location]
to ensure all resources inherit the resource group location. The following excerpt is an example of using this function while deploying a storage account:
"resources": [
{
"name": "[variables('storageAccountName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "[variables('apiVersionStorage')]",
"location": "[resourceGroup().location]",
"comments": "This storage account is used to store the VM disks",
"properties": {
"accountType": "Standard_GRS"
}
}
]