Data/ARMTemplates/appconfig.json

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "appConfigName": {
            "type": "string",
            "metadata": {
                "description": "Specifies the name of the App Configuration store."
            }
        },
        "location": {
            "type": "string",
            "defaultValue": "[resourceGroup().location]",
            "metadata": {
                "description": "Specifies the Azure location where the app configuration store should be created."
            }
        },
        "featureFlags": {
            "type": "array",
            "defaultValue": [
                {
                    "id": "GenevaLogging",
                    "description": "Feature flag to use Geneva Monitoring.",
                    "enabled": "false"
                }
            ],
            "metadata": {
                "description": "List of feature flags to set. These are specifically for the feature management tools in App Config, not key-vaule pairs."
            }
        },
        "localDeployment": {
            "type": "bool",
            "defaultValue": false,
            "metadata": {
                "description": "Specifies whether the deployment is initiated from local."
            }
        },
        "sku": {
            "type": "string",
            "defaultValue": "Standard",
            "metadata": {
                "description": "Specifies the sku to be used."
            }
        }
    },
    "resources": [
        {
            "apiVersion": "2021-10-01-preview",
            "name": "[parameters('appConfigName')]",
            "type": "Microsoft.AppConfiguration/configurationStores",
            "location": "[parameters('location')]",
            "sku": {
                "name": "[parameters('sku')]"
            },
            "properties": {
                "disableLocalAuth": "[not(parameters('localDeployment'))]"
            }
        },
        {
            "apiVersion": "2021-10-01-preview",
            "name": "[format('{0}/{1}', parameters('appConfigName'), concat('.appconfig.featureflag~2F', parameters('featureFlags')[copyIndex()].id))]",
            "type": "Microsoft.AppConfiguration/configurationStores/keyValues",
            "dependsOn": [
                "[resourceId('Microsoft.AppConfiguration/configurationStores', parameters('appConfigName'))]"
            ],
            "copy": {
                "name": "configStoreKeyValue",
                "count": "[length(parameters('featureFlags'))]"
            },
            "properties": {
                "value": "[concat('{\"id\":\"',parameters('featureFlags')[copyIndex()].id,'\",\"description\":\"',parameters('featureFlags')[copyIndex()].description,'\",\"enabled\":',parameters('featureFlags')[copyIndex()].enabled,',\"conditions\":{\"client_filters\":[]}}')]",
                "contentType": "application/vnd.microsoft.appconfig.ff+json;charset=utf-8"
            }
        },
        {
            "condition": "[parameters('localDeployment')]",
            "apiVersion": "2022-05-01",
            "type": "Microsoft.Resources/deployments",
            "name": "enforceDisableLocalAuth",
            "dependsOn": [
                "[resourceId('Microsoft.AppConfiguration/configurationStores', parameters('appConfigName'))]",
                "configStoreKeyValue"
            ],
            "properties": {
                "mode": "Incremental",
                "parameters": {},
                "template": {
                    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
                    "contentVersion": "1.0.0.1",
                    "parameters": {},
                    "variables": {},
                    "resources": [
                        {
                            "apiVersion": "2021-10-01-preview",
                            "name": "[parameters('appConfigName')]",
                            "type": "Microsoft.AppConfiguration/configurationStores",
                            "location": "[parameters('location')]",
                            "sku": {
                                "name": "[parameters('sku')]"
                            },
                            "properties": {
                                "disableLocalAuth": true
                            }
                        }
                    ]
                }
            }
        }
    ]
}