Assign RBAC role scoped to Data Collection Rule in separate resource group created by Metrics Workspace #13352
vanzod
started this conversation in
Authoring Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In my resource group I am deploying a VM to which I have to assign MonitoingMetricsPublisher role with Data Collection Rule resource as scope. The DCR is created automatically in a separate resource group when deploying an Azure Monitor Workspace in the same resource group as the VM. For this reason, the name of the DCR resource group is not known at the start of the deployment.
I need help understanding how to correctly set the scope for the assignment.
In my main bicep file I call a module that deploys both the Azure Monitor Workspace and the VM:
Here is the
telemetry.bicep
file. TheprometheusScraper
module creates the VM whileworkspaceGrafana
creates the Monitor Workspace.The
assign_role.bicep
file takes care of creating the assignment by using the DCR resource ID to reference the existing DCR resource created inworkspaceGrafana
module:In this configuration bicep fails as the scope of
roleAssignment
should match the scope of the bicep file.If I then try to change the scope of
assign_role.bicep
to the DCR resource group by modifying thetelemetry.bicep
file as follows, it also fails as the module's scope requires a value that can be calculated at the start of the deployment.Beta Was this translation helpful? Give feedback.
All reactions