bicep icon indicating copy to clipboard operation
bicep copied to clipboard

RedisEnterprise resource deployment fails subsequently

Open Rasmus715 opened this issue 1 year ago • 21 comments

Bicep version Used within Azure DevOps ubuntu-latest agent. 0.38.33 (6bb5d5f859)

Describe the bug When redisEnterpise & database is specified in bicep file, deployment to the Azure fails. However, manual resource creation via Marketplace works successfully.

To Reproduce

  1. Add following resources to bicep file:
resource redisEnterprise 'Microsoft.Cache/redisEnterprise@2025-08-01-preview' = {
  name: 'redis-${prefix}-${environment}-${locationShort}'
  location: location
  sku: {
    name: 'Balanced_B0'
  }
  properties: {
    highAvailability: 'Enabled'
    publicNetworkAccess: 'Enabled'
  }
  tags: {}
}

resource redisEnterpriseDatabase 'Microsoft.Cache/redisEnterprise/databases@2025-08-01-preview' = {
  name: 'default'
  parent: redisEnterprise
  properties: {
    clientProtocol: 'Encrypted'
    evictionPolicy: 'NoEviction'
    clusteringPolicy: 'OSSCluster'
    deferUpgrade: 'NotDeferred'
    persistence: {
      aofEnabled: false
      rdbEnabled: false
    }
    accessKeysAuthentication: 'Enabled'
  }
}
  1. Deploy infrastructure to Azure

ARM Template:

        {
            "type": "Microsoft.Cache/redisEnterprise",
            "apiVersion": "2025-08-01-preview",
            "name": "[format('redis-{0}-{1}-{2}', parameters('prefix'), parameters('environment'), parameters('locationShort'))]",
            "location": "[parameters('location')]",
            "tags": {},
            "sku": {
                "name": "Balanced_B0"
            },
            "properties": {
                "highAvailability": "Enabled",
                "publicNetworkAccess": "Enabled"
            }
        },
        {
            "type": "Microsoft.Cache/redisEnterprise/databases",
            "apiVersion": "2025-08-01-preview",
            "name": "[format('{0}/{1}', format('redis-{0}-{1}-{2}', parameters('prefix'), parameters('environment'), parameters('locationShort')), 'default')]",
            "dependsOn": [
                "[resourceId('Microsoft.Cache/redisEnterprise', format('redis-{0}-{1}-{2}', parameters('prefix'), parameters('environment'), parameters('locationShort')))]"
            ],
            "properties": {
                "clientProtocol": "Encrypted",
                "evictionPolicy": "NoEviction",
                "clusteringPolicy": "OSSCluster",
                "deferUpgrade": "NotDeferred",
                "persistence": {
                    "aofEnabled": false,
                    "rdbEnabled": false
                },
                "accessKeysAuthentication": "Enabled"
            }
        },

Additional context location: WestEurope Version downgrade of the resource does not mitigate the issue.

Image

Rasmus715 avatar Dec 02 '25 14:12 Rasmus715

It looks like you did not include the "localPath" property to your template. Can you try adding that property and deploy again?

stephaniezyen avatar Dec 03 '25 21:12 stephaniezyen

https://learn.microsoft.com/en-us/azure/templates/microsoft.cache/redisenterprise?pivots=deployment-language-bicep

https://learn.microsoft.com/en-us/azure/templates/microsoft.cache/redisenterprise/databases?pivots=deployment-language-bicep

No localPath property is specified in documentation of these resources.

This is an ARM that comes when creating resource via Azure Wizard (Marketplace). It does not contain localPath field as well.

{
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "0.0.0.1",
    "parameters": {},
    "resources": [
        {
            "name": "testtesttest",
            "type": "Microsoft.Cache/redisEnterprise",
            "apiVersion": "2025-07-01",
            "properties": {
                "highAvailability": "Enabled",
                "publicNetworkAccess": "Enabled"
            },
            "location": "westeurope",
            "dependsOn": [],
            "sku": {
                "name": "Balanced_B0"
            },
            "tags": {},
            "resources": [
                {
                    "name": "testtesttest/default",
                    "type": "Microsoft.Cache/redisEnterprise/databases",
                    "apiVersion": "2025-05-01-preview",
                    "properties": {
                        "clientProtocol": "Encrypted",
                        "evictionPolicy": "NoEviction",
                        "clusteringPolicy": "OSSCluster",
                        "deferUpgrade": "NotDeferred",
                        "persistence": {
                            "aofEnabled": false,
                            "rdbEnabled": false
                        },
                        "accessKeysAuthentication": "Enabled"
                    },
                    "dependsOn": [
                        "Microsoft.Cache/redisEnterprise/testtesttest"
                    ],
                    "tags": {}
                }
            ]
        }
    ]
}

Rasmus715 avatar Dec 04 '25 08:12 Rasmus715

Adding "localPath" to a set of properties of both redisEnterpise and redisEnterpise/database does nothing. Adding "localPath" to properties of a resource itself fails bicep build.

2025-12-04T08:31:26.4980599Z az bicep build --file /home/vsts/work/1/s/redacted/redacted.bicep
2025-12-04T08:31:26.4981176Z ========================== Starting Command Output ===========================
2025-12-04T08:31:26.4991589Z [command]/usr/bin/bash --noprofile --norc /home/vsts/work/_temp/74e36c73-933b-4253-919b-284a2d96aead.sh
2025-12-04T08:31:32.4166636Z WARNING: /home/vsts/work/1/s/redacted/redacted.bicep(147,5) : Warning BCP037: The property "localPath" is not allowed on objects of type "ClusterCreateProperties". Permissible properties include "encryption", "minimumTlsVersion". If this is a resource type definition inaccuracy, report it using https://aka.ms/bicep-type-issues. [https://aka.ms/bicep/core-diagnostics#BCP037]
2025-12-04T08:31:32.4167637Z WARNING: /home/vsts/work/1/s/redacted/redacted.bicep(163,5) : Warning BCP037: The property "localPath" is not allowed on objects of type "DatabaseCreateProperties". Permissible properties include "geoReplication", "modules", "port". If this is a resource type definition inaccuracy, report it using https://aka.ms/bicep-type-issues. [https://aka.ms/bicep/core-diagnostics#BCP037]
2025-12-04T08:31:32.6359464Z ERROR: /home/vsts/work/1/s/redacted/redacted.bicep(145,3) : Error BCP037: The property "localPath" is not allowed on objects of type "Microsoft.Cache/redisEnterprise". Permissible properties include "asserts", "dependsOn", "identity", "zones". If this is a resource type definition inaccuracy, report it using https://aka.ms/bicep-type-issues. [https://aka.ms/bicep/core-diagnostics#BCP037]
2025-12-04T08:31:32.6360659Z /home/vsts/work/1/s/redacted/redacted.bicep(157,3) : Error BCP037: The property "localPath" is not allowed on objects of type "Microsoft.Cache/redisEnterprise/databases". Permissible properties include "asserts", "dependsOn". If this is a resource type definition inaccuracy, report it using https://aka.ms/bicep-type-issues. [https://aka.ms/bicep/core-diagnostics#BCP037]
2025-12-04T08:31:32.7936037Z 
2025-12-04T08:31:32.8018493Z ##[error]Bash exited with code '1'.

Rasmus715 avatar Dec 04 '25 08:12 Rasmus715

I'm having same issue as well. It is true that there's no "localPath" configuration based on the documentation.

Image

barefootwanderer21 avatar Dec 08 '25 02:12 barefootwanderer21

Any updates? Blocks me from moving to this resource from Azure Cache for Redis

Rasmus715 avatar Dec 12 '25 07:12 Rasmus715

@stephaniezyen

Rasmus715 avatar Dec 17 '25 07:12 Rasmus715

@Rasmus715 if you were already able to deploy these resoures manually, have you tried using the Insert Resource Command or Portal export? Sometimes what happens is the resource provider hasn't correctly documented the available properties - this can help to discover what is missing.

@stephaniezyen I think it would be worth engaging the owners of this resource type internally, to see if they can share guidance on this thread.

anthony-c-martin avatar Dec 17 '25 13:12 anthony-c-martin

The Portal Export returns the next resources

resource redisEnterprise_resource 'Microsoft.Cache/redisEnterprise@2025-05-01-preview' = {
  name: redisEnterprise
  location: 'West Europe'
  sku: {
    name: 'Balanced_B0'
  }
  kind: 'v2'
  identity: {
    type: 'None'
  }
  properties: {
    minimumTlsVersion: '1.2'
    highAvailability: 'Enabled'
  }
}

resource redisEnterprise_default 'Microsoft.Cache/redisEnterprise/databases@2025-05-01-preview' = {
  parent: redisEnterprise
  name: 'default'
  properties: {
    clientProtocol: 'Encrypted'
    port: 10000
    clusteringPolicy: 'OSSCluster'
    evictionPolicy: 'NoEviction'
    persistence: {
      aofEnabled: false
      rdbEnabled: false
    }
    deferUpgrade: 'NotDeferred'
    accessKeysAuthentication: 'Enabled'
  }
}

Replacing my existing Redis resource with this still produces an error in Azure.

"Insert Resource" command gives the next resource specification:

@description('Generated from redacted')
resource redisEnterprise 'Microsoft.Cache/redisEnterprise@2025-08-01-preview' = {
  location: 'West Europe'
  name: 'redis-${prefix}-${environment}-${locationShort}'
  tags: {}
  sku: {
    name: 'Balanced_B0'
  }
  properties: {
    minimumTlsVersion: '1.2'
    highAvailability: 'Enabled'
    publicNetworkAccess: 'Enabled'
  }
  identity: {
    type: 'None'
  }
}

With which bicep deployment still fails with the same error.

{ "errors": { "localPath": [ "The localPath field is required." ] }, "type": "https://tools.ietf.org/html/rfc9110#section-15.5.1", "title": "One or more validation errors occurred.", "status": 400, "traceId": "00-7fddf0a107cba81deb0875219f90647a-23ded10c6db8f37d-01" } (Code: BadRequest)
Image

Rasmus715 avatar Dec 18 '25 08:12 Rasmus715

Thanks for testing this out - @stephaniezyen has reached out to the owners of this resource type, and we'll share an update here once we have more info.

anthony-c-martin avatar Dec 18 '25 20:12 anthony-c-martin

I found that when not using the outputs of the redis resources is doesnt produce the issue

dennisblokland avatar Jan 19 '26 10:01 dennisblokland

I found that when not using the outputs of the redis resources is doesnt produce the issue

Unfortunately, I'm unable to verify that. On my side the deployment fails with the same error, even when the outputs of both redisEnterprise & redisEnterprise/databases are not used.

Rasmus715 avatar Jan 30 '26 08:01 Rasmus715

@stephaniezyen @anthony-c-martin An update: the issue occurs when trying to pull redisEnterprise primary key using either a) resource output

redisEnterprisePrimaryKey: redisEnterprise.listKeys().primaryKey

b) listKeys method

listKeys(
      resourceId('Microsoft.Cache/redisEnterprise', 'redis-${prefix}-${environment}-${locationShort}'),
      '2025-08-01-preview'
    ).primaryKey

Without it, the resources deploying successfully.

Rasmus715 avatar Feb 09 '26 12:02 Rasmus715

@Rasmus715 do you add decorator @secure() for the output?

slavizh avatar Feb 09 '26 13:02 slavizh

@Rasmus715 do you add decorator @secure() for the output?

For the input parameter of module, where the primary key is used, there is a secure() decorator.

@secure()
param redisEnterprisePrimaryKey string

Rasmus715 avatar Feb 09 '26 13:02 Rasmus715

@Rasmus715 for the output. What you output is a secret.

slavizh avatar Feb 09 '26 14:02 slavizh

https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/outputs?tabs=azure-powershell#secure-outputs

slavizh avatar Feb 09 '26 14:02 slavizh

No module output are used within redisEnterpise resource.

resource redisEnterprise 'Microsoft.Cache/redisEnterprise@2025-08-01-preview' = {
  location: 'West Europe'
  name: 'redis-${prefix}-${environment}-${locationShort}'
  tags: {}
  sku: {
    name: 'Balanced_B0'
  }
  properties: {
    minimumTlsVersion: '1.2'
    highAvailability: 'Enabled'
    publicNetworkAccess: 'Enabled'
  }
  identity: {
    type: 'None'
  }
}

resource redisEnterpriseDatabase 'Microsoft.Cache/redisEnterprise/databases@2025-05-01-preview' = {
  parent: redisEnterprise
  name: 'default'
  properties: {
    clientProtocol: 'Encrypted'
    port: 10000
    clusteringPolicy: 'OSSCluster'
    evictionPolicy: 'NoEviction'
    persistence: {
      aofEnabled: false
      rdbEnabled: false
    }
    deferUpgrade: 'NotDeferred'
    accessKeysAuthentication: 'Enabled'
  }
}

module keyVaultModule 'keyvault.bicep' = {
  name: 'keyvault_${deployment().name}'
  params: {
    keyVaultName: keyvaultName
    ---
    redisEnterprisePrimaryKey: listKeys(
      resourceId('Microsoft.Cache/redisEnterprise', 'redis-${prefix}-${environment}-${locationShort}'),
      '2025-08-01-preview'
    ).primaryKey 
    OR  
    redisEnterprisePrimaryKey: redisEnterprise.listKeys().primaryKey
  }
}

Rasmus715 avatar Feb 09 '26 14:02 Rasmus715

ok than it is irrelevant. You could try tp pass the redis details - name, resource group and subscription (in case they are in different one) to the module keyvault.bicep and within that module call redis instance as existence resource and call listKeys() to put the primary key in Key vault secret - assuming that is what you want to do. Passing that as parameters in the module is not necessary. Only when you want to get secret value from Key Vault is required to have it as input for parameter. Anything that uses list*() can be called directly without having to be passed as parameter.

slavizh avatar Feb 09 '26 15:02 slavizh

@Rasmus715 I'm one of the Redis Enterprise service owners. I checked your bicep, everything looks good except the output has an error:

redisEnterprisePrimaryKey: redisEnterprise.listKeys().primaryKey The listKeys API is under redisEnterprise/databases instead: https://learn.microsoft.com/en-us/rest/api/redis/redisenterprisecache/databases/list-keys?view=rest-redis-redisenterprisecache-2025-07-01&tabs=HTTP

So the correct way to invoke it in your bicep is:

redisEnterprisePrimaryKey: redisEnterpriseDatabase.listKeys().primaryKey

Can you confirm if this fixes the issue for you?

Acknowledge that the error message is confusing and misleading. It has nothing to do with "localPath" - just the request hit a unsupported endpoint and triggered an unexpected validation failure message mapping. We already filed the internal bug to improve error message.

bangbingsyb avatar Feb 11 '26 23:02 bangbingsyb

I have missed the list keys as well but I have blogged about this several months ago: https://cloudadministrator.net/2025/10/21/list-keys-for-azure-managed-redis-with-bicep/

slavizh avatar Feb 12 '26 08:02 slavizh