I have an ARM template that previously deployed but no longer does. The error message I receive is as follows:
At least one resource deployment operation failed. Please list
deployment operations for details. Please see
https://aka.ms/DeployOperations for usage details. Details:
InvalidRequestContent: The request content was invalid and could not
be deserialized: 'Could not find member 'name' on object of type
'TemplateOutputCopy'. Path
'properties.template.outputs.urlTemplateParameters.copy.name', line 1,
position 248.'. Check out the troubleshooting guide to see if your
issue is addressed:
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment?view=azure-devops#troubleshooting
Task failed while creating or updating the template deployment.
I was hoping somebody may be able to help me as I have no idea what's wrong.
The template files are as follows:
- Template.json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"subscriptionId": {
"type": "string",
"metadata": {
"description": "The Subscription Id where the resource group is located."
}
},
"ioResourceGroup": {
"type": "string",
"metadata": {
"description": "The name of the resource group where the resources are deployed."
}
},
"azFunctionName": {
"type": "string",
"metadata": {
"description": "The name that is given to the Azure Function App."
}
},
"apiManagementName": {
"type": "string",
"metadata": {
"description": "The name that is given to the Api Management Service."
}
},
"location": {
"type": "string",
"metadata": {
"description": "The location where the resource will be deployed."
}
},
"apiManagementKeyName": {
"type": "string",
"metadata": {
"description": "The name given to the key stored as a NamedValue."
}
},
"azFunctionKeyName": {
"type": "string",
"metadata": {
"description": "The name of the key in the Azure Function to look up and use."
}
},
"adminEmail": {
"type": "string",
"metadata": {
"description": "Publisher email used to send notifications and updates to. Not available for Consumption Tier but needs to be provided."
}
},
"orgName": {
"type": "string",
"metadata": {
"description": "Publisher organisation."
}
},
"apiManagementTier": {
"type": "string",
"defaultValue": "Consumption",
"metadata": {
"description": "The tier used for the Api Management Service."
}
},
"apiOperations": {
"type": "array",
"metadata": {
"description": "The endpoints to create for the Azure Function. Must be an array of objects with values: { "method": "", "name": "", "urlTemplate": "" }"
}
},
"apiAuthorisation": {
"type": "array",
"metadata": {
"description": "Authorisation details: Must be an array of objects with values: { "appId": "Application registration client id", "openIdConfigurations": "OpenID Connect configuration endpoint url" }"
}
}
},
"functions": [
{
"namespace": "utils",
"members": {
"concat": {
// Creates a string with all elements in an array
"parameters": [
{
"name": "strArray",
"type": "array"
// Array of elements to join together
},
{
"name": "joinStr",
"type": "string"
// Sting used to join elements, i.e. a comma
}
],
"output": {
"type": "string",
"value": "[if(empty(parameters('strArray')), '', replace(replace(substring(string(parameters('strArray')), 2, sub(length(string(parameters('strArray'))), 4)), '","', parameters('joinStr')), '\"', '"'))]"
}
},
"urlQuery": {
// Combines parameters parameters into a query string, i.e. ["Id={Id}", "Name={Name}"] into "?Id={Id}&Name={Name}"
"parameters": [
{
"name": "parArray",
"type": "array"
// Array of names of parameters
}
],
"output": {
"type": "string",
"value": "[if(empty(parameters('parArray')), '', concat('?', replace(replace(substring(string(parameters('parArray')), 2, sub(length(string(parameters('parArray'))), 4)), '","', '&'), '\"', '"')))]"
}
}
}
}
],
"variables": {
"azFunctionName": "[concat(parameters('azFunctionName'), '-', uniqueString(resourceGroup().id))]",
"apiManagementName": "[concat(parameters('apiManagementName'), '-', uniqueString(resourceGroup().id))]",
"audiences": "[concat('<audience>', utils.concat(variables('appIds'), '</audience><audience>'), '</audience>')]",
"openidConfigs": "[concat('<openid-config url="', replace(utils.concat(variables('oiConfigs'), ','), ',', '"/><openid-config url="'), '"/>')]",
"copy": [
{
"name": "appIds",
"count": "[length(parameters('apiAuthorisation'))]",
"input": "[parameters('apiAuthorisation')[copyIndex('appIds')].applicationId]"
},
{
"name": "oiConfigs",
"count": "[length(parameters('apiAuthorisation'))]",
"input": "[utils.concat(parameters('apiAuthorisation')[copyIndex('oiConfigs')].openIdConfigurations, ',')]"
}
]
},
"resources": [
{
// Helper resource to process apiOperations parameters
"name": "[concat('operation', copyIndex())]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2020-06-01",
"copy": {
"name": "operationId",
"count": "[length(parameters('apiOperations'))]",
"mode": "Serial"
},
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [],
"outputs": {
"urlTemplateParameters": {
// Converts apiOperations[].urlTemplateParameters[].name into an array of formatted query parameters, i.e. "Id" into "Id={Id}"
"type": "array",
"copy": {
"name": "urlTemplateParameter",
"count": "[length(parameters('apiOperations')[copyIndex()].urlTemplateParameters)]",
"input": "[if(empty(parameters('apiOperations')[copyIndex()].urlTemplateParameters), '""', format('{0}={{{0}}}', parameters('apiOperations')[copyIndex()].urlTemplateParameters[copyIndex('urlTemplateParameter')].Name))]"
}
}
}
}
}
},
{
"apiVersion": "2019-01-01",
"name": "[variables('apiManagementName')]",
"location": "[parameters('location')]",
"type": "Microsoft.ApiManagement/service",
"sku": {
"name": "[parameters('apiManagementTier')]"
},
"properties": {
"publisherEmail": "[parameters('adminEmail')]",
"publisherName": "[parameters('orgName')]"
},
"comments": "Resource Reference: ApiManagementService. The Api Management Resource."
},
{
"type": "Microsoft.ApiManagement/service/apiVersionSets",
"apiVersion": "2019-12-01",
"name": "[concat(variables('apiManagementName'), '/', variables('azFunctionName'))]",
"dependsOn": [
"[resourceId('Microsoft.ApiManagement/service', variables('apiManagementName'))]"
],
"properties": {
"displayName": "[variables('azFunctionName')]",
"versioningScheme": "Segment"
}
},
{
"type": "Microsoft.ApiManagement/service/apis",
"apiV