Skip to content

fix: remove subscription scope from Bicep custom role to unblock nightly deploy#526

Merged
MikeWedderburn-Clarke merged 2 commits intomainfrom
copilot/fix-gh-nightly-build-issue
Apr 12, 2026
Merged

fix: remove subscription scope from Bicep custom role to unblock nightly deploy#526
MikeWedderburn-Clarke merged 2 commits intomainfrom
copilot/fix-gh-nightly-build-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 12, 2026

Nightly deploy job fails at Bicep compilation with BCP139: scope: subscription() on dbWakeCustomRole is invalid in a resource-group-scoped file. Bicep validates scope rules at compile time even when the resource is conditional (deployDbWakeRole: false).

  • Remove scope: subscription() from dbWakeCustomRole in database.bicep — custom role definitions are valid at RG scope and this is more least-privilege anyway
 resource 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.

Copilot AI and others added 2 commits April 12, 2026 19:53
…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>
@MikeWedderburn-Clarke MikeWedderburn-Clarke marked this pull request as ready for review April 12, 2026 20:38
@MikeWedderburn-Clarke MikeWedderburn-Clarke merged commit 4d297a7 into main Apr 12, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants