Azure Front Door - multiple frontends IDs as a parameter (array) to routing rule?

402 views Asked by At

Commonly, when there are multiple frontends IDs assigned to routing rule, they are described like this:

...
"routingRules": [
          {
            "name": "routingRule1",
            "properties": {
              "frontendEndpoints": [
                {
                  "id": "[resourceId('Microsoft.Network/frontDoors/frontendEndpoints', parameters('frontDoorName'), 'frontendEndpoint')]"
                },
                {
                  "id": "[resourceId('Microsoft.Network/frontDoors/frontendEndpoints', parameters('frontDoorName'), 'frontendEndpoint2')]"
                }
              ],
...

In my case I'd like to do this as a parameter type "array", but I receive error. Please see below my template, parameter file, and error message

this is front door ARM parameters deployment file

"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "frontdoor_name":  {
            "value":  "frontdoortest"
        },
        "frontends_all": {
            "value": [
                {
                    "name": "fe1",
                    "properties": {
                        "hostName": "frontdoortest.azurefd.net",
                        "sessionAffinityEnabledState": "Disabled",
                        "sessionAffinityTtlSeconds": 0,
                        "resourceState": "Enabled"
                    }
                },
                {
                    "name": "fe1customdns1",
                    "properties": {
                        "hostName": "dev.custom1.com",
                        "sessionAffinityEnabledState": "Enabled",
                        "sessionAffinityTtlSeconds": 0,
                        "resourceState": "Enabled"
                    }
                },
                {
                    "name": "fe1customdns2",
                    "properties": {
                        "hostName": "dev.custom2.com",
                        "sessionAffinityEnabledState": "Enabled",
                        "sessionAffinityTtlSeconds": 0,
                        "resourceState": "Enabled"
                    }
                }
            ]
        },
        "frontends_one": {
                    "value": [
                        {
                            "id": "[concat(resourceId('Microsoft.Network/frontdoors', parameters('frontdoor_name')), '/FrontendEndpoints/fe1customdns1')]",
                        },
                        {
                            "id": "[concat(resourceId('Microsoft.Network/frontdoors', parameters('frontdoor_name')), '/FrontendEndpoints/fe1customdns2')]",
                        } 
                    ]
        }
    }

this is part of front door ARM resource deployment template

...
"parameters": {
    "frontends_all": {
        "type": "array"
    },
    "frontends_one": {
        "type": "array"
    },
    "frontdoor_name": {
        "type": "string"
    }
}

...
{
            "type": "Microsoft.Network/frontDoors",
            "apiVersion": "2020-01-01",
            "name": "[parameters('frontdoor_name')]",
            "location": "Global",
            "properties": {
                "resourceState": "Enabled",
                "frontendEndpoints": "[parameters('frontends_all')]",  #### NO ERROR 
                "routingRules": [
                        {
                            "name": "routingRule1",
                            "properties": {
                                  "frontendEndpoints": "[parameters('frontends_one')]",    #### ERROR !!!
                                 "acceptedProtocols": [
                                    "Https"
                                ],
                                "patternsToMatch": [
                                    "/*",
                                ],
                                "enabledState": "Enabled",
                                "resourceState": "Enabled",
                                "routeConfiguration": {
                                    "@odata.type": "#Microsoft.Azure.FrontDoor.Models.FrontdoorForwardingConfiguration",
                                    "forwardingProtocol": "MatchRequest",
                                    "backendPool": {
                                        "id": "[concat(resourceId('Microsoft.Network/frontdoors', parameters('frontdoor_name')), '/backendpools/test')]"
                                    }
                                }
                            }
                        }
...

[error]BadRequest: Missing Hostname for FrontendEndpoint [resourceId('Microsoft.Network/frontDoors/frontendEndpoints', parameters('frontdoor_name'), 'fe1customdns2')] in RoutingRule routingRule1.,Missing Hostname for FrontendEndpoint [resourceId('Microsoft.Network/frontDoors/frontendEndpoints', parameters('frontdoor_name'), 'fe1customdns')] in RoutingRule routingRule1; A resource reference was invalid: "[resourceId('Microsoft.Network/frontDoors/frontendEndpoints', parameters('frontdoor_name'), 'fe1customdns2')]"; A resource reference was invalid: "[resourceId('Microsoft.Network/frontDoors/frontendEndpoints', parameters('frontdoor_name'), 'fe1customdns1')]"

0

There are 0 answers