0

I have an Azure Resource Group Deployment project in Visual Studio 2019 that validates and deploys fine from Visual Studio, however when I try to deploy it through Azure Release Pipeline with an Azure Resource Group Deployment Task it intermittently fails with the error:

The request content was invalid and could not be deserialized: 'Required property 'type' not found in JSON. Path 'properties.template.resources[6]', line 1, position 3759.'. Task failed while creating or updating the template deployment.

I haven't been able to find any helpful information in my research of the problem. Here is the template:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "sql_name": {
      "defaultValue": "project-sql",
      "type": "String"
    },
    "name": {
      "defaultValue": "a-data-factory",
      "type": "String"
    },
    "location": {
      "defaultValue": "Central US",
      "type": "String"
    },
    "apiVersion": {
      "defaultValue": "2018-06-01",
      "type": "String"
    },
    "gitAccountName": {
      "type": "String"
    },
    "gitRepositoryName": {
      "type": "String"
    },
    "gitBranchName": {
      "defaultValue": "foo-branch",
      "type": "String"
    },
    "gitRootFolder": {
      "defaultValue": "/",
      "type": "String"
    },
    "gitProjectName": {
      "type": "String"
    },
    "ssisdbname": {
      "type": "String",
      "defaultValue": "SSISDB"
    },
    "factoryName": {
      "type": "string",
      "metadata": "Data Factory Name",
      "defaultValue": "a-data-factory"
    }
  },
  "variables": {
    "factoryId": "[concat('Microsoft.DataFactory/factories/', parameters('factoryName'))]"
  },
  "resources": [
    {
      "type": "Microsoft.Sql/servers",
      "apiVersion": "2015-05-01-preview",
      "name": "[parameters('sql_name')]",
      "location": "northcentralus",
      "kind": "v12.0",
      "properties": {
        "administratorLogin": "theadmin",
        "administratorLoginPassword": "",
        "version": "12.0"
      }
    },
    {
      "type": "Microsoft.Sql/servers/databases",
      "apiVersion": "2017-03-01-preview",
      "name": "[concat(parameters('sql_name'), '/dummyDB')]",
      "location": "northcentralus",
      "dependsOn": [
        "[resourceId('Microsoft.Sql/servers', parameters('sql_name'))]"
      ],
      "sku": {
        "name": "S0",
        "tier": "Standard"
      },
      "kind": "v12.0,user",
      "properties": {
        "collation": "SQL_Latin1_General_CP1_CI_AS",
        "maxSizeBytes": 268435456000,
        "catalogCollation": "SQL_Latin1_General_CP1_CI_AS",
        "zoneRedundant": false
      }
    },
    {
      "type": "Microsoft.Sql/servers/databases",
      "apiVersion": "2017-03-01-preview",
      "name": "[concat(parameters('sql_name'), '/dummerDB')]",
      "location": "northcentralus",
      "dependsOn": [
        "[resourceId('Microsoft.Sql/servers', parameters('sql_name'))]"
      ],
      "sku": {
        "name": "S0",
        "tier": "Standard"
      },
      "kind": "v12.0,user",
      "properties": {
        "collation": "SQL_Latin1_General_CP1_CI_AS",
        "maxSizeBytes": 268435456000,
        "catalogCollation": "SQL_Latin1_General_CP1_CI_AS",
        "zoneRedundant": false
      }
    },
    {
      "type": "Microsoft.Sql/servers/encryptionProtector",
      "apiVersion": "2015-05-01-preview",
      "name": "[concat(parameters('sql_name'), '/current')]",
      "dependsOn": [
        "[resourceId('Microsoft.Sql/servers', parameters('sql_name'))]"
      ],
      "kind": "servicemanaged",
      "properties": {
        "serverKeyName": "ServiceManaged",
        "serverKeyType": "ServiceManaged"
      }
    },
    {
      "type": "Microsoft.Sql/servers/firewallRules",
      "apiVersion": "2015-05-01-preview",
      "name": "[concat(parameters('sql_name'), '/AllowAllWindowsAzureIps')]",
      "dependsOn": [
        "[resourceId('Microsoft.Sql/servers', parameters('sql_name'))]"
      ],
      "properties": {
        "startIpAddress": "0.0.0.0",
        "endIpAddress": "0.0.0.0"
      }
    },
    {
      "type": "Microsoft.DataFactory/factories",
      "apiVersion": "[parameters('apiVersion')]",
      "name": "[parameters('factoryName')]",
      "location": "[parameters('location')]",
      "identity": {
        "type": "SystemAssigned"
      },
      "resources": [
        {
          "name": "[concat(parameters('factoryName'), '/theIntegrationRuntime1')]",
          "type": "Microsoft.DataFactory/factories/integrationRuntimes",
          "apiVersion": "2018-06-01",
          "properties": {
            "type": "Managed",
            "typeProperties": {
              "computeProperties": {
                "location": "Central US",
                "nodeSize": "Standard_D2_v3",
                "numberOfNodes": 1,
                "maxParallelExecutionsPerNode": 2
              },
              "ssisProperties": {
                "catalogInfo": {
                  "catalogServerEndpoint": "project-sql.database.windows.net",
                  "catalogAdminUserName": "theadmin",
                  "catalogAdminPassword": {
                    "type": "SecureString",
                    "value": ""
                  },
                  "catalogPricingTier": "S0"
                },
                "edition": "Standard",
                "licenseType": "LicenseIncluded"
              }
            }
          },
          "dependsOn": [ "[resourceId('Microsoft.DataFactory/factories', parameters('factoryname'))]" ]
        }
      ],
      "properties": {
        "repoConfiguration": {
          "type": "FactoryVSTSConfiguration",
          "accountName": "[parameters('gitAccountName')]",
          "repositoryName": "[parameters('gitRepositoryName')]",
          "collaborationBranch": "[parameters('gitBranchName')]",
          "rootFolder": "[parameters('gitRootFolder')]",
          "projectName": "[parameters('gitProjectName')]"
        }
      },
      "dependsOn": [ "[resourceId('Microsoft.Sql/servers', parameters('sql_name'))]" ]
    }
  ]
}
TrevorBrooks
  • 3,590
  • 3
  • 31
  • 53
  • this looks fine, show how you are deploying this in ADO? – 4c74356b41 Sep 28 '19 at 19:14
  • just using a simple Azure Release Pipeline with an Azure Resource Group Deployment Task...it usually succeeds, intermittently fails. – TrevorBrooks Sep 28 '19 at 19:23
  • hosted agent? how are you delivering templates to the agent? try updating the task to the latest version? – 4c74356b41 Sep 28 '19 at 19:35
  • I have a self hosted agent. – TrevorBrooks Sep 28 '19 at 23:22
  • I'd never get why people are only answering some of the questions asked. try using powershell task instead of resource group deployment task. i, personally, never use deployment task because its lacking functionallity – 4c74356b41 Sep 29 '19 at 05:47
  • Thank you for trying to help, it turns out that the release pipeline was pointing to an old build artifact that had a malformed template. – TrevorBrooks Sep 29 '19 at 17:49
  • what do you mean "trying to help". that was the question I've asked specifically. `how are you delivering templates to the agent`. – 4c74356b41 Sep 29 '19 at 18:06

1 Answers1

0

The Release Pipeline was pointed to an old build artifact with a malformed template.

TrevorBrooks
  • 3,590
  • 3
  • 31
  • 53