Skip to content

compose: azd add single database fails #4574

Description

@JeffreyCA

Output from azd version
azd version 1.11.0 (commit 5b92e06)

Describe the bug
Provisioning a minimal project with a single database resource (Postgres, Redis, etc.) that was added using azd add fails with:

ERROR: initializing provisioning manager: failed to compile bicep template: failed running bicep build: exit code: 1, stdout: , stderr: C:\Users\JEFFRE~1\AppData\Local\Temp\azd-infra1744480999\main.bicep(32,18) : Error BCP104: The referenced module has errors.
C:\Users\JEFFRE~1\AppData\Local\Temp\azd-infra1744480999\resources.bicep(5,7) : Warning no-unused-params: Parameter "tags" is declared but never used. [https://aka.ms/bicep/linter/no-unused-params]
C:\Users\JEFFRE~1\AppData\Local\Temp\azd-infra1744480999\resources.bicep(10,7) : Warning no-unused-params: Parameter "principalId" is declared but never used. [https://aka.ms/bicep/linter/no-unused-params]
C:\Users\JEFFRE~1\AppData\Local\Temp\azd-infra1744480999\resources.bicep(31,19) : Error BCP057: The name "keyVault" does not exist in the current context.

To Reproduce

  1. azd config set alpha.compose on
  2. Create empty directory and cd into it
  3. azd init - select Create a minimal project and enter a project name
  4. azd add - select Database, then select any of the supported options (MongoDB, PostgreSQL, Redis), then enter a name
  5. Accept the changes to azure.yaml.
  6. When asked to provision the changes, select Yes (preview changes) or Yes

Provisioning the resource fails:

>azd init

Initializing an app to run on Azure (azd init)

? How do you want to initialize your app? Create a minimal project
? What is the name of your project? (test)

? What is the name of your project? test

SUCCESS: Generated azure.yaml project file.
Run azd add to add new Azure components to your project.

>azd add
? What would you like to add? Database
? Which type of database? Redis

Previewing changes to azure.yaml:

+  redis:
+      type: db.redis

? Accept changes to azure.yaml? Yes
? Accept changes to azure.yaml? (Y/n) Y
SUCCESS: azure.yaml updated.

? Do you want to provision these changes? Yes

Provisioning Azure resources (azd provision)
Provisioning Azure resources can take some time.


ERROR: initializing provisioning manager: failed to compile bicep template: failed running bicep build: exit code: 1, stdout: , stderr: C:\Users\JEFFRE~1\AppData\Local\Temp\azd-infra860943064\main.bicep(32,18) : Error BCP104: The referenced module has errors.
C:\Users\JEFFRE~1\AppData\Local\Temp\azd-infra860943064\resources.bicep(5,7) : Warning no-unused-params: Parameter "tags" is declared but never used. [https://aka.ms/bicep/linter/no-unused-params]
C:\Users\JEFFRE~1\AppData\Local\Temp\azd-infra860943064\resources.bicep(10,7) : Warning no-unused-params: Parameter "principalId" is declared but never used. [https://aka.ms/bicep/linter/no-unused-params]
C:\Users\JEFFRE~1\AppData\Local\Temp\azd-infra860943064\resources.bicep(31,19) : Error BCP057: The name "keyVault" does not exist in the current context.

Expected behavior
Provisioning should succeed

Environment

  • IDE and version: VS Code 1.95.3

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Fields

No fields configured for Bug.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions