0

It has been months already since I have been trying to implement and deploy a IaC template for Azure Logic Apps. The playbook I'm trying to deploy is based on a custom connector which I would like to deploy together with the playbook itself using nested deployment.

{
      "type": "Microsoft.Resources/deployments",
      "apiVersion": "2021-04-01",
      "name": "custom_connector_template_link",
      "dependsOn": [],
      "properties": {
        "mode": "Incremental",
        "templateLink": {
          "relativePath": "custom_connector/template.json"
        }
      }
    }

This short piece of code should get job done but unfortunately it doesn't. Indeed, when starting the deployment through Azure DevOps, it shows the following:

[Warning] Skipping deployment for D:\a\1\s\UAT\Playbook\get_geo_from_ip\azuredeploy.json. The file contains resources for content that was not selected for deployment. Please add content type to connection if you want this file to be deployed.

One might think that is the nested template the root cause, but it is not because I deployed it as a standalone component.

If you need more information, just let know. I'll be really glad to receive your help.

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
Jacopo Terrinoni
  • 173
  • 1
  • 14

1 Answers1

0

Make sure the content type for the custom connection is present in the deployment scope or template parameters of your main template to resolve issue.

In order to fix this warning refer this Connection resource definition of ARM template for Logic app and make sure your template.json that contains custom connector is properly formatted.

In your main deployment file, azdeploy.json add the parameter for custom connector like below:-

"parameters": {
  "customConnectorContentType": {
    "type": "string",
    "defaultValue": "application/vnd.microsoft.appconnect.connectordefinition+json",
    "metadata": {
      "description": "Content type for the custom connector."
    }
  }
}

In your nested template , Pass the content-type parameter like below:-

{
  "type": "Microsoft.Resources/deployments",
  "apiVersion": "2021-04-01",
  "name": "custom_connector_template_link",
  "dependsOn": [],
  "properties": {
    "mode": "Incremental",
    "templateLink": {
      "relativePath": "custom_connector/template.json"
    },
    "parameters": {
      "contentVersion": {
        "value": "[parameters('customConnectorContentType')]"
      }
    }
  }
}

Another sample you can try is the below one:-

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "logicAppName": {
            "type": "string",
            "metadata": {
                "description": "The name of the Logic App to create."
            }
        },
        "customConnectorTemplateUrl": {
            "type": "string",
            "metadata": {
                "description": "The URL of the ARM template for the custom connector."
            }
        }
    },
    "variables": {
        "customConnectorDeploymentName": "[concat('customConnectorDeployment-', uniqueString(resourceGroup().id))]"
    },
    "resources": [
        {
            "type": "Microsoft.Logic/workflows",
            "apiVersion": "2017-07-01",
            "name": "[parameters('logicAppName')]",
            "location": "[resourceGroup().location]",
            "properties": {
                "definition": {
                    "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
                    "contentVersion": "1.0.0.0",
                    "parameters": {},
                    "triggers": {
                        "Recurrence": {
                            "type": "Recurrence",
                            "recurrence": {
                                "frequency": "Hour",
                                "interval": 1
                            }
                        }
                    },
                    "actions": {
                        "CustomConnectorDeployment": {
                            "type": "Microsoft.Resources/deployments",
                            "apiVersion": "2021-04-01",
                            "name": "[variables('customConnectorDeploymentName')]",
                            "properties": {
                                "mode": "Incremental",
                                "templateLink": {
                                    "uri": "[parameters('customConnectorTemplateUrl')]"
                                }
                            }
                        }
                    },
                    "outputs": {}
                },
                "parameters": {}
            }
        }
    ]
}

My Azure yaml pipeline script:-

steps:
- task: AzureResourceManagerTemplateDeployment@3
  displayName: 'ARM Template deployment: Resource Group scope'
  inputs:
    azureResourceManagerConnection: 'SID subscription(xxxx4xxxe97cb2a7)'
    subscriptionId: 'xxxxxdxxxe2b6e97cb2a7'
    resourceGroupName: siliconrg32
    location: 'Australia East'
    csmFile: '$(System.DefaultWorkingDirectory)/_azurelogicapps/azdeploy.json'
SiddheshDesai
  • 3,668
  • 1
  • 2
  • 11
  • Thanks for your help @SiddhesiDesai. I implemented the solution you proposed, and unfortunately it doesn't work. What exactly the value of the parameter "customConnectorContentType" is? I think it is the first time I see such a string. Would you clarify a bit more about it? – Jacopo Terrinoni Aug 09 '23 at 11:41