Skip to content
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

Scope "managementGroup" is not valid for this module. Permitted scopes: "resourceGroup".bicep(BCP134) #6597

Closed
Ex3mXX opened this issue Apr 20, 2022 · 2 comments
Labels
Needs: Author Feedback Awaiting feedback from the author of the issue troubleshooting

Comments

@Ex3mXX
Copy link

Ex3mXX commented Apr 20, 2022

Bicep version
VS Code v0.5.6

Describe the bug
When using 'Microsoft.Authorization/policyExemptions@2020-07-01-preview' as a module the Scope options can't be set to ManagementGroup.

To Reproduce
main.bicep

targetScope = 'managementGroup'
// POLICY EXEMPTIONS MODULE
module exemptions './exemptions.bicep' = {
  name: 'exemptions'
}

exemptions.bicep

// RESOURCES
resource exemption_1 'Microsoft.Authorization/policyExemptions@2020-07-01-preview' = {
  name: 'exemption_1'
   properties:{
     exemptionCategory: 'Waiver'
     policyAssignmentId: 'someId'
   }
}

Additional context
When not using module it works without scope, and when using module it only accept resource group as scope.

@ghost ghost added the Needs: Triage 🔍 label Apr 20, 2022
@alex-frankel
Copy link
Collaborator

The targetScope is not inherited, so you need to declare targetScope = 'managementGroup' in exemptions.bicep as well.

targetScope = 'managementGroup'

// RESOURCES
resource exemption_1 'Microsoft.Authorization/policyExemptions@2020-07-01-preview' = {
  name: 'exemption_1'
   properties:{
     exemptionCategory: 'Waiver'
     policyAssignmentId: 'someId'
   }
}

@Ex3mXX
Copy link
Author

Ex3mXX commented Apr 21, 2022

You are correct, code verifies fine now.
Thanks for your help!

@Ex3mXX Ex3mXX closed this as completed Apr 21, 2022
@Azure Azure locked as resolved and limited conversation to collaborators May 25, 2023
@StephenWeatherford StephenWeatherford added Needs: Author Feedback Awaiting feedback from the author of the issue and removed awaiting response labels Oct 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Author Feedback Awaiting feedback from the author of the issue troubleshooting
Projects
None yet
Development

No branches or pull requests

3 participants