I am trying to deploy Redis by the means of an ARM template and to keep the Redis hostname unique, I prepend the resource group name to it with:
"variables": {
"resourceName": "[concat(resourceGroup().id, '-', parameters('redisCacheName'))]"
},
However I suddenly get the following error, searching for which gives wildly different answers:
Deployment template validation failed: 'The template resource '/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX/resourceGroups/my-group-my-redis' for type 'Microsoft.WindowsAzure.ResourceStack.Frontdoor.Common.Entities.TemplateGenericProperty`1[System.String]' at line '1' and column '640' has incorrect segment lengths.
A nested resource type must have identical number of segments as its resource name. A root resource type must have segment length one greater than its resource name. Please see https://aka.ms/arm-template/#resources for usage details.'.
I do not understand why some "Frontdoor" is mentioned, when I am trying to deploy a Basic Redis instance and what is please the fix here?
Below is my ARM template:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"redisCacheName": {
"defaultValue": "my-redis",
"type": "String"
}
},
"variables": {
"resourceName": "[concat(resourceGroup().id, '-', parameters('redisCacheName'))]"
},
"outputs": {
"RedisCacheEndpoint": {
"type": "string",
"value": "[concat(reference(variables('resourceName')).hostName, ':', reference(variables('resourceName')).sslPort)]"
},
"RedisCachePassword": {
"type": "string",
"value": "[reference(variables('resourceName')).accessKeys.primaryKey]"
}
},
"resources": [
{
"type": "Microsoft.Cache/Redis",
"apiVersion": "2019-07-01",
"name": "[variables('resourceName')]",
"location": "[resourceGroup().location]",
"properties": {
"sku": {
"name": "Basic",
"family": "C",
"capacity": 1
},
"enableNonSslPort": false
}
}
]
}
And here is the parameters file:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"redisCacheName": {
"value": "my-redis"
}
}
}
I am trying to deploy the Redis instance into my RG called "my-group" and while deploying I use the parameter value "my-redis" -
while hoping to have a Redis endpoint with the unique name "my-group-my-redis.redis.cache.windows.net:6380" at the end.