Skip to content

BCP134 when trying to have a management group scoped module called from a resource group scoped bicep #13612

Answered by jeskew
sopelt asked this question in General
Discussion options

You must be logged in to vote

Bicep is reflecting an ARM limitation on what kinds of scopes can be targeted from other scopes.

There is a way to work around it, but it requires two modules so that you can move from resource group scope to tenant scope, then from tenant scope to management group scope. Note that you need the Microsoft.Resources/deployments/write permission on the RG, the tenant, and the MG for this to work.

main.bicep (resource group scoped)

param mgName string

module tenantScoped 'tenant_scoped.bicep' = {
  name: 'tenantScoped'
  scope: tenant()
  params: {
    mgName: mgName
  }
}

output mg object = tenantScoped.outputs.mg

tenant_scoped.bicep

targetScope = 'tenant'

param mgName string

module mgSc…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@sopelt
Comment options

@jeskew
Comment options

@sopelt
Comment options

Answer selected by sopelt
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
Converted from issue

This discussion was converted from issue #13544 on March 13, 2024 19:06.