fix: remove subscription scope from Bicep custom role to unblock nightly deploy#526
Merged
MikeWedderburn-Clarke merged 2 commits intomainfrom Apr 12, 2026
Merged
Conversation
…cep error The dbWakeCustomRole resource in database.bicep had scope: subscription() which is invalid in a resource-group-scoped Bicep file (BCP139). Bicep validates this at compile time even when the resource is conditional (deployDbWakeRole: false). Removing the explicit scope deploys the custom role at resource group scope, which is valid for Microsoft.Authorization/roleDefinitions and follows the principle of least privilege (Constitution XIV). Agent-Logs-Url: https://github.com/microsoft/CommunityManagement-Sample-Spec-Kit/sessions/07c1698b-5fdb-4292-a6a3-3c5176050bb5 Co-authored-by: MikeWedderburn-Clarke <5323631+MikeWedderburn-Clarke@users.noreply.github.com>
Co-authored-by: MikeWedderburn-Clarke <5323631+MikeWedderburn-Clarke@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
MikeWedderburn-Clarke
April 12, 2026 20:38
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Nightly deploy job fails at Bicep compilation with BCP139:
scope: subscription()ondbWakeCustomRoleis invalid in a resource-group-scoped file. Bicep validates scope rules at compile time even when the resource is conditional (deployDbWakeRole: false).scope: subscription()fromdbWakeCustomRoleindatabase.bicep— custom role definitions are valid at RG scope and this is more least-privilege anywayresource dbWakeCustomRole 'Microsoft.Authorization/roleDefinitions@2022-04-01' = if (deployDbWakeRole) { - scope: subscription() name: guid('db-wake-role', subscription().subscriptionId, resourceGroup().id)Pre-existing Bicep warnings (unused params, BCP318 on conditional module outputs) are unchanged and non-blocking.