Skip to content

This expression is being used in an assignment to the "name" property of the "module" type #262

@slavizh

Description

@slavizh

Bicep version
bicep --versio

Resource and API version
Which Microsoft.Graph resource and API version has the issue?
Microsoft.Graph/[email protected]

Auth flow
Is the deployment interactive (e.g. with a signed in user) or automated (e.g. with an application)?
both

Deployment details
n/A

Describe the bug
A clear and concise description of what the bug is vs what you expected to happen:

I have application defined and I want to pass uniqueName directly from the resource reference in the module name.

module servicePrincipal 'service-principal.bicep' = if (application.servicePrincipal.deploy) {
  name: 'servicePrincipal-${uniqueString(applicationRes.uniqueName)}'
  params: {
    appId: applicationRes.appId
  }
}

This creates automatic dependsOn so I should not explicitly add it but in our case it gives error.

This expression is being used in an assignment to the "name" property of the "module" type, which requires a value that can be calculated at the start of the deployment. Properties of applicationRes which can be calculated at the start include .bicep[BCP120](https://aka.ms/bicep/core-diagnostics#BCP120)

This should be possible as for Azure resources is possible. In their case of course the property is name instead of uniqueName. The Bicep CLI when compiles the file automatically picks the value for name that is defined in the resource and creates dependency on the resource. The Bicep CLI should do the same with uniqueName or whatever ID is unique for the resource (for example for service principal is appId). Most likely this is more of a Bicep bug rather Graph but we can cross post if needed. I do not know if it is possible to be done or it it is general limitation with extension resources.

To Reproduce
Steps to reproduce the behavior:

Additional context
Add any other context about the problem here. For example, what permissions does the identity have if it's a permission issue?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions