Skip to content

RBAC Bicep module InvalidDeployment: The 'location' property must be specified for #4330

Discussion options

You must be logged in to vote

Without the targetScope being specified, Bicep is assuming you're trying to deploy to the resourceGroup scope, so doesn't do any validation for location. The deployments engine allows your file to be deployed at a higher scope, regardless of the missing location. The solution is to use targetScope - e.g.:

  • mgTest.bicep

    targetScope = 'managementGroup'
    
    resource Elevated_AzureMG_Test_Admin_null_Security_Admin 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = {
      name: guid('Elevated_AzureMG_Test_Admin (null) : Security Admin')
      properties: {
        roleDefinitionId: '${roleDefPrefix}${string('fb1c8493-542b-48eb-b624-b4c8fea62acd')}'
        principalId: 'xxxx-xxxx-xxxx'
      }
    }
    
  • sub…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by alex-frankel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants