-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Existing
resource reference cannot find scope
#5330
Comments
The In your case you can fetch the
output principalId string = managedIdentity.properties.principalId
output principalRef string = managedIdentity.outputs.principalId Can you check if these changes fixes your issue? |
Hey @StefanIvemo, However, I do have to wonder if there is not a use case in using I guess it's not working because ARM searches resources in resource pool that existed before the deployment was triggered. However, if that's the case I'd hope that it's possible to consider also those resources that were added during runtime. |
Bicep version
Describe the bug
Using an
existing
resource and as such areference()
(+ externalReference()) is unable to correctly use itsscope
property if that scope is deployed in the same template:To Reproduce
Note the following example template in which run's in a deployment scope to deploy a resource group and resources into it.
Additional context
When consulting the deployment in Azure I can clearly see that the MI was successfully deployed. However, the reference itself can apparently not resolve the already deployed resource group.
Note that the above example is a working version that can reproduce the bug. However, it is not the use case I have. That one wants to reference the deployed principal to fetch it's object ID and create role assignment for a storage account.
The text was updated successfully, but these errors were encountered: