diff --git a/cli/azd/internal/scaffold/scaffold.go b/cli/azd/internal/scaffold/scaffold.go index aedbe2d3c06..8e2799824ac 100644 --- a/cli/azd/internal/scaffold/scaffold.go +++ b/cli/azd/internal/scaffold/scaffold.go @@ -69,9 +69,6 @@ func supportingFiles(spec InfraSpec) []string { files := []string{"/abbreviations.json"} if len(spec.Services) > 0 { - if spec.DbRedis != nil { - files = append(files, "/modules/set-redis-conn.bicep") - } files = append(files, "/modules/fetch-container-image.bicep") } diff --git a/cli/azd/resources/scaffold/base/modules/set-redis-conn.bicep b/cli/azd/resources/scaffold/base/modules/set-redis-conn.bicep deleted file mode 100644 index 813f96fbcbf..00000000000 --- a/cli/azd/resources/scaffold/base/modules/set-redis-conn.bicep +++ /dev/null @@ -1,29 +0,0 @@ -param name string -param keyVaultName string -param passwordSecretName string -param urlSecretName string - -resource redisConn 'Microsoft.Cache/redis@2024-03-01' existing = { - name: name -} - -resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' existing = { - name: keyVaultName -} - -resource passwordSecret 'Microsoft.KeyVault/vaults/secrets@2022-07-01' = { - name: passwordSecretName - parent: keyVault - properties: { - value: redisConn.listKeys().primaryKey - } -} - -resource urlSecret 'Microsoft.KeyVault/vaults/secrets@2022-07-01' = { - name: urlSecretName - parent: keyVault - properties: { - value: 'rediss://:${redisConn.listKeys().primaryKey}@${redisConn.properties.hostName}:${redisConn.properties.sslPort}' - } -} - diff --git a/cli/azd/resources/scaffold/templates/resources.bicept b/cli/azd/resources/scaffold/templates/resources.bicept index a22399694f6..92d9826a550 100644 --- a/cli/azd/resources/scaffold/templates/resources.bicept +++ b/cli/azd/resources/scaffold/templates/resources.bicept @@ -389,7 +389,7 @@ module {{bicepName .Name}} 'br/public:avm/res/app/container-app:0.8.0' = { {{- end}} {{- if .DbRedis}} -module redis 'br/public:avm/res/cache/redis:0.3.2' = { +module redis 'br/public:avm/res/cache/redis:0.9.0' = { name: 'redisDeployment' params: { // Required parameters @@ -397,20 +397,15 @@ module redis 'br/public:avm/res/cache/redis:0.3.2' = { // Non-required parameters location: location skuName: 'Basic' + {{- if .Services}} + secretsExportConfiguration: { + keyVaultResourceId: keyVault.outputs.resourceId + primaryAccessKeyName: 'REDIS-PASSWORD' + primaryConnectionStringName: 'REDIS-URL' + } + {{- end}} } } - -{{- if .Services}} -module redisConn './modules/set-redis-conn.bicep' = { - name: 'redisConn' - params: { - name: redis.outputs.name - passwordSecretName: 'REDIS-PASSWORD' - urlSecretName: 'REDIS-URL' - keyVaultName: keyVault.outputs.name - } -} -{{- end}} {{- end}} {{- if .Services}}